Internals
ska_telmodel.schema
- ska_telmodel.schema._validate_schema_using_document_url(obj: dict, version: str) None[source]
Validate a configuration object efficiently using cached validators.
Implements an efficient caching mechanism for external schema documents.
Automatically caches schemas fetched from external URLs.
Used LRU (Least Recently Used) cache strategy.
Added Configurable cache size to manage memory usage.
- Parameters:
obj – Object to validate
version – Schema version string
- Returns:
None
- Raises:
ValueError – On schema validation failure.
ska_telmodel._common
- ska_telmodel._common.MID_MKT = Regex('^MKT0([0-5][0-9]|6[0-3])$')
MID Meerkat, 000-063.
- ska_telmodel._common.MID_SKA = Regex('^SKA((?!000)0[0-9][0-9]|1[0-2][0-9]|13[0-3])$')
MID SKA, 001-133.
- class ska_telmodel._common.TMSchema(schema: Any | None = None, error=None, ignore_extra_keys: bool = False, name: str | None = None, description: str | None = None, as_reference: bool = False, version: str | None = None, strict: bool = False)[source]
Wrapper on top of schema.Schema for incremental schema build-up.
- find_field_recursive(name: str) TMSchema | None[source]
Recursively finds a field of the given name in the schema
If the key exists multiple times, an arbitrary item will get returned. Note that to be returned by this function, the field must be in a TMSchema - if the schema is specified as a dictionary, it won’t be found.
- Parameters:
name – Name of the field to look for
- Returns:
A schema containing the given key
- is_field_optional(name: str) bool | None[source]
Checks whether the field with the given name is optional.
Returns None if the field does not exist
- Parameters:
name – Name of the field
- Returns:
bool
- stringify_keys_recursive() TMSchema[source]
Returns a schema where all keys are strings.
For
schemait is valid to have a type as key in the schema (e.g.str), which stands for an arbitrary key. However, this will not work when generating documentation, so it needs to be replaced by a string in those cases.- Returns:
Schema with keys renamed as appropriate
- ska_telmodel._common.get_unique_id_schema(strict: bool, type_re: str = '[a-z0-9]+') Schema[source]
Return schema for unique identifier.
- Parameters:
type_re – Restricts ID type(s) to accept.
- ska_telmodel._common.interface_uri(prefix: str, *versions: int) str[source]
Make an URI from the given prefix and versions
- Parameters:
prefix – Schema URI prefix. Must end in ‘/’
versions – Components of the version
- ska_telmodel._common.lookup_module(module, version: str)[source]
Allows importing dev versions of submodules in the form of vX_Y_dev if SKA_TELMODEL_ALLOW_DEV_VERSION environment variable is set to True.
ska_telmodel.channel_map
Tools for working with JSON compressed channel maps.
The SKA is meant to have a large number of channels, which means that any type of per-channel configuration might become very cumbersome to transfer and reason about. To prevent such issues we are using a simple run-length encoding to “compress” the representation. The idea is that if we write:
[ [0, 0], [200, 1], [400, 3] ]
We essentially mean the dictionary:
{ 0: 0, 1: 0, ..., 199: 0, 200: 1, ..., 399: 1, 400: 3, ...}
Furthermore runs of numbers are supported, by adding an increment:
[ [0, 0, 1], [200, 1] ]
Means:
{ 0: 0, 1: 1 , 2: 2, ..., 199: 199, 200: 1, ...}
- ska_telmodel.channel_map.channel_map_at(channel_map: List[list], channel: int, make_entry: bool = False) Any[source]
Query a value from a channel map
- Parameters:
channel_map – Queried map
channel – Channel ID to query
make_entry – Return an channel map entry (including increment) instead of just the value
- Returns:
Value from map
- ska_telmodel.channel_map.shift_channel_map(channel_map: List[list], channel_shift: int) List[list][source]
Shift a channel map by some channel distance
- Parameters:
channel_map – Channel map to use
channel_shift – Shift to apply
- ska_telmodel.channel_map.split_channel_map(channel_map: List[list], first_channel: int, channel_group_steps: int, rebase_groups: int | None = None, minimum_groups: int = 0) List[List[list]][source]
Split a channel map using a constant channel step length
- Parameters:
channel_map – Channel map to split. Each entry is expected to have the start channel in the first field, and mapped data in the remaining entries
first_channel – First channel to appear in the map
channel_group_steps – Chunks to split the channel map into
rebase_groups – Start every group at given channel index (None: left as-is)
minimum_groups – Minimum number of groups to return
- Returns:
List of channel maps
- ska_telmodel.channel_map.split_channel_map_at(channel_map: List[list], channel_groups: List[int], rebase_groups: int | None = None) List[List[list]][source]
Split a channel map at certain points
- Parameters:
channel_map – Channel map to split. Each entry is expected to have the start channel in the first field, and mapped data in the remaining entries
channel_groups – Boundaries between channel groups. The n-th returned channel map will cover channels channel_groups[n]..channel_groups[n+1]-1. Needs to have at least two entries.
rebase_groups – Start every group at given channel index (None: left as-is)
- Returns:
List of channel maps
ska_telmodel.data
- class ska_telmodel.data.backend.CARBackend(uri: str, *args, **kwargs)[source]
Represents data in (a mirror of) the SKA central artefact repository. Permissible URI formats:
car:[project name]?[branch]#[directory] car://[gitlab server]/[project name]?[branch]#[directory]
So for instance:
car:ska-telmodel?master car://gitlab.com/ska-telescope/ska-telmodel?master#tmdata
The source of truth might still be Gitlab, yet this backend will only work with artefacts that have been uploaded to the CAR. The short form URI will be expanded into the long form automatically.
- class ska_telmodel.data.backend.FilesystemBackend(uri: str, update: bool = False)[source]
Retrieves data from a locally accessible file system. URI format:
file://[absolute path]
Note that changes to the file system are outside of our control. Consistency must be ensured externally.
- classmethod backend_name() str[source]
Returns the name of the backend.
Will be used for the scheme in URIs to identify the backend type of a telescope model data source.
- copy(key: str, dest: str)[source]
Write key contents to a file.
Raises KeyError if the key does not exist
- Parameters:
key – Key to query
dest – Path of destination file
- exists(key: str) bool[source]
Check whether a given key exists.
- Parameters:
key – Key to query
- Returns:
True if key exists
- get(key: str) bytes[source]
Get the data stored with the given key
- Parameters:
key – Key to query
- Returns:
Bytes stored at key
- get_uri(pinned: bool) str[source]
Returns URI for this telescope model data backend
- Parameters:
pinned – Attempt to return an URI that will continue to refer to this specific version of telescope model data
- Returns:
URI identifying data source
- list_keys(key_prefix: str = '') Iterable[str][source]
List children keys
Yields all keys with prefix “{key_prefix}/” in ascending order
- Parameters:
key_prefix – Path to query
- class ska_telmodel.data.backend.GitlabBackend(uri: str, update: bool = False, gl: gitlab.Gitlab = None, try_nexus: bool = True, nexus_url: str = None, env=None)[source]
Represents data in a GitLab repository. URI format:
gitlab://[gitlab server]/[project name]?[branch]#[directory]
So for instance:
gitlab://gitlab.com/ska-telescope/ska-telmodel?master#tmdata
Would refer to data contained in the
ska-telmodelrepository itself.Repositories accessed in this way should make sure to activate the
tmdatastandard continuous integration stages (see https://gitlab.com/ska-telescope/templates-repository ) to ensure that telescope model data is cached in the SKAO central artefact repository. Once that has been done, this library will never actually query GitLab directly.Furthermore, this backend will cache all loaded data locally, including resolved Gitlab references (like
masterin the example above). This especially means that once instantiated, the version of data will be “pinned” even between different instances (and processes). Use theupdateparameter toska_telmodel.data.TMDataorGitlabBackendrespectively to refresh the local cache.- classmethod backend_name() str[source]
Returns the name of the backend.
Will be used for the scheme in URIs to identify the backend type of a telescope model data source.
- copy(key: str, dest: str)[source]
Write key contents to a file.
Raises KeyError if the key does not exist
- Parameters:
key – Key to query
dest – Path of destination file
- exists(key: str) bytes[source]
Check whether a given key exists.
- Parameters:
key – Key to query
- Returns:
True if key exists
- get(key: str) bytes[source]
Get the data stored with the given key
- Parameters:
key – Key to query
- Returns:
Data stored at key, or None if it doesn’t exist
- get_uri(pinned: bool) str[source]
Returns URI for this telescope model data backend
- Parameters:
pinned – Attempt to return an URI that will continue to refer to this specific version of telescope model data
- Returns:
URI identifying data source
- list_keys(key_prefix: str = '') Iterable[str][source]
List children keys
Yields all keys with prefix “{key_prefix}/” in ascending order. Exception is if the path is empty, in which case all available keys are listed.
- Parameters:
key_prefix – Path to query
- meta(key: str) dict[str, Any][source]
Retrieve meta data regarding the given key.
- Parameters:
key – Key to query
- Returns:
Dictionary with the size, and is_large values
- class ska_telmodel.data.backend.MemoryBackend(uri: str, update: bool = False)[source]
Represents in-memory data. URIs should look as follows:
mem://?[key1]=[value1]&[key2]=[value2]
This will directly set the given telescope model data keys to the given values. Useful for testing, and overriding single values in telescope model data.
- classmethod backend_name() str[source]
Returns the name of the backend.
Will be used for the scheme in URIs to identify the backend type of a telescope model data source.
- get(key: str) bytes[source]
Get the data stored with the given key
- Parameters:
key – Key to query
- Returns:
Bytes stored at key
- get_uri(pinned: bool) str[source]
Returns URI for this telescope model data backend
- Parameters:
pinned – Attempt to return an URI that will continue to refer to this specific version of telescope model data
- Returns:
URI identifying data source
- class ska_telmodel.data.backend.TMDataBackend(uri: str, update: bool = False)[source]
Base class for telescope model data backends
Sub-classes should override
backend_name(), then utilisetelmodel_backend()to register the telescope model data backend. A minimal implementation should furthermore providelist_keys()andget().- abstract classmethod backend_name() str[source]
Returns the name of the backend.
Will be used for the scheme in URIs to identify the backend type of a telescope model data source.
- copy(key: str, dest: str)[source]
Write key contents to a file.
Raises KeyError if the key does not exist
- Parameters:
key – Key to query
dest – Path of destination file
- exists(key: str) bool[source]
Check whether a given key exists.
- Parameters:
key – Key to query
- Returns:
True if key exists
- abstract get(key: str) bytes[source]
Get the data stored with the given key
- Parameters:
key – Key to query
- Returns:
Data stored at key, or None if it doesn’t exist
- get_uri(pinned: bool) str[source]
Returns URI for this telescope model data backend
- Parameters:
pinned – Attempt to return an URI that will continue to refer to this specific version of telescope model data
- Returns:
URI identifying data source
Check whether argument key represents a hidden file
For this to be valid, it needs to: * Have every path segment start with a letter * Have a filename that begins with a dot
- Returns:
Validity of key
- abstract list_keys(key_prefix: str = '') Iterable[str][source]
List children keys
Yields all keys with prefix “{key_prefix}/” in ascending order. Exception is if the path is empty, in which case all available keys are listed.
- Parameters:
key_prefix – Path to query
- meta(key: str) dict[str, Any][source]
Retrieve meta data regarding the given key.
- Parameters:
key – Key to query
- Returns:
Dictionary with the size, and is_large values
- open(key: str) IO[bytes][source]
Access data at given key as a file-like object
Raises KeyError if the key does not exist
- Parameters:
key – Key to query
This module concerns itself with adding new data to a current repository.
- class ska_telmodel.data.new_data_backend.GitBackend(repo: str = 'ska-telescope/ska-telmodel-data', git_host: str = 'gitlab.com')[source]
This backend uses git as it’s data source, it assumes that the authentication is handled on the host side.
The repo should be one of (in order of preference):
ska-telescope/ska-telmodel(from the ssh path, this is from the colon to the .git)
If
checkout_locationis provided that will be used instead of a temp directory. By default we use~/.ska-telmodeland place each checkout in there.- add_data(path: Path, key: str | None = None) None[source]
Copy new file into repo, and run validate on each file.
If
pathis a directory, the directory structure will also be taken into account when creating the key.- Parameters:
path – This can be either a directory of files, or a single file.
key – If
pathis a directory, then key is used as the prefix, ifpathis a file then this is used as the key.
- commit_transaction() None[source]
Push changes to branch, if there are no local uncommitted changes.
- start_transaction(name_of_update: str, create_new_branch: bool = True) None[source]
Create a new clone (if needed), pull the main branch, and create a new branch.
- Parameters:
name_of_update – This will become the branch name.
- class ska_telmodel.data.new_data_backend.NewDataBackend[source]
Base class for the data uploading backends.
This class is meant just as a guide to how to use the backends.
- abstract add_data(path: Path, key: str | None = None) None[source]
Add a new data file or directory to the transaction.
- Parameters:
path – This can be either a directory of files, or a single file.
key – If
pathis a directory, then key is used as the prefix, ifpathis a file then this is used as the key.
ska_telmodel.csp
This module define some functions that can be used to define the common section of the CSP configure schema.
- ska_telmodel.csp.common_schema.add_common_frequency_band(version: str, strict: bool, schema: TMSchema) None[source]
Add the frequency band field to the low schema.
- Parameters:
version – Interface Version URI
strict – Schema strictness
schema – the schema to which the field is to be added
- ska_telmodel.csp.common_schema.add_mid_frequency_band(version: str, strict: bool, schema: TMSchema) None[source]
Add the frequency band field to the mid schema.
- Parameters:
version – Interface Version URI
strict – Schema strictness
schema – the schema to which the field is to be added
- ska_telmodel.csp.common_schema.use_camel_case(version: str) bool[source]
Checks whether the given CSP schema version uses camel-case attribute names.
Low CSP schema has been developed after the changes to keyword case. This method returns always False for Low CSP schema versions.
- param version:
Interface Version URI
- returns:
True or False according to schema version number
- ska_telmodel.csp.config.add_lowcbf_visibility_receive_addresses(csp_config: dict, scan_receive_addrs: dict, sdp_interface_version) dict[source]
Add SDP visibility receive addresses into low-cbf configuration
- Parameters:
csp_config – CSP input configuration
scan_receive_addrs – SDP receive addresses for scan
sdp_interface_version – SDP interface version
- Returns:
New CSP configuration
- ska_telmodel.csp.config.add_midcbf_visibility_receive_addresses(csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str) dict[source]
Add SDP visibility receive addresses into mid-cbf configuration
- Parameters:
csp_config – CSP input configuration
scan_receive_addrs – SDP receive addresses for scan
csp_interface_version – CSP interface version to assume
sdp_interface_version – SDP interface version to assume
- Returns:
New CSP configuration
- ska_telmodel.csp.config.add_pss_receive_addresses(csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str) dict[source]
Add SDP visibility receive addresses into pulsar search configuration
- Parameters:
csp_config – CSP input configuration
scan_receive_addrs – SDP receive addresses for scan
csp_interface_version – CSP interface version to assume
sdp_interface_version – SDP interface version to assume
- Returns:
New CSP configuration
- ska_telmodel.csp.config.add_pst_receive_addresses(csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str) dict[source]
Add SDP visibility receive addresses into pulsar timing configuration
- Parameters:
scan_trype – Scan type executed
csp_config – CSP input configuration
sdp_receive_addrs – SDP receive addresses for scan
- Returns:
New CSP configuration
- ska_telmodel.csp.config.add_receive_addresses(scan_type: str, csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str, telescope_branch: str = 'mid') dict[source]
Add SDP visibility receive addresses into CSP configuration
- Parameters:
csp_config – CSP input configuration
scan_receive_addrs – SDP receive addresses for scan
csp_interface_version – CSP interface version to assume
sdp_interface_version – SDP interface version to assume
- Returns:
New CSP configuration
- ska_telmodel.csp.config.get_fsp_channel_offset(csp_config_in: dict) int[source]
Determines first channel ID within an FSP
- ska_telmodel.csp.config.get_fsp_output_channel_offset(fsp_config: dict, fsp_id: str, fsp_ch_offset: str) int[source]
Determines the FSP channel offset. Either read from the dictionary or reconstructed.
- Parameters:
fsp_config – FSP configuration structure
fsp_id – Position of FSP in configuration
fsp_ch_offset – Name of FSP channel offset field
- ska_telmodel.csp.examples.delete_config_pst_keys(json_example)[source]
Remove PST schema attributes that are not needed in the csp schema.
- ska_telmodel.csp.examples.expand_output_port(input_mapping: list[list[int]], max_channels: int = 14880) list[list[int]][source]
Expand output_port mapping to give concrete ports for each stream of 20 channels. Port value is set from initial port and incremented by the port_increment value if given, or 1 if the increment is not present.
- Parameters:
input_mapping – output_port mapping to convert from
- ska_telmodel.csp.examples.get_csp_assignresources_example(version: str) dict[source]
Generate example of CSP assignresources argument
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.examples.get_csp_config_example(version: str, scan: str | None = None) dict[source]
Generate examples for CSP configuration strings
- Parameters:
version – Version URI of configuration format
scan – Includes SDP receive addresses for a scan? None means that this is “template” configuration as passed to TMC. Valid parameters: cal_a, science_a
- ska_telmodel.csp.examples.get_csp_delaymodel_example(version: str) dict[source]
Generate example of CSP delay model argument
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.examples.get_csp_endscan_example(version: str) dict[source]
Generate example of CSP endscan argument
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.examples.get_csp_low_delaymodel_example(version: str) dict[source]
Generate example of CSP low delay model argument
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.examples.get_csp_releaseresources_example(version: str, example: str | None = None) dict[source]
Generate example of CSP releaseresources argument
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.examples.get_csp_scan_example(version: str) dict[source]
Generate example of CSP scan argument
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.examples.update_pss_config_example(json_example)[source]
Remove PSS example attributes that are not needed in the csp example.
Interface module for generating CSP configuration.
Handles parsing and validation of inputs and passes them on to the
internal configuration functions in config.
- ska_telmodel.csp.interface.make_csp_config(csp_interface_version: str, sdp_interface_version: str, scan_type: str, csp_config_str: str | dict, sdp_receive_addrs_map_str: str | dict, telescope_branch: str = 'mid') str[source]
Generate CSP scan configuration for a scan using SDP receive addresses.
This should be used right before CSP is configured so that data streams are sent to the right ingest nodes.
- Parameters:
csp_interface_version – Version of CSP interface (URI)
sdp_interface_version – Version of SDP interface (URI)
scan_type – Type of scan to configure
csp_config_str – General CSP configuration
sdp_receive_addrs_map_str – Receive addresses map for scan types, generated by SDP
telescope_branch – flag to identify if the function is called by “mid” or “low” telescope
- Returns:
A validated JSON string with CSP configuration.
- Raise:
ValueError when the input JSON configuration fails validation.
- ska_telmodel.csp.interface.make_low_csp_config(csp_interface_version: str, sdp_interface_version: str, scan_type: str, csp_config_str: str | dict, sdp_receive_addrs_map_str: str | dict) dict[source]
Generate CSP scan configuration for a scan using SDP receive addresses.
This should be used right before CSP is configured so that data streams are sent to the right ingest nodes.
- Parameters:
csp_interface_version – Version of CSP interface (URI)
sdp_interface_version – Version of SDP interface (URI)
scan_type – Type of scan to configure
csp_config_str – General CSP configuration
sdp_receive_addrs_map_str – Receive addresses map for scan types, generated by SDP
- Returns:
new CSP configuration. dict format.
- Raise:
ValueError when the input JSON configuration fails validation.
- Raise:
ValueError when the input interface version fails validation.
- Raise:
ValueError when the input telescope_branch fails validation.
- Raise:
ValueError when the input scan_type not in sdp_receive_addrs
- ska_telmodel.csp.interface.make_mid_csp_config(csp_interface_version: str, sdp_interface_version: str, scan_type: str, csp_config_str: str | dict, sdp_receive_addrs_map_str: str | dict) dict[source]
Generate CSP scan configuration for a scan using SDP receive addresses.
This should be used right before CSP is configured so that data streams are sent to the right ingest nodes.
- Parameters:
csp_interface_version – Version of CSP interface (URI)
sdp_interface_version – Version of SDP interface (URI)
scan_type – Type of scan to configure
csp_config_str – General CSP configuration
sdp_receive_addrs_map_str – Receive addresses map for scan types, generated by SDP
- Returns:
new CSP configuration. dict format.
- Raise:
ValueError when the input JSON configuration fails validation.
- ska_telmodel.csp.low_csp_schema_for_oso_tmc.update_csp_conf_schema_for_oso_tmc(main_schema: TMSchema, version: str, tmc_schema_uri: str = '') TMSchema[source]
Retrieve Low CBF configure resources schema used by OSO-TMC interface.
This method is invoked by Low TMC to update the configuration schema for the OSO-TMC interface.
- Parameters:
lowcbf_schema – Low CBF schema
version – Interface Version URI
tmc_schema_uri – tmc URI version. Used to differentiate the OSO-TMC-CSP schema according to the TMC interface version
- Returns:
TMSchema
- ska_telmodel.csp.low_examples.get_low_csp_assignresources_example(version: str)[source]
Get appropriate version example of LOW CSP assign resources string.
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.low_examples.get_low_csp_configure_example(version: str, scan_type=None)[source]
Get appropriate version example of LOW CSP configure string. The CSP LMC low CBF example is used from CSP LMC configure > v5.0 (low CBF v > 0.2)
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.low_examples.get_low_csp_releaseresources_example(version: str)[source]
Get appropriate version example of LOW CSP release resources string.
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.low_examples.get_low_csp_scan_example(version: str)[source]
Get appropriate version example of LOW CSP scan string.
- Parameters:
version – Version URI of configuration format
- ska_telmodel.csp.low_examples.get_lowcbf_configure_example(csp_version)[source]
Get the LowCBF base example for the CSP LMC.
- ska_telmodel.csp.low_examples.update_config_cbf_keys(csp_version, json_example, subsystem, data) dict[source]
Add/Remove CBF example attributes that differ between base CSP example.
- ska_telmodel.csp.low_examples.update_config_pst_keys(csp_version, json_example, pst_example) dict[source]
Add/Remove PST schema attributes that differ between PST and CSP schema.
- ska_telmodel.csp.low_examples.update_interface(json_example: dict, desired_version: str)[source]
Update the version of the example interface.
- ska_telmodel.csp.low_examples.update_pss_config_example(json_example)[source]
Remove PSS example attributes that are not needed in the csp example.
Functions to build the Low CSP JSON schemas for Subarray commmands.
- ska_telmodel.csp.low_schema.get_low_csp_assignresources_schema(version: str, strict: bool) TMSchema[source]
Build the assignresources JSON schema for the TM-CSP interface.
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
Schema for assignresources command.
- ska_telmodel.csp.low_schema.get_low_csp_configure_schema(version: str, strict: bool, tmc_schema_uri: str = '') TMSchema[source]
Build the configure JSON schema for the TM-CSP interface.
- Parameters:
version – Interface Version URI
strict – Schema strictness
tmc_schema_uri – tmc URI version. If defined, the CSP configure schema for the OSO-TMC interface is returned. Otherwise, the one for the TMC-CSP.
- Returns:
Schema for configure command.
- ska_telmodel.csp.low_schema.get_low_csp_releaseresources_schema(version: str, strict: bool) TMSchema[source]
Build the releaseresources JSON schema for the TM-CSP interface.
- Parameters:
version – Interface version
strict – Strict mode - refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the CSP releaseresources command.
- Raise:
ValueError exception on mismatch major version or invalid JSON Schema URI
- ska_telmodel.csp.low_schema.get_low_csp_scan_schema(version: str, strict: bool) TMSchema[source]
Build the scan JSON schema for the TMC-CSP interface.
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
Schema for configure command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.low_version.get_csp_subsystem_version(version: str, subsystem: str) str[source]
Using the CompatibilityMap evaluates the subsystem command interface number.
- Parameters:
version – the CSP command interface URI
subsystem – the name of the subsystem
- Returns:
the version number of the subsystem command interface.
Contains the common methods between Mid and Low schema
- ska_telmodel.csp.mid_low_schema.get_csp_pss_assign_release_resources(csp_version: str, schema: TMSchema, strict: bool) Schema[source]
Add the PSS assign/release resources schema to the CSP input schema (assignresources/releaseresources).
- Parameters:
csp_version – Interface version URI
schema – CSP assignresources/releaseresources schema
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The updated JSON Schema for the CSP assign/release resources with PSS element.
- ska_telmodel.csp.mid_low_schema.get_csp_pss_configure_schema(pss_version: str, strict: bool) Schema[source]
Mid and Low Common method that aims to generate the PST configure schema for the CSP input file.
- Parameters:
pss_version – PSS Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The PSS JSON Schema for the CSP configuration.
- ska_telmodel.csp.mid_low_schema.get_csp_pst_assign_release_resources(csp_version: str, schema: TMSchema, strict: bool) Schema[source]
Add the PST assign/release resources schema to the CSP input schema (assignresources/releaseresources).
- Parameters:
csp_version – Interface version URI
schema – CSP assignresources/releaseresources schema
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The updated JSON Schema for the CSP assign/release resources with PST element.
- ska_telmodel.csp.mid_low_schema.get_csp_pst_config_schema(csp_version: str, pst_version: str, strict: bool) TMSchema[source]
Mid and Low Common method that aims to generate the PST configure schema for the CSP input file
- Parameters:
pst_version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The PST JSON Schema for the CSP configure.
- ska_telmodel.csp.mid_low_schema.get_pst_configure_schema(pst_version: str, strict: bool)[source]
Get the PST schema and update it for the CSP schema
- Parameters:
pst_version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The PST JSON Schema for the CSP configure.
Used for checking CSP configuration strings for conformance
- ska_telmodel.csp.schema.get_cbf_config_schema(version: str, strict: bool) Schema[source]
Correlator and Beamformer configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the Mid.CBF configuration.
- ska_telmodel.csp.schema.get_common_config_schema(version: str, strict: bool) Schema[source]
CSP Subarray common configuration schema. This section is valid for Mid CSP because it includes some parameters that are Mid.CBF specific. The set of parameters that are common to Mid and Low CSP, are retrieved by the _get_common_config_schema method defined in the common_schema python module.
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the CSP subarray common configuration (ADR-18).
- ska_telmodel.csp.schema.get_corr_processing_region_config_schema(version: str, strict: bool) Schema[source]
Correlation Processing Region configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the Correlation Processing Region specific configuration.
- ska_telmodel.csp.schema.get_correlation_config_schema(version: str, strict: bool) Schema[source]
CSP Correlation configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the CSP subarray specific configuration.
- ska_telmodel.csp.schema.get_csp_assignresources_schema(version: str, strict: bool) Schema[source]
Returns the schema to verify the CSP assignresources command.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_cbf_config_schema(version: str, strict: bool) Schema[source]
Wrapper to retrieve the configuration schema for the Correlator and Beamformer (CBF) as part of the CSP (Central Signal Processor) interface.
- Parameters:
version – Interface Version URI
strict – If True, enforce strict validation rules in the schema.
- Returns:
the JSON Schema for the Mid.CBF configuration.
- ska_telmodel.csp.schema.get_csp_config_schema(version: str, strict: bool, tmc_schema_uri: str = '') Schema[source]
Generates the CSP configuration schema based on the given version.
- Parameters:
version – Interface version
strict – Strict mode - refuse even harmless schema violations (like extra keys).
tmc_schema_uri – TMC Interface version (optional).
- Returns:
The JSON Schema for the CSP configuration.
- Raise:
ValueError exception on mismatch major version or invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_delay_details_schema(version: str, strict: bool) Schema[source]
Returns the schema with the CSP delay details
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_delaymodel_schema(version: str, strict: bool) Schema[source]
Returns the schema to verify the CSP delaymodel command.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_endscan_schema(version: str, strict: bool) Schema[source]
Returns the schema to verify the CSP endscan command.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_low_delaymodel_schema(version: str, strict: bool) Schema[source]
Returns the schema to verify the CSP low delaymodel command.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_poly_info_schema(version: str, strict: bool) Schema[source]
Returns the schema with the CSP delay details
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_releaseresources_schema(version: str, strict: bool) Schema[source]
Returns the schema to verify the CSP releaseresources command.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_csp_scan_schema(version: str, strict: bool) Schema[source]
Returns the schema to verify the CSP scan command.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_fsp_config_schema(version: str, strict: bool)[source]
Frequency slice processor configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON schema for the MID.CBF FSP configuration.
- ska_telmodel.csp.schema.get_low_csp_station_beam_details_schema(version: str, strict: bool) Schema[source]
Returns the schema with the Low CSP delay details
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The JSON Schema for the command.
- Raise:
ValueError exception on invalid JSON Schema URI.
- ska_telmodel.csp.schema.get_pst_bf_config_schema(version: str, strict: bool) Schema[source]
CSP Pulsar Search Timing Beam-Former configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the CSP subarray specific configuration.
- ska_telmodel.csp.schema.get_pst_bf_processing_region_config_schema(version: str, strict: bool) Schema[source]
PST Beam-Former Processing Region configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the PST Beam-Former Processing Region specific configuration.
- ska_telmodel.csp.schema.get_pst_timing_beam_config_schema(version: str, strict: bool) Schema[source]
Timing beam configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the Timing beam specific configuration.
- ska_telmodel.csp.schema.get_search_window_config_schema(version: str, strict: bool) Schema[source]
SearchWindow configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the MID.CBF SearchWindow configuration.
- ska_telmodel.csp.schema.get_subarray_config_schema(version: str, strict: bool) Schema[source]
CSP Subarray configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the CSP subarray specific configuraiton.
- ska_telmodel.csp.schema.get_vlbi_config_schema(version: str, strict: bool)[source]
VLBI specific items
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON schema for the Mid.CBF VLBI configuration.
- ska_telmodel.csp.validators.validate_integration_factor(integration_factor: int) bool[source]
Checks if the integration_factor is valid.
- Parameters:
integration_factor – Integration time for correlation products
- Returns:
True if integration_factor is valid
- ska_telmodel.csp.version.check_csp_interface_version(version: str, allowed_prefixes: str | List[str] = ['https://schema.skao.int/ska-csp-assignresources/', 'https://schema.skao.int/ska-csp-configure/', 'https://schema.skao.int/ska-csp-configurescan/', 'https://schema.skao.int/ska-csp-scan/', 'https://schema.skao.int/ska-csp-endscan/', 'https://schema.skao.int/ska-csp-releaseresources/', 'https://schema.skao.int/ska-csp-delaymodel/', 'https://schema.skao.int/ska-mid-csp-delaymodel/', 'https://schema.skao.int/ska-low-csp-delaymodel/']) str[source]
Check CSP interface version.
Checks that the interface URI has one of the allowed prefixes. If it does, the version number is returned. If not, a ValueError exception is raised.
- Parameters:
version – CSP interface URI
allowed_prefixes – allowed URI prefix(es)
- Returns:
version number
- ska_telmodel.csp.version.csp_config_versions(min_ver=None, max_ver=None)[source]
Returns a list of CSP configuration interface version URIs
- Parameters:
min_ver – Tuple of minimum version to return
max_ver – Tuple of maximum version to return
- ska_telmodel.csp.version.get_csp_config_subsystem_version(version: str, subsystem: str) str[source]
Using the CompatibilityMap evaluates the subsystem command interface number.
- Parameters:
version – the CSP command interface URI
subsystem – the name of the subsystem
- Returns:
the version number of the subsystem command interface.
- ska_telmodel.csp.version.normalize_csp_config_version(csp_interface_version: int | str, csp_config: dict | None = None)[source]
Provides a standard interface version for configure
- Parameters:
csp_interface_version – External guess at the interface version
csp_config – Example configuration to derive version from
- Returns:
Canonical URI of interface version
ska_telmodel.pst
- ska_telmodel.pst.examples.get_pst_config_example(version: str, scan_type: str | None = None) dict[source]
Generate examples for PST configuration strings
This will delegate to the appropriate telescope example (i.e. Mid or Low) depending on the prefix of the
scan_typeparameter. If thescan_typeis prefixed withmid_then a SKAMid PST scan config example is returned else a SKALow PST scan config example is returned.- Valid values of
scan_typeare: pst_scan_vr
pst_scan_pt
pst_scan_ft
pst_scan_ds
pst_scan_df
low_pst_scan_vr
low_pst_scan_pt
low_pst_scan_ft
low_pst_scan_ds
low_pst_scan_df
mid_pst_scan_vr
mid_pst_scan_pt
mid_pst_scan_ft
mid_pst_scan_ds
mid_pst_scan_df
- Parameters:
version – Version URI of configuration format
scan – Includes SDP receive addresses for a scan? None means that this is “template” configuration as passed to TMC.
- Valid values of
Used for checking CSP configuration strings for conformance
- ska_telmodel.pst.schema.get_pst_beam_config_schema(version: str, strict: bool) TMSchema[source]
PST specific beam configuration
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the PST beam configuration.
- ska_telmodel.pst.schema.get_pst_config_schema(version: str, strict: bool) TMSchema[source]
Return the PST configure schema.
This PST schema could be used to validate the JSON script received during configuration.This schema includes the common section with the mandatory fields.
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the PST configuration.
- ska_telmodel.pst.schema.get_pst_scan_config_schema(version: str, strict: bool, beamid_required=True) TMSchema[source]
PST specific scan configuration
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the PST scan configuration.
- ska_telmodel.pst.version.check_interface_version(version: str, allowed_prefixes: str | List[str] = ['https://schema.skao.int/ska-pst-configure/']) str[source]
Check PST interface version.
Checks that the interface URI has one of the allowed prefixes. If it does, the version number is returned. If not, a ValueError exception is raised.
- Parameters:
version – PST interface URI
allowed_prefixes – allowed URI prefix(es)
- Returns:
version number
ska_telmodel.pss
PSS configuration examples.
- ska_telmodel.pss.example.get_pss_config_scan_0_1_example(version: str) dict[source]
Get the example directly from pss cheetah example.
- ska_telmodel.pss.example.get_pss_configure_example(version: str) dict[source]
Get appropriate version example of PSS CONFIGURE.
- Parameters:
version – PSS Version URI of configuration format
- Returns:
example in json format
PSS schema definitions.
- ska_telmodel.pss.schema.get_pss_cheetah_config_beam_schema(version: str, strict: int) TMSchema[source]
Method that aims to get the PSS Cheetah Beam schema.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The Cheetah Beam configure JSON Schema.
- ska_telmodel.pss.schema.get_pss_cheetah_configure_common_schema(main_schema: TMSchema, cheetah_schema: TMSchema) None[source]
Get the PSS Cheetah configure schema common attributes and add them to the main_schema.
- Parameters:
main_schema – PSS LMC schema
cheetah_schema – Cheetah schema
- ska_telmodel.pss.schema.get_pss_cheetah_configure_schema(version: str, strict: int) TMSchema[source]
Method that aims to get the PSS Cheetah configure schema.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The Cheetah configure JSON Schema.
- ska_telmodel.pss.schema.get_pss_configure_schema(version: str, strict: int) TMSchema[source]
Method that aims to get the PSS configure schema.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The PSS configure JSON Schema.
- ska_telmodel.pss.schema.update_pss_config_cheetah_beams_schema(cheetah_version: str, strict: bool) TMSchema[source]
Mid and Low Common method that aims to update the PSS cheetah schema for the PSS subarray.
- Parameters:
version – Interface version URI
strict – Strict mode. If true, refuse even harmless schema violations (like extra keys). DO NOT USE FOR INPUT VALIDATION!
- Returns:
The Cheetah JSON Schema for the PSS configure.
ska_telmodel.sdp
Common elements of SDP schemas.
- ska_telmodel.sdp.common.get_beam_function_pattern(strict: bool)[source]
Get pattern for SDP beam functions
As used for SDP configuration - i.e. basically a kind of data that the SKA SDP needs to receive.
- Returns:
A string pattern suitable for use in schemas
- ska_telmodel.sdp.common.get_receptor_schema(strict: bool) Schema[source]
Return schema for receptors.
- Parameters:
strict – check names if set
- Returns:
schema
SDP schema examples.
SDP schema definitions.
SDP schema prefixes and versions.
- ska_telmodel.sdp.version.sdp_interface_versions(prefix: str, min_ver=(0, 0), max_ver=(inf, 0))[source]
Returns a list of SDP interface version URIs
- Parameters:
prefix – Interface URI prefix
min_ver – Tuple of minimum version to return
max_ver – Tuple of maximum version to return
- ska_telmodel.sdp.version.version_strings(version_tuples: list[tuple[int, int]], min_ver=(0, 0), max_ver=(inf, 0))[source]
Filter a list of version between min_ver and max_ver and convert to strings
- Parameters:
version_tuples – List of (MAJOR, MINOR) version tuples
min_ver – Tuple of minimum version to return
max_ver – Tuple of maximum version to return