Subarray subpackage

This subpackage implements subarray functionality for MCCS.

class MccsSubarray(*args: Any, **kwargs: Any)[source]

MccsSubarray is the Tango device class for the MCCS Subarray prototype.

AbortDevice() ska_tango_base.type_hints.TaskFunctionType[source]

Abort any long-running command such as Configure() or Scan().

This will only cancel commands on this device, not further down the hierarchy, use Abort() for that use case.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

AssignResources(**kwargs: Any) ska_tango_base.type_hints.TaskFunctionType[source]

Assign resources to this subarray with all relevant parameters.

Parameters:

kwargs – mandatory arguments: - subarray_id: Description of observed sky frequency bands - subarray_beams: The beams to be assigned

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Configure(**kwargs: Any) ska_tango_base.type_hints.TaskFunctionType[source]

Configure this subarray with all relevant parameters.

Parameters:

kwargs – arguments including: Mandatory subarray_beams including: - logical_bands: Description of observed sky frequency bands - update_rate: Update rate for pointing, default never - weighting_key_ref: Antenna weights, default uniform, - field: Pointing direction - calibration_id: Unique calibration id. Optional: - transaction_id: Unique transaction id.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

End() ska_tango_base.type_hints.TaskFunctionType[source]

Deconfigure resources for this subarray.

Returns:

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

EndScan() ska_tango_base.type_hints.TaskFunctionType[source]

Stop the current scan associated with this subarray.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

ObsReset() ska_tango_base.type_hints.TaskFunctionType[source]

Reset this subarray to IDLE.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

ReleaseAllResources() ska_tango_base.type_hints.TaskFunctionType[source]

Release all allocated resources from this subarray.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Restart() ska_tango_base.type_hints.TaskFunctionType[source]

Restart this subarray to EMPTY.

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Scan(scan_id: int, start_time: str | None = None, duration: float = 0.0, **kwargs: Any) ska_tango_base.type_hints.TaskFunctionType[source]

Start the scan associated with this subarray.

Parameters:
  • scan_id – The ID for this scan

  • start_time – the start time of the scan

  • duration – Scan duration in seconds. 0.0 or omitted means forever

  • kwargs – Any other kwargs

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

SendTransientBuffer(argin: list[int]) ska_tango_base.type_hints.TaskFunctionType[source]

Cause the subarray to send the requested segment of the transient buffer to SDP.

The requested segment is specified by:

  1. Start time (timestamp: milliseconds since UNIX epoch)

  2. End time (timestamp: milliseconds since UNIX epoch)

  3. Dispersion measure

Together, these parameters narrow the selection of transient buffer data to the period of time and frequencies that are of interest.

Additional metadata, such as the ID of a triggering Scheduling Block, may need to be supplied to allow SDP to assign data ownership correctly (TBD75).

Todo:

This method is a stub that does nothing but return a dummy string.

Parameters:

argin – Specification of the segment of the transient buffer to send

Returns:

ASCII String that indicates status, for information purposes only

__init__(*args: Any, **kwargs: Any) None[source]

Initialise this device object.

Parameters:
  • args – positional args to the init

  • kwargs – keyword args to the init

assignedResources() str[source]

Return this subarray’s assigned resources.

Returns:

this subarray’s assigned resources.

completed_Abort() None[source]

Abort command completed callback.

completed_AbortDevice() None[source]

Abort device command completed callback.

completed_AssignResources() None[source]

Assign Resources command completed callback.

completed_Configure() None[source]

Configure command completed callback.

completed_ObsReset() None[source]

Obs Reset command completed callback.

completed_ReleaseAllResources() None[source]

Release All Resources command completed callback.

completed_Restart() None[source]

Restart command completed callback.

create_component_manager() SubarrayComponentManager[source]

Create and return a component manager for this device.

Returns:

a component manager for this device.

healthModelParams(argin: str) None[source]

Set the params for health transition rules.

Parameters:

argin – JSON-string of dictionary of health states

healthReport() str[source]

