ska_tmc_subarraynode.commands.mid package

Link to the TMC User documentation is here.

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(*args, **kwargs)

Bases: AssignResources

A 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 (str) – AssignResources input JSON string without SDP block

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

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.1",
  "transaction_id": "txn-....-00001",
  "subarray_id": 1,
  "dish": {
    "receptor_ids": [
      "SKA001",
      "SKA036",
      "SKA100"
    ]
  },
  "sdp": {
    "interface": "https://schema.skao.int/ska-sdp-assignres/0.4",
    "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

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

Raises

KeyError – If JSON parsing failed

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.

Parameters

receptor_ids (list[str]) – List of receptor IDs to be allocated to subarray. Example: [‘SKA001’, ‘SKA002’]

Return type

Tuple[ResultCode, str]

Returns

List of Resources added to the Subarray. Example: [‘SKA001’, ‘SKA002’]

update_sb_id(sb_id)

Method to update sb id in component manager

Parameters

sb_id (int) – scheduler block id

Raises

Exception – Raises Exception if there is issue while setting sb id in component manager.

update_scan_visibilities_beam(json_argument)

Updates scan type and visibilities beam

Parameters

json_argument (dict) – assign json data

Raises

Exception – Raises Exception if issue while updating scan type and visibilities beam.

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: Configure

A 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

check_only_dish_config(scan_configuration)

Method to check only dish configuration

Parameters

scan_configuration (dict) – Scan Configuration

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

configure_adapters(adapters, config)

Invoke configure command on adapters

Parameters
  • adapters (list) – list of adapters

  • config (dict) – configure dictionary

Return type

Tuple[ResultCode, str]

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.

Parameters
  • pointing_groups (dict) – Pointing groups

  • dish_scan_config_holography (dict) – Dish scan config holography

  • adapter_map (dict) – Receptor groups

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

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.1",
    "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/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": 20.0,
        "partial_configuration": false
    }
  }

Note

While invoking this command from JIVE, provide above JSON string without any space.

Return type

Tuple[ResultCode, str]

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.

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

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message.

invoke_command(method, configuration)

Invokes configure command with argument provided.

Parameters
  • method (Callable[[dict],Tuple]) – configure command methods

  • configuration (dict | str) – dictionary with configure command data.

Raises

Exception – Raises exception if the the configure fails.

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

bool

k_value_validation()

This method validates k value.

Raises

Exception – raises exception if validation fails

property receive_addresses

Dynamically retrieves the receive addresses with a retry mechanism.

This property tries up to self.retry_attempts times to:

  1. Retrieve the device name via component_manager.

  2. Get the adapter using get_adapter_by_device_name(dev_name).

  3. Parse its receive_addresses JSON.

Returns

The parsed receive addresses if successful, otherwise None.

Return type

dict | list | None

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(*args, **kwargs)

Bases: End

A class for SubarrayNodeMid’s End() command .

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

Tuple[ResultCode, str]

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

Tuple[ResultCode, str]

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: EndScan

A class for SubarrayNodeMid’s EndScan() command .

do(argin=None)

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 (Optional[str]) – Optional argument

Return type

Tuple[ResultCode, str]

Returns

Tuple of ResultCode and message

end_scan_mid()

Method to invoke EndScan command on TMC-mid subsystems

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

endscan_dishes()

Method to invoke EndScan command on Dish Leaf Nodes.

Return type

Tuple[ResultCode, str]

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(*args, **kwargs)

Bases: ReleaseAllResources

A 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

Tuple[ResultCode, str]

Returns

Tuple of Resultcode and message

do(argin=None)

Method to invoke ReleaseAllResources command.

Parameters

argin – Optional argument

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and “” as a string on successful release all resources.

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: Restart

A 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

Tuple[ResultCode, str]

Returns

A tuple containing the result code and an empty string.

do(argin=None)

Invokes the Restart command on CSP Subarray Leaf Node, SDP Subarray Leaf Node, and Dish Leaf Nodes.

Parameters

argin (Optional[str]) – Optional argument. Default is None.

Return type

Tuple[ResultCode, str]

Returns

A tuple containing the result code and a message indicating the execution status.

restart_dishes()

Restarts all Dish Leaf Nodes in the Subarray.

Return type

Tuple[ResultCode, str]

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: Scan

A 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.0",
  "transaction_id": "txn-....-00001",
  "scan_id": 1
}
Return type

Tuple[ResultCode, str]

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 (str) – Additional argument

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

scan_dishes(dish_scan_config)

Method to invoke Scan command on Dish Leaf Nodes.

Parameters

dish_scan_config (str) – dish scan config json

Return type

Tuple[ResultCode, str]

Returns

(ResultCode, message)

send_scan_on_leaf_nodes(json_argument, **kwargs)

Send scan command on DLN, CSP, SDP

Parameters
  • json_argument (str) – scan json argument

  • kwargs – Additional keyword arguments

Return type

Tuple[ResultCode, str]

Returns

Tuple of ResultCode and 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: Off

A class for SubarrayNodeMid’s Off() command.

do(argin=None)

Method to invoke Off command on SDP Subarray Leaf Nodes.

Parameters

argin (str) – Input json for Command, defaults to None

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message indicating execution status of 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: On

A class for the SubarrayNodeMid’s On() command.

do(argin=None)

Method to invoke On command on Sdp Subarray LeafNode.

Parameters

argin (Optional[str]) – Input json for Command, defaults to None

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message indicating execution status of 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: Abort

A class for SubarrayNodeMid’s Abort() command.

do(argin=None)

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 (Optional[str]) – Optional argument

Return type

Tuple[ResultCode, str]

Returns

A tuple containing a return code and a string message indicating execution status of command.

Module contents