ska_tmc_subarraynode.commands.mid package
Link to the TMC User documentation is here.
See the TMC Mid Commands section for details about TMC Mid command workflows.
Submodules
assign_resources_command
Path: src/ska_tmc_subarraynode/commands/mid/assign_resources_command.py
AssignResources Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.assign_resources_command.AssignResourcesMid(component_manager, obs_state_model, logger, adapter_factory=ska_tmc_common.AdapterFactory, is_auto_recovery_enabled=False)
Bases:
AssignResourcesA class for SubarrayNodeMid’s AssignResources() command.
Assigns resources to CSP, SDP, and Dish via respective subarray leaf nodes. It also sets AssignedResources attribute on SubarrayNode.
- assign_csp_resources(resources)
This function accepts the AssignResources input JSON and invokes the assign resources command on the CSP Subarray Leaf Node.
- Parameters
resources (dict) – AssignResources input JSON string without SDP block
- Return type
- Returns
A tuple containing a return code and a string message.
- clear_resources()
Method for removing dishes from input parameter, Liveliness probe and component.
- Return type
- do(argin)
Method to invoke AssignResources command on subarraynode mid.
- Parameters
argin (str) – JSON for the AssignResources command.
Example JSON for Assign Resources mid{ "interface": "https://schema.skao.int/ska-tmc-assignresources/2.4", "transaction_id": "txn-....-00001", "subarray_id": 1, "dish": { "receptor_ids": [ "SKA001", "SKA036", "SKA100" ] }, "csp": { "pst": { "pst_beam_ids": [ 1 ] } }, "sdp": { "interface": "https://schema.skao.int/ska-sdp-assignres/1.0", "execution_block": { "eb_id": "eb-mvp01-20200325-00001", "max_length": 100, "context": {}, "beams": [ { "beam_id": "vis0", "function": "visibilities" }, { "beam_id": "pss1", "search_beam_id": 1, "function": "pulsar search" }, { "beam_id": "pss2", "search_beam_id": 2, "function": "pulsar search" }, { "beam_id": "pst1", "timing_beam_id": 1, "function": "pulsar timing" }, { "beam_id": "pst2", "timing_beam_id": 2, "function": "pulsar timing" }, { "beam_id": "vlbi1", "vlbi_beam_id": 1, "function": "vlbi" } ], "scan_types": [ { "scan_type_id": ".default", "beams": { "vis0": { "channels_id": "vis_channels", "polarisations_id": "all" }, "pss1": { "field_id": "pss_field_0", "channels_id": "pulsar_channels", "polarisations_id": "all" }, "pss2": { "field_id": "pss_field_1", "channels_id":"pulsar_channels", "polarisations_id": "all" }, "pst1": { "field_id": "pst_field_0", "channels_id": "pulsar_channels", "polarisations_id":"all" }, "pst2": { "field_id": "pst_field_1", "channels_id": "pulsar_channels", "polarisations_id": "all" }, "vlbi": { "field_id": "vlbi_field", "channels_id": "vlbi_channels", "polarisations_id": "all" } } }, { "scan_type_id": "target:a", "derive_from": ".default", "beams": { "vis0": { "field_id": "field_a" } } } ], "channels": [ { "channels_id": "vis_channels", "spectral_windows": [ { "spectral_window_id": "fsp_1_channels", "count": 744, "start": 0, "stride": 2, "freq_min": 350000000, "freq_max": 368000000, "link_map": [ [ 0, 0 ], [ 200, 1 ], [ 744, 2 ], [ 944, 3 ] ] }, { "spectral_window_id": "fsp_2_channels", "count": 744, "start": 2000, "stride": 1, "freq_min": 360000000, "freq_max": 368000000, "link_map": [ [ 2000, 4 ], [ 2200, 5 ] ] }, { "spectral_window_id": "zoom_window_1", "count": 744, "start": 4000, "stride": 1, "freq_min": 360000000, "freq_max": 361000000, "link_map": [ [ 4000, 6 ], [ 4200, 7 ] ] } ] }, { "channels_id": "pulsar_channels", "spectral_windows": [ { "spectral_window_id": "pulsar_fsp_channels", "count": 744, "start": 0, "freq_min": 350000000, "freq_max": 368000000 } ] } ], "polarisations": [ { "polarisations_id": "all", "corr_type": [ "XX", "XY", "YY", "YX" ] } ], "fields": [ { "field_id": "field_a", "phase_dir": { "ra": [ 123, 0.1 ], "dec": [ 123, 0.1 ], "reference_time": "...", "reference_frame": "ICRF3" }, "pointing_fqdn": "low-tmc/telstate/0/pointing" } ] }, "processing_blocks": [ { "pb_id": "pb-mvp01-20200325-00001", "sbi_ids": [ "sbi-mvp01-20200325-00001" ], "script": {}, "parameters": {}, "dependencies": {} }, { "pb_id": "pb-mvp01-20200325-00002", "sbi_ids": [ "sbi-mvp01-20200325-00002" ], "script": {}, "parameters": {}, "dependencies": {} }, { "pb_id": "pb-mvp01-20200325-00003", "sbi_ids": [ "sbi-mvp01-20200325-00001", "sbi-mvp01-20200325-00002" ], "script": {}, "parameters": {}, "dependencies": {} } ], "resources": { "csp_links": [ 1, 2, 3, 4 ], "receptors": [ "FS4", "FS8" ], "receive_nodes": 10 } } }
- Return type
- Returns
A tuple containing a return code and a string message.
- Raises
KeyError – If JSON parsing failed
- prepare_csp_assign_input(assign_dict)
This method prepares assign input for CSP subsystem. :type assign_dict:
dict:param assign_dict: assign input dictionary :type assign_dict: dict- Return type
- remove_from_lp_and_unsubscribe_dish(dish_ln_fqdns, dish_fqdns)
Method to remove dish from liveliness proble and unsubscribe dish events.
- Parameters
dish_ln_fqdns – List of dish leaf node FQDNs to be removed
dish_fqdns – List of dish FQDNs to be unsubscribed
- Return type
- set_up_dish_data(receptor_ids)
Creates dish leaf node and dish device FQDNs using input receptor ids. The healthState and pointingState attributes of all the dishes are subscribed.
- update_sb_id(sb_id)
Method to update sb id in component manager
configure_command
Path: src/ska_tmc_subarraynode/commands/mid/configure_command.py
Configure Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.configure_command.ConfigureMid(*args, **kwargs)
Bases:
ConfigureA class for SubarrayNodeMid’s Configure() command.
Configures the resources assigned to the Subarray. The configuration data for SDP, CSP and Dish for mid telescope is extracted out of the input configuration string and relayed to the respective underlying devices (SDP Subarray Leaf Node, CSP Subarray Leaf Node and Dish Leaf Node for mid telescope
- call_update_task_status(result, message)
Call update task status and provide result, message
- check_only_dish_config(scan_configuration)
Method to check only dish configuration
- Parameters
scan_configuration (dict) – Scan Configuration
- Return type
- Returns
A tuple containing a return code and a string message.
- configure_adapters(adapters, config)
Invoke configure command on dish adapters.
- Parameters
- Return type
- Returns
A tuple containing a return code and a string message.
- configure_mapping_scan_dishes(pointing_groups, dish_scan_config_holography, adapter_map)
Method to configure Dishes based on receptor groups in JSON.
- configure_normal_scan_dish(normal_scan_dishes, partial_dish_config)
Configures normal scan dishes with default values.
- do(argin)
Method to invoke Configure command.
- Parameters
argin (str) – JSON string that includes pointing parameters of Dish - Azimuth and Elevation Angle, CSP Configuration and SDP Configuration parameters.
Example JSON for Configure mid{ "interface": "https://schema.skao.int/ska-tmc-configure/4.2", "transaction_id": "txn-....-00002", "pointing": { "groups": [ { "field": { "reference_frame": "ICRS", "target_name": "Polaris Australis", "attrs": { "c1": 317.19966666666664, "c2": -88.95636111111111 }}, "trajectory": { "name": "fixed", "attrs": {"x": 1.23, "y": 4.56} } } ], "correction": "UPDATE" }, "dish": { "receiver_band": "1" }, "csp": { "interface": "https://schema.skao.int/ska-csp-configurescan/4.0", "common": { "config_id": "sbi-mvp01-20200325-00001-science_A", "frequency_band": "2", "eb_id": "eb-m001-20230712-56789" }, "pst": {}, "transaction_id": "txn-....-00001", "midcbf": { "correlation": { "processing_regions": [{ "fsp_ids": [1], "start_freq": 950000000, "channel_width": 13440, "channel_count": 40, "sdp_start_channel_id": 0, "integration_factor": 1 }] } } }, "sdp": { "interface": "https://schema.skao.int/ska-sdp-configure/0.4", "scan_type": "target:a" }, "tmc": { "scan_duration": 5.0, "partial_configuration": false } }
It also supports PST scan configuration.
Example JSON for PST Scan Configuration with flow through PST processing mode.{ "interface": "https://schema.skao.int/ska-tmc-configure/6.0", "transaction_id": "", "pointing": { "target": { "reference_frame": "ICRS", "target_name": "Polaris Australis", "ra": "21:08:47.92", "dec": "-88:57:22.9", "ca_offset_arcsec": 0.0, "ie_offset_arcsec": 0.0 }, "correction": "UPDATE" }, "dish": { "receiver_band": "1" }, "csp": { "interface": "https://schema.skao.int/ska-csp-configurescan/8.4", "common": { "config_id": "sbi-mvp01-20200325-00001-science_A", "frequency_band": "2", "eb_id": "eb-m001-20230712-56789" }, "pst": { "beams": [{ "beam_id": 1, "scan": { "centre_frequency": 10550000000.0, "total_bandwidth": 2496345600.0, "observer_id": "jdoe", "project_id": "project1", "receiver_id": "receiver3", "max_scan_length": 20000.0, "subint_duration": 30.0, "receptors": ["SKA001", "SKA036"], "receptor_weights": [0.4, 0.6], "pst_processing_mode": "FLOW_THROUGH", "target": { "target_name": "J1921+2153", "reference_frame": "icrs", "attrs": { "c1": 290.43672917, "c2": 21.884, "epoch": 2000.0 } }, "ft": { "channel_polarisation_selection": { "channels": [0, 100], "polarisations": "Both" }, "rescale": { "algorithm": "MedianMAD", "periodic_update": true, "timescale": 1.0 }, "requantisation": { "num_bits_out": 4, "scale": 1.0 } } } }] }, "transaction_id": "txn-....-00001", "midcbf": { "pst_bf": { "processing_regions": [{ "fsp_ids": [5], "start_freq": 495075840, "channel_count": 3700, "timing_beams": [{ "timing_beam_id": 1, "receptors": ["SKA001", "SKA036"] }] }] } } }, "sdp": { "interface": "https://schema.skao.int/ska-sdp-configure/1.2", "scan_type": "target:a" }, "tmc": { "scan_duration": 5.0, "partial_configuration": false } }
Example JSON for PST Scan Configuration with pulsar timing PST processing mode. # noqa: E501{ "interface": "https://schema.skao.int/ska-tmc-configure/6.0", "transaction_id": "", "pointing": { "target": { "reference_frame": "ICRS", "target_name": "Polaris Australis", "ra": "21:08:47.92", "dec": "-88:57:22.9", "ca_offset_arcsec": 0.0, "ie_offset_arcsec": 0.0 }, "correction": "UPDATE" }, "dish": { "receiver_band": "1" }, "csp": { "interface": "https://schema.skao.int/ska-csp-configurescan/8.4", "common": { "config_id": "sbi-mvp01-20200325-00001-science_A", "frequency_band": "2", "eb_id": "eb-m001-20230712-56789" }, "pst": { "beams": [{ "beam_id": 1, "scan": { "centre_frequency": 10550000000.0, "total_bandwidth": 2496345600.0, "observer_id": "jdoe", "project_id": "project1", "receiver_id": "receiver3", "max_scan_length": 20000.0, "subint_duration": 30.0, "receptors": ["SKA001", "SKA036"], "receptor_weights": [0.4, 0.6], "pst_processing_mode": "PULSAR_TIMING", "target": { "target_name": "J1921+2153", "reference_frame": "icrs", "attrs": { "c1": 290.43672917, "c2": 21.884, "epoch": 2000.0 } }, "pt": { "dispersion_measure": 100.0, "rotation_measure": 0.0, "ephemeris": "", "pulsar_phase_predictor": "", "output_frequency_channels": 1, "output_phase_bins": 64, "num_sk_config": 1, "sk_config": [{ "sk_range": [0.8, 0.9], "sk_integration_limit": 100, "sk_excision_limit": 25.0 }], "target_snr": 0.0 } } }] }, "transaction_id": "txn-....-00001", "midcbf": { "pst_bf": { "processing_regions": [{ "fsp_ids": [5], "start_freq": 495075840, "channel_count": 3700, "timing_beams": [{ "timing_beam_id": 1, "receptors": ["SKA001", "SKA036"] }] }] } } }, "sdp": { "interface": "https://schema.skao.int/ska-sdp-configure/1.2", "scan_type": "target:a" }, "tmc": { "scan_duration": 5.0, "partial_configuration": false } }
Example JSON for PST Scan Configuration with detected filterbank PST processing mode. # noqa: E501{ "interface": "https://schema.skao.int/ska-tmc-configure/6.0", "transaction_id": "", "pointing": { "target": { "reference_frame": "ICRS", "target_name": "Polaris Australis", "ra": "21:08:47.92", "dec": "-88:57:22.9", "ca_offset_arcsec": 0.0, "ie_offset_arcsec": 0.0 }, "correction": "UPDATE" }, "dish": { "receiver_band": "1" }, "csp": { "interface": "https://schema.skao.int/ska-csp-configurescan/8.4", "common": { "config_id": "sbi-mvp01-20200325-00001-science_A", "frequency_band": "2", "eb_id": "eb-m001-20230712-56789" }, "pst": { "beams": [{ "beam_id": 1, "scan": { "centre_frequency": 10550000000.0, "total_bandwidth": 2496345600.0, "observer_id": "jdoe", "project_id": "project1", "receiver_id": "receiver3", "max_scan_length": 20000.0, "subint_duration": 30.0, "receptors": ["SKA001", "SKA036"], "receptor_weights": [0.4, 0.6], "pst_processing_mode": "DETECTED_FILTERBANK", "target": { "target_name": "J1921+2153", "reference_frame": "icrs", "attrs": { "c1": 290.43672917, "c2": 21.884, "epoch": 2000.0 } }, "df": { "dispersion_measure": 100.0, "output_frequency_channels": 1, "stokes_parameters": "Q", "num_bits_out": 16, "time_decimation_factor": 10, "frequency_decimation_factor": 4, "requantisation_scale": 1.0, "requantisation_length": 1.0 } } }] }, "transaction_id": "txn-....-00001", "midcbf": { "pst_bf": { "processing_regions": [{ "fsp_ids": [5], "start_freq": 495075840, "channel_count": 3700, "timing_beams": [{ "timing_beam_id": 1, "receptors": ["SKA001", "SKA036"] }] }] } } }, "sdp": { "interface": "https://schema.skao.int/ska-sdp-configure/1.2", "scan_type": "target:a" }, "tmc": { "scan_duration": 5.0, "partial_configuration": false } }
Example JSON for PST Scan Configuration with voltage recorder PST processing mode. # noqa: E501{ "interface": "https://schema.skao.int/ska-tmc-configure/6.0", "transaction_id": "", "pointing": { "target": { "reference_frame": "ICRS", "target_name": "Polaris Australis", "ra": "21:08:47.92", "dec": "-88:57:22.9", "ca_offset_arcsec": 0.0, "ie_offset_arcsec": 0.0 }, "correction": "UPDATE" }, "dish": { "receiver_band": "1" }, "csp": { "interface": "https://schema.skao.int/ska-csp-configurescan/8.4", "common": { "config_id": "sbi-mvp01-20200325-00001-science_A", "frequency_band": "2", "eb_id": "eb-m001-20230712-56789" }, "pst": { "beams": [{ "beam_id": 1, "scan": { "centre_frequency": 10550000000.0, "total_bandwidth": 2496345600.0, "observer_id": "jdoe", "project_id": "project1", "receiver_id": "receiver3", "max_scan_length": 20000.0, "subint_duration": 30.0, "receptors": ["SKA001", "SKA036"], "receptor_weights": [0.4, 0.6], "pst_processing_mode": "VOLTAGE_RECORDER", "target": { "target_name": "J1921+2153", "reference_frame": "icrs", "attrs": { "c1": 290.43672917, "c2": 21.884, "epoch": 2000.0 } } } }] }, "transaction_id": "txn-....-00001", "midcbf": { "pst_bf": { "processing_regions": [{ "fsp_ids": [5], "start_freq": 495075840, "channel_count": 3700, "timing_beams": [{ "timing_beam_id": 1, "receptors": ["SKA001", "SKA036"] }] }] } } }, "sdp": { "interface": "https://schema.skao.int/ska-sdp-configure/1.2", "scan_type": "target:a" }, "tmc": { "scan_duration": 5.0, "partial_configuration": false } }
Note
While invoking this command from JIVE, provide above JSON string without any space.
- Return type
- Returns
A tuple containing a return code and a string message indicating status.The message is for information purpose only.
- Raises
KeyError – Raises KeyError if the JSON parsing fails due to missing keys.
- extract_data_from_array_layout_data()
Extract layout data for the assigned dish IDs.
This method retrieves the layout information corresponding to each dish managed by TMC. It maps each dish device name to its associated receptor data as defined in the downloaded array layout.
- get_and_verify_k_values()
Retrieves the k-values from dish leaf node adapters and verifies if they are all unique or the same.
- Return type
- Returns
A tuple containing a return code and a string message.
- get_receptor_by_label(label)
- Return receptor matching the given station label,
or None if not found.
- invoke_command(method, configuration)
Invokes configure command with argument provided.
- property is_wrap_sector_key_present
Returns True if the wrap sector key present in the configure.
- Returns
True if wrap sector key present
- Return type
- k_value_validation()
This method validates k value.
- Raises
Exception – raises exception if validation fails
- map_scan_configuration_to_adapter(scan_configuration, dish_adapters)
Map each dish adapter to a scan configuration with per-dish spfrx processing.
For interface version < 5.0, all dishes share the same configuration.
- For version >= 5.0:
If a single block contains “all”, all dishes share it.
Otherwise, explicitly listed dishes get their block.
- Unlisted dishes get a default block.
[{ “dishes”: [“SKAxxx”], “sync_pps”: True }]
Handles partial configurations gracefully: - If “dish” key is missing, skip per-dish SPFRx logic and return the same configuration for all dishes.
- property receive_addresses
Dynamically retrieves the receive addresses with a retry mechanism.
This property tries up to self.retry_attempts times to:
Retrieve the device name via component_manager.
Get the adapter using get_adapter_by_device_name(dev_name).
Parse its receive_addresses JSON.
end_command
Path: src/ska_tmc_subarraynode/commands/mid/end_command.py
End Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.end_command.EndMid(component_manager, obs_state_model, adapter_factory, logger=None, is_clear_command_failure_info=True)
Bases:
EndA class for SubarrayNodeMid’s End() command .
- call_update_task_status(result, message)
Call update task status and provide result, message
- do(argin=None)
Method to invoke End command on CSP Subarray Leaf Node, SDP Subarray Leaf Node and Dish Leaf Nodes.
- Parameters
argin – Optional argument
- Return type
- Returns
A tuple containing a return code and a string message indicating execution status of command.
- stop_dish_tracking()
Method to stop dish tracking
- Return type
- Returns
A tuple containing ResultCode and message.
end_scan_command
Path: src/ska_tmc_subarraynode/commands/mid/end_scan_command.py
EndScan Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.end_scan_command.EndScanMid(*args, **kwargs)
Bases:
EndScanA class for SubarrayNodeMid’s EndScan() command .
- do(argin='')
This method executes the End Scan workflow of the Subarray Node Mid. It will invoke End Scan command on the CSP Subarray Leaf Node, SDP Subarray Leaf Node and Dish Leaf Nodes.
- Parameters
argin (
str) – Optional argument- Return type
- Returns
Tuple of ResultCode and message
- end_scan(task_callback, task_abort_event)
This method will be invoked to end the scan during regular Scan.
- Return type
- Returns
Tuple of ResultCode and message
- end_scan_mid()
Method to invoke EndScan command on TMC-mid subsystems
- Return type
- Returns
(ResultCode, message)
- endscan_dishes()
Method to invoke EndScan command on Dish Leaf Nodes.
- Return type
- Returns
(ResultCode, message)
release_all_resources_command
Path: src/ska_tmc_subarraynode/commands/mid/release_all_resources_command.py
ReleaseAllResources Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.release_all_resources_command.ReleaseAllResourcesMid(component_manager, obs_state_model, logger, adapter_factory=ska_tmc_common.AdapterFactory, is_auto_recovery_enabled=False, is_clear_command_failure_info=True)
Bases:
ReleaseAllResourcesA class for the SubarrayNodeMid’s ReleaseAllResources() command.
- clean_up_resources()
Clears the AssignedResources attribute.
Cleans dictionaries of the resources across the subarraynode.
Note
Currently there are only receptors allocated so only the receptor ids details are stored.
- Return type
- Returns
Tuple of Resultcode and message
restart_command
Path: src/ska_tmc_subarraynode/commands/mid/restart_command.py
Restart Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.restart_command.RestartMid(*args, **kwargs)
Bases:
RestartA class representing the Restart command for SubarrayNodeMid.
This command restarts various leaf nodes of the Subarray, including CSP Subarray Leaf Node, SDP Subarray Leaf Node, and Dish Leaf Node to reset ongoing activities and configurations.
- clean_up_dishes()
Removes the dish devices from input parameter class. Also unsubscribes events for dish and dish leaf node attributes.
- Return type
- Returns
A tuple containing the result code and an empty string.
scan_command
Path: src/ska_tmc_subarraynode/commands/mid/scan_command.py
Scan Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.scan_command.ScanMid(*args, **kwargs)
Bases:
ScanA class for SubarrayNode’s Scan() command for Mid telescope.
- do(argin)
Method to invoke Scan command.
- Parameters
argin (str) – JSON string containing id.
Example JSON for Scan mid{ "interface": "https://schema.skao.intg/ska-tmc-scan/2.2", "transaction_id": "txn-....-00001", "scan_id": 1, "start_time": "2025-12-23T08:25:00.412Z" }
- Return type
- Returns
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- scan_csp(argin)
Method to invoke Scan command on CSP Subarray Leaf Node.
- Parameters
argin (dict) – Additional argument
- Return type
- Returns
(ResultCode, message)
- scan_dishes(dish_scan_config)
Method to invoke Scan command on Dish Leaf Nodes.
- Parameters
dish_scan_config (dict) – dish scan config json
- Return type
- Returns
(ResultCode, message)
off_command
Path: src/ska_tmc_subarraynode/commands/mid/off_command.py
Off Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.off_command.OffMid(*args, **kwargs)
Bases:
OffA class for SubarrayNodeMid’s Off() command.
on_command
Path: src/ska_tmc_subarraynode/commands/mid/on_command.py
On Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.on_command.OnMid(*args, **kwargs)
Bases:
OnA class for the SubarrayNodeMid’s On() command.
abort_command
Path: src/ska_tmc_subarraynode/commands/mid/abort_command.py
Abort Command class for SubarrayNode Mid.
- class ska_tmc_subarraynode.commands.mid.abort_command.AbortMid(*args, **kwargs)
Bases:
AbortA class for SubarrayNodeMid’s Abort() command.
- do(argin='')
This method invokes Abort command on CSP Subarray Leaf Node and SDP Subarray Leaf Node, and stops tracking of all the assigned dishes.
- Parameters
argin (
str) – Optional argument- Return type
- Returns
A tuple containing a return code and a string message indicating execution status of command.