Internals
ska_schemas.schema
- ska_schemas.schema._validate_schema_using_document_url(obj: dict, version: str) None
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.
- Args:
obj: Object to validate version: Schema version string
- Returns:
None
- Raises:
ValueError: On schema validation failure.
ska_schemas._common
- ska_schemas._common.MID_MKT = Regex('^MKT0([0-5][0-9]|6[0-3])$')
MID Meerkat, 000-063.
- ska_schemas._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_schemas._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)
Wrapper on top of schema.Schema for incremental schema build-up.
- find_field_recursive(name: str) TMSchema | None
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
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
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_schemas._common.get_telmodel_schema(version: str, strict: bool) TMSchema
Telescope model specification (e.g. array layout to use for delay and UVW calculations).
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
Schema for configure command.
- ska_schemas._common.get_unique_id_schema(strict: bool, type_re: str = '[a-z0-9]+') Schema
Return schema for unique identifier.
- Parameters:
type_re – Restricts ID type(s) to accept.
- ska_schemas._common.interface_uri(prefix: str, *versions: int) str
Make an URI from the given prefix and versions
- Parameters:
prefix – Schema URI prefix. Must end in ‘/’
versions – Components of the version
- ska_schemas._common.lookup_module(module, version: str)
Allows importing dev versions of submodules in the form of vX_Y_dev if SKA_SCHEMAS_ALLOW_DEV_VERSION environment variable is set to True.
- ska_schemas._common.mk_if(cond: bool) Callable[[Any], Any]
Generate schema combinator to conditionally activate a part.
- ska_schemas._common.split_interface_version(version: str) Tuple[int, int]
Extracts version number from interface URI
- Parameters:
version – Version string
- Returns:
(major version, minor version) tuple
ska_schemas.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_schemas.channel_map.channel_map_at(channel_map: List[list], channel: int, make_entry: bool = False) Any
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_schemas.channel_map.shift_channel_map(channel_map: List[list], channel_shift: int) List[list]
Shift a channel map by some channel distance
- Parameters:
channel_map – Channel map to use
channel_shift – Shift to apply
- ska_schemas.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]]
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_schemas.channel_map.split_channel_map_at(channel_map: List[list], channel_groups: List[int], rebase_groups: int | None = None) List[List[list]]
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_schemas.csp
This module define some functions that can be used to define the common section of the CSP configure schema.
- ska_schemas.csp.common_schema.add_common_frequency_band(version: str, strict: bool, schema: TMSchema) None
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_schemas.csp.common_schema.add_mid_frequency_band(version: str, strict: bool, schema: TMSchema) None
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_schemas.csp.common_schema.use_camel_case(version: str) bool
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_schemas.csp.config.add_lowcbf_visibility_receive_addresses(csp_config: dict, scan_receive_addrs: dict, sdp_interface_version) dict
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_schemas.csp.config.add_midcbf_visibility_receive_addresses(csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str) dict
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_schemas.csp.config.add_pss_receive_addresses(csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str) Tuple[dict, dict]
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, cbf jones field for PSS beams
- ska_schemas.csp.config.add_pst_receive_addresses(csp_config: dict, scan_receive_addrs: dict, csp_interface_version: str, sdp_interface_version: str, pst_interface_version: str) Tuple[dict, dict]
Add SDP addresses into pulsar timing 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
pst_interface_version – PST interface version to assume
- Returns:
New CSP configuration, cbf jones field for PST beams
- ska_schemas.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
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_schemas.csp.config.get_fsp_channel_offset(csp_config_in: dict) int
Determines first channel ID within an FSP
- ska_schemas.csp.config.get_fsp_output_channel_offset(fsp_config: dict, fsp_id: str, fsp_ch_offset: str) int
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_schemas.csp.config.map_jones_cal_to_cbf_jones(csp_config: dict, telescope_branch: str, pst_jones: dict, pss_jones: dict) dict
Map the SDP jones_cal field into CBF jones field.
- ska_schemas.csp.examples.delete_config_pst_keys(json_example)
Remove PST schema attributes that are not needed in the csp schema.
- ska_schemas.csp.examples.expand_output_port(input_mapping: list[list[int]], max_channels: int = 14880) list[list[int]]
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_schemas.csp.examples.get_csp_assignresources_example(version: str) dict
Generate example of CSP assignresources argument
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.examples.get_csp_config_example(version: str, scan: str | None = None) dict
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_schemas.csp.examples.get_csp_delaymodel_example(version: str) dict
Generate example of CSP delay model argument
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.examples.get_csp_endscan_example(version: str) dict
Generate example of CSP endscan argument
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.examples.get_csp_low_delaymodel_example(version: str) dict
Generate example of CSP low delay model argument
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.examples.get_csp_releaseresources_example(version: str, example: str | None = None) dict
Generate example of CSP releaseresources argument
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.examples.get_csp_scan_example(version: str) dict
Generate example of CSP scan argument
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.examples.update_pss_config_example(json_example)
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_schemas.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
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_schemas.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
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_schemas.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
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_schemas.csp.low_csp_schema_for_oso_tmc.update_csp_conf_schema_for_oso_tmc(main_schema: TMSchema, version: str, tmc_schema_uri: str = '') TMSchema
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_schemas.csp.low_examples.get_low_csp_assignresources_example(version: str)
Get appropriate version example of LOW CSP assign resources string.
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.low_examples.get_low_csp_configure_example(version: str, scan_type=None)
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_schemas.csp.low_examples.get_low_csp_releaseresources_example(version: str)
Get appropriate version example of LOW CSP release resources string.
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.low_examples.get_low_csp_scan_example(version: str)
Get appropriate version example of LOW CSP scan string.
- Parameters:
version – Version URI of configuration format
- ska_schemas.csp.low_examples.get_lowcbf_configure_example(csp_version)
Get the LowCBF base example for the CSP LMC.
- ska_schemas.csp.low_examples.update_config_cbf_keys(csp_version, json_example, subsystem, data) dict
Add/Remove CBF example attributes that differ between base CSP example.
- ska_schemas.csp.low_examples.update_config_pst_keys(csp_version, json_example, pst_example) dict
Add/Remove PST schema attributes that differ between PST and CSP schema.
- ska_schemas.csp.low_examples.update_interface(json_example: dict, desired_version: str)
Update the version of the example interface.
- ska_schemas.csp.low_examples.update_pss_config_example(json_example)
Remove PSS example attributes that are not needed in the csp example.
Functions to build the Low CSP JSON schemas for Subarray commmands.
- ska_schemas.csp.low_schema.get_low_csp_assignresources_schema(version: str, strict: bool) TMSchema
Build the assignresources JSON schema for the TM-CSP interface.
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
Schema for assignresources command.
- ska_schemas.csp.low_schema.get_low_csp_configure_schema(version: str, strict: bool, tmc_schema_uri: str = '') TMSchema
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_schemas.csp.low_schema.get_low_csp_releaseresources_schema(version: str, strict: bool) TMSchema
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_schemas.csp.low_schema.get_low_csp_scan_schema(version: str, strict: bool) TMSchema
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_schemas.csp.low_version.get_csp_subsystem_version(version: str, subsystem: str) Tuple[str, str]
Using the CompatibilityMap to evaluate the subsystem command interface number.
- Parameters:
version – the CSP command interface URI
subsystem – the name of the subsystem
- Returns:
A Tuple containing the string subsystem_version and the subsystem_uri.
- ska_schemas.csp.low_version.get_subsystem_uri(version: str, subsystem: str) str
Return the desired CSP subsystem version URI related to the input CSP version
- ska_schemas.csp.low_version.lowcsp_interface_strings(version_tuples: list[tuple[int, int]], min_ver=(2, 0), max_ver=(inf, 0))
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
- ska_schemas.csp.low_version.lowcsp_interface_uri(prefix: str, min_ver=(0, 0), max_ver=(inf, 0))
Returns a list of LOWCSP interface version URIs
- Parameters:
prefix – Interface URI prefix
min_ver – Tuple of minimum version to return
max_ver – Tuple of maximum version to return
Contains the common methods between Mid and Low schema
- ska_schemas.csp.mid_low_schema.get_csp_pss_assign_release_resources(csp_version: str, schema: TMSchema, strict: bool) Schema
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_schemas.csp.mid_low_schema.get_csp_pss_configure_schema(pss_version: str, strict: bool) Schema
Mid and Low Common method that aims to generate the PSS 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_schemas.csp.mid_low_schema.get_csp_pst_assign_release_resources(csp_version: str, schema: TMSchema, strict: bool) Schema
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_schemas.csp.mid_low_schema.get_csp_pst_config_schema(csp_version: str, pst_version: str, strict: bool) TMSchema
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_schemas.csp.mid_low_schema.get_pst_configure_schema(pst_version: str, strict: bool)
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_schemas.csp.schema.get_cbf_config_schema(version: str, strict: bool) Schema
Correlator and Beamformer configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the Mid.CBF configuration.
- ska_schemas.csp.schema.get_common_config_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_corr_processing_region_config_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_correlation_config_schema(version: str, strict: bool) Schema
CSP Correlation configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the CSP subarray specific configuration.
- ska_schemas.csp.schema.get_csp_assignresources_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_cbf_config_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_config_schema(version: str, strict: bool, tmc_schema_uri: str = '') Schema
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_schemas.csp.schema.get_csp_delay_details_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_delaymodel_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_endscan_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_low_delaymodel_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_poly_info_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_releaseresources_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_csp_scan_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_fsp_config_schema(version: str, strict: bool)
Frequency slice processor configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON schema for the MID.CBF FSP configuration.
- ska_schemas.csp.schema.get_low_csp_station_beam_details_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_pst_bf_config_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_pst_bf_processing_region_config_schema(version: str, strict: bool) Schema
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_schemas.csp.schema.get_pst_timing_beam_config_schema(version: str, strict: bool) Schema
Timing beam configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the Timing beam specific configuration.
- ska_schemas.csp.schema.get_search_window_config_schema(version: str, strict: bool) Schema
SearchWindow configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the MID.CBF SearchWindow configuration.
- ska_schemas.csp.schema.get_subarray_config_schema(version: str, strict: bool) Schema
CSP Subarray configuration schema
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the CSP subarray specific configuraiton.
- ska_schemas.csp.schema.get_vlbi_config_schema(version: str, strict: bool)
VLBI specific items
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON schema for the Mid.CBF VLBI configuration.
- ska_schemas.csp.validators.validate_integration_factor(integration_factor: int) bool
Checks if the integration_factor is valid.
- Parameters:
integration_factor – Integration time for correlation products
- Returns:
True if integration_factor is valid
- ska_schemas.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
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_schemas.csp.version.csp_config_versions(min_ver=None, max_ver=None)
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_schemas.csp.version.get_config_subsystem_uri(version: str, subsystem: str) str
Return the desired CSP subsystem version URI related to the input CSP configure command version
- ska_schemas.csp.version.get_csp_config_subsystem_version(version: str, subsystem: str) Tuple[str, str]
Using the CompatibilityMap evaluates the subsystem command interface number.
- Parameters:
version – the CSP command interface URI
subsystem – the name of the subsystem
- Returns:
A Tuple containing the string subsystem_version and the subsystem_uri.
- ska_schemas.csp.version.normalize_csp_config_version(csp_interface_version: int | str, csp_config: dict | None = None)
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_schemas.pst
- ska_schemas.pst.examples.get_pst_config_example(version: str, scan_type: str | None = None) dict
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
- class ska_schemas.pst.schema.ConfigurationInterface(value)
An enumeration.
- ska_schemas.pst.schema.get_pst_beam_config_schema(version: str, strict: bool) TMSchema
PST specific beam configuration
- Parameters:
version – Interface Version URI
strict – Schema strictness
- Returns:
the JSON Schema for the PST beam configuration.
- ska_schemas.pst.schema.get_pst_config_schema(version: str, strict: bool) TMSchema
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_schemas.pst.schema.get_pst_scan_config_schema(version: str, strict: bool, configuration_stage=ConfigurationInterface.ConfigCSP_PST) TMSchema
PST specific scan configuration
- Parameters:
version – Interface Version URI
strict – Schema strictness
configuration_stage – the stage at which the schema is validated.
- Returns:
the JSON Schema for the PST scan configuration.
- ska_schemas.pst.version.check_interface_version(version: str, allowed_prefixes: str | list[str] = ['https://schema.skao.int/ska-pst-configure/']) str
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_schemas.pss
PSS configuration examples.
PSS schema definitions.
- ska_schemas.pss.schema.get_pss_cheetah_configure_schema(version: str, strict: int) TMSchema
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_schemas.pss.schema.get_pss_configure_schema(version: str, strict: int) TMSchema
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_schemas.sdp
Common elements of SDP schemas.
- ska_schemas.sdp.common.get_beam_function_pattern(strict: bool)
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_schemas.sdp.common.get_receptor_schema(strict: bool) Schema
Return schema for receptors.
- Parameters:
strict – check names if set
- Returns:
schema
SDP schema examples.
SDP schema definitions.
SDP schema prefixes and versions.
- ska_schemas.sdp.version.sdp_interface_versions(prefix: str, min_ver=(0, 0), max_ver=(inf, 0))
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_schemas.sdp.version.version_strings(version_tuples: list[tuple[int, int]], min_ver=(0, 0), max_ver=(inf, 0))
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