Get the health report.

Returns:

the health report.

init_device() None[source]

Initialise the device.

isConfigured() bool[source]

Return whether this subarray is configured.

Returns:

whether this subarray is configured.

is_ReleaseAllResources_allowed(request_type: LRCReqType | None = None) bool[source]

Return whether the ReleaseAllResources() command may be called.

Overriding base class behaviour (and ADR-8) due to behavioural changes in ska-tango-base 1.4.2.

Parameters:

request_type – ENQUEUE_REQ when the LRC is enqueued by the Tango command and EXECUTE_REQ when the LRC is about to be executed by the executor.

Returns:

whether the command may be called in the current device state

missedEvents() int[source]

Get the amount of missed change events.

Some commands rely on change events from sub-devices, sometime we miss these events, this attribute keeps track of how many we know we have missed.

Returns:

the amount of missed change events

qualityAssuranceMetrics() str[source]

Expose quality assurance metrics.

The returned structure is: >>> { >>> “subarray_beams”: { >>> “<subarray_beam_id>”: { >>> “apertures”: { >>> “<aperture_id>”: { >>> “is_beam_locked”: bool, >>> “<metric_name>”: value >>> }, >>> … >>> }, >>> “is_beam_locked”: bool >>> }, >>> … >>> }, >>> “beam_locked_percent”: float >>> }

Example: >>> { >>> “subarray_beams”: { >>> “1” : { >>> “apertures”: { >>> “AP001.01”: { >>> “is_beam_locked”: True, >>> } >>> “AP002.01”: { >>> “is_beam_locked”: False, >>> } >>> }, >>> “is_beam_locked”: False, >>> }, >>> “2” : { >>> “apertures”: { >>> “AP003.01”: { >>> “is_beam_locked”: False, >>> } >>> }, >>> “is_beam_locked”: False, >>> } >>> }, >>> “beam_locked_percent”: 0.0 >>> }

Returns:

A json serialised dictionary

resetCspIngestOnScan(reset: bool) None[source]

Set the resetCspIngestOnScan attribute.

Parameters:

reset – Whether to reset CSP Ingest on stations when Scan is called.

scanId(scan_id) None[source]

Set the scanId attribute.

Parameters:

scan_id – the new scanId

schedule_abort_task(task_callback: ska_tango_base.type_hints.TaskCallbackType) tuple[ska_control_model.TaskStatus, str][source]

Schedule an Abort task to begin executing immediately.

Subclasses should override this to change the behaviour of the Abort() command.

Parameters:

task_callback – Notified of progress of the abort command.

Returns:

A tuple containing TaskStatus.IN_PROGRESS and a message

started_Abort() None[source]

Abort command started callback.

started_AbortDevice() None[source]

Abort device command started callback.

started_AssignResources() None[source]

Assign Resources command started callback.

started_Configure() None[source]

Configure command started callback.

started_ObsReset() None[source]

Obs Reset command started callback.

started_ReleaseAllResources() None[source]

Release All Resources command started callback.

started_Restart() None[source]

Restart command started callback.

stationBeamTrls() list[str][source]

Return the TRLs of station beams assigned to this subarray.

Returns:

TRLs of station beams assigned to this subarray

stationTrls() list[str][source]

Return the TRLs of stations assigned to this subarray.

Returns:

TRLs of stations assigned to this subarray

subarrayBeamTrls() list[str][source]

Return the TRLs of subarray beams assigned to this subarray.

Returns:

TRLs of subarray beams assigned to this subarray

class QAMetricsBuilder(logger: Logger)[source]

Builder for constructing valid QA metrics structures.

__init__(logger: Logger) None[source]

Initialize the builder.

Parameters:

logger – logger

build() dict[str, Any][source]

Build the complete QA metrics dictionary.

Returns:

Valid QA metrics structure

define_beam(beam_id: str, aperture_ids: list[str]) QAMetricsBuilder[source]

Add a beam to the metrics.

Parameters:
  • beam_id – Identifier for the beam

  • aperture_ids – List of aperture IDs for the beam

Returns:

Self for method chaining

has_beam(beam_id: str) bool[source]

Return of beam already defined.

Parameters:

beam_id – the beam id

Returns:

true if already defined.

reset() QAMetricsBuilder[source]

Reset the builder for reuse.

Returns:

Self for method chaining

update_beam_metrics(beam_id: str, beam_qa_info: dict[str, dict[str, Any]]) QAMetricsBuilder[source]

Update metrics for a beam.

Parameters:
  • beam_id – Identifier for the beam

  • beam_qa_info – QA information for the beam

Returns:

Self for method chaining

class SubarrayComponentManager(*args: Any, **kwargs: Any)[source]

A component manager for a subarray.

__init__(subarray_id: int, skuid_url: str, logger: Logger, obs_command_timeout: int, communication_state_callback: Callable[[ska_control_model.CommunicationStatus], None], component_state_callback: Callable[[...], None], default_solution_type: str = 'fitted', event_serialiser: ska_low_mccs_common.EventSerialiser | None = None) None[source]

Initialise a new instance.

Parameters:
  • subarray_id – the subarray ID for this device

  • skuid_url – The address at which a SKUID service is running.

  • obs_command_timeout – the default timeout for obs commands in seconds.

  • logger – the logger to be used by this object.

  • communication_state_callback – callback to be called when the status of the communications channel between the component manager and its component changes

  • component_state_callback – callback to be called when the component state changes.

  • default_solution_type – default calibration solution type used when an aperture in Configure does not specify solution_type.

  • event_serialiser – the event serialiser to be used by this object.

abort(task_callback: Callable | None = None, task_abort_event: Event | None = None) tuple[ska_control_model.TaskStatus, str][source]

Abort the observation.

Parameters:
  • task_callback – callback to be called when the status of the command changes

  • task_abort_event – Check for abort, defaults to None

Returns:

A task status and response message.

abort_device(task_callback: Callable | None = None, task_abort_event: Event | None = None) Any[source]

Abort only this device, for use in RestartSubarray().

Parameters:
  • task_callback – callback to be called when the status of the command changes

  • task_abort_event – Check for abort, defaults to None

Returns:

A task status and response message.

property assigned_resources: list[str]

Return this subarray’s resources.

Returns:

this subarray’s resources.

property assigned_resources_dict: dict[str, Sequence[Any]]

Return a dictionary of resource types and TRLs.

Returns:

this subarray’s resources.

cleanup() None[source]

Cleanup resources held by the component manager.

This includes cleaning up resources held by all sub-component managers.

configure(subarray_beams: list[dict[str, Any]], task_callback: Callable | None, task_abort_event: Event | None = None, transaction_id: str | None = '') None[source]

Configure the resources for a scan.

Parameters:
  • subarray_beams – the beam configurations to be applied

  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

  • transaction_id – the transaction id for the configuration Will be generated if not provided.

deconfigure(task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Deconfigure resources.

Parameters:
  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

do_assign(subarray_id: int, subarray_beams: dict, task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Assign resources to this subarray.

This is just for communication and health roll-up, resource management is done by controller.

Parameters:
  • subarray_id – ID of the subarray

  • subarray_beams – resource specification for each beam

  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

end_scan(task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Execute the end_scan slow command.

Parameters:
  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

get_coords(subarray_beams: list[dict]) list[dict][source]

Modify the coordinates to have correct pointing.

Parameters:

subarray_beams – subarray beams

Raises:

KeyError – coordinates are invalid

Returns:

The modified beams with correct coords

property max_executing_tasks: int

Get the max number of tasks that can be executing at once.

Returns:

max number of simultaneously executing tasks.

obsreset(task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Reset the observation by returning to unconfigured state.

Parameters:
  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

property power_state: ska_control_model.PowerState | None

Return my power state.

Returns:

my power state

release(beam_resources: dict[str, list[str]], task_callback: Callable | None, task_abort_event: Event | None) None[source]

Release resources from this subarray.

Parameters:
  • beam_resources – list of resource TRLs to release.

  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

Raises:

NotImplementedError – because MCCS Subarray cannot perform a partial release of beam_resources.

release_all(task_callback: Callable | None, task_abort_event: Event | None = None) None[source]

Release all resources from this subarray.

Parameters:
  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

restart(task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Restart the subarray by returning to unresourced state.

Parameters:
  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

scan(scan_id: int = 0, start_time: str | None = None, duration: float = 0.0, task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Start scanning.

Parameters:
  • scan_id – the id of the scan

  • start_time – the start time of the scan

  • duration – Scan duration in seconds. 0.0 or omitted means forever

  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

property scan_id: int | None

Return the scan id, or None if a scan is not current.

Returns:

the scan id, or None if a scan is not current.

send_transient_buffer(argin: list[int], task_callback: Callable | None = None, task_abort_event: Event | None = None) None[source]

Send the transient buffer.

Parameters:
  • argin – list of list of requested segment.

  • task_callback – Update task state, defaults to None

  • task_abort_event – Check for abort, defaults to None

start_communicating() None[source]

Establish communication with the station components.

property station_beam_trls: set[str]

Return the set of TRLs of station beams assigned to this subarray.

Returns:

the set of TRLs of station beams assigned to this subarray.

property station_trls: set[str]

Return the set of TRLs of stations assigned to this subarray.

Returns:

the set of TRLs of stations assigned to this subarray.

stop_communicating() None[source]

Break off communication with the station components.

property subarray_beam_trls: set[str]

Return the set of TRLs of subarray beams assigned to this subarray.

Returns:

the set of TRLs of subarray beams assigned to this subarray.

class SubarrayHealthModel(*args: Any, **kwargs: Any)[source]

A health model for subarrays.

__init__(health_changed_callback: Callable, ignore_power_state: bool = False, thresholds: dict[str, float] | None = None) None[source]

Initialise a new instance.

Parameters:
  • health_changed_callback – a callback to be called when the health of the subarray (as evaluated by this model) changes

  • ignore_power_state – whether the health model should ignore the power state when computing health.

  • thresholds – Thresholds for failed and degraded states.

evaluate_health() tuple[ska_control_model.HealthState, str][source]

Compute overall health of the subarray.

The overall health is based on the fault and communication status of the subarray overall, together with the health of its stations and subarray beams.

This implementation simply sets the health of the station to the health of its least healthy component.

Returns:

an overall health of the subarray

resources_changed(station_trls: set[str], subarray_beam_trls: set[str], station_beam_trls: set[str]) None[source]

Handle change in subarray resources.

This is a callback hook, called by the component manager when the resources of the subarray changes.

Parameters:
  • station_trls – the TRLs of stations assigned to this subarray

  • subarray_beam_trls – the TRLs of subarray beams assigned to this subarray

  • station_beam_trls – the TRLs of station beams assigned to this subarray

station_beam_health_changed(trl: str, health_state: HealthState | None) None[source]

Handle change in station beam health.

This is a callback hook, called by the component manager when the health of a station beam changes.

Parameters:
  • trl – the TRL of the station beam whose health has changed

  • health_state – the new health state of the station beam, or None if the station beam’s health should not be taken into account.

station_health_changed(trl: str, health_state: HealthState | None) None[source]

Handle change in station health.

This is a callback hook, called by the component manager when the health of a station changes.

Parameters:
  • trl – the TRL of the station whose health has changed

  • health_state – the new health state of the station, or None if the subarray beam’s health should not be taken into account.

subarray_beam_health_changed(trl: str, health_state: HealthState | None) None[source]

Handle change in subarray beam health.

This is a callback hook, called by the component manager when the health of a subarray beam changes.

Parameters:
  • trl – the TRL of the subarray beam whose health has changed

  • health_state – the new health state of the subarray beam, or None if the subarray beam’s health should not be taken into account.