ska_pst.lmc.stat

This subpackage implements STAT component for PST.LMC.

class ska_pst.lmc.stat.PstStatComponentManager(*args: Any, **kwargs: Any)[source]

Component manager for the STAT component for the PST.LMC subsystem.

property imag_pol_a_mean_freq_avg: float

Get the mean of the imaginary data for pol A, averaged over all channels.

property imag_pol_a_mean_freq_avg_rfi_excised: float

Get the mean of the imaginary data for pol A, averaged over channels not flagged for RFI.

property imag_pol_a_num_clipped_samples: int

Get the num of clipped samples of the imaginary data for pol A.

property imag_pol_a_num_clipped_samples_rfi_excised: int

Get the num of clipped samples of the imaginary data for pol A in channels not flagged for RFI.

property imag_pol_a_variance_freq_avg: float

Get the variance of the imaginary data for pol A, averaged over all channels.

property imag_pol_a_variance_freq_avg_rfi_excised: float

Get the variance of the imaginary data for pol A, averaged over channels not flagged for RFI.

property imag_pol_b_mean_freq_avg: float

Get the mean of the imaginary data for pol B, averaged over all channels.

property imag_pol_b_mean_freq_avg_rfi_excised: float

Get the mean of the imaginary data for pol B, averaged over channels not flagged for RFI.

property imag_pol_b_num_clipped_samples: int

Get the num of clipped samples of the imaginary data for pol B.

property imag_pol_b_num_clipped_samples_rfi_excised: int

Get the num of clipped samples of the imaginary data for pol B in channels not flagged for RFI.

property imag_pol_b_variance_freq_avg: float

Get the variance of the imaginary data for pol B, averaged over all channels.

property imag_pol_b_variance_freq_avg_rfi_excised: float

Get the variance of the imaginary data for pol B, averaged over channels not flagged for RFI.

property real_pol_a_mean_freq_avg: float

Get the mean of the real data for pol A, averaged over all channels.

property real_pol_a_mean_freq_avg_rfi_excised: float

Get the mean of the real data for pol A, averaged over channels not flagged for RFI.

property real_pol_a_num_clipped_samples: int

Get the num of clipped samples of the real data for pol A.

property real_pol_a_num_clipped_samples_rfi_excised: int

Get the num of clipped samples of the real data for pol A in channels not flagged for RFI.

property real_pol_a_variance_freq_avg: float

Get the variance of the real data for pol A, averaged over all channels.

property real_pol_a_variance_freq_avg_rfi_excised: float

Get the variance of the real data for pol A, averaged over channels not flagged for RFI.

property real_pol_b_mean_freq_avg: float

Get the mean of the real data for pol B, averaged over all channels.

property real_pol_b_mean_freq_avg_rfi_excised: float

Get the mean of the real data for pol B, averaged over channels not flagged for RFI.

property real_pol_b_num_clipped_samples: int

Get the num of clipped samples of the real data for pol B.

property real_pol_b_num_clipped_samples_rfi_excised: int

Get the num of clipped samples of the real data for pol B in channels not flagged for RFI.

property real_pol_b_variance_freq_avg: float

Get the variance of the real data for pol B, averaged over all channels.

property real_pol_b_variance_freq_avg_rfi_excised: float

Get the variance of the real data for pol B, averaged over channels not flagged for RFI.

validate_configure_scan(configuration: dict, **kwargs: Any) None

Validate a ConfigureScan request sent from CSP.LMC to the STAT sub-component.

This asserts the request can be converted to STAT resources and then calls the process API to perform the validation.

Parameters
  • configuration (dict) – configuration that would be used when the configure_beam and configure_scan methods are called.

  • task_callback (Callback) – callback for background processing to update device status.

class ska_pst.lmc.stat.PstStatProcessApi(*args: Any, **kwargs: Any)[source]

Abstract class for the API of the STAT process.

This extends from PstProcessApi but provides the specific method of getting the monitoring data.

class ska_pst.lmc.stat.PstStatProcessApiGrpc(*args: Any, **kwargs: Any)[source]

This is an gRPC implementation of the PstStatProcessApi API.

This uses an instance of a PstGrpcLmcClient to send requests through to the STAT.CORE application. Instances of this class should be per subband, rather than one for all of STAT as a whole.

class ska_pst.lmc.stat.PstStatProcessApiSimulator(*args: Any, **kwargs: Any)[source]

A simulator implementation version of the API of PstStatProcessApi.

class ska_pst.lmc.stat.PstStatSimulator(*args: Any, **kwargs: Any)[source]

Class used for simulating STAT data.

configure_scan(configuration: dict) None

Simulate configuring a scan.

Parameters

configuration (dict) – the configuration to be configured

Raises

AssertionError if length of subband sizes not the same as num_subbands.

get_data() StatMonitorData[source]

Get current STAT data.

Updates the current simulated data and returns the latest data.

Returns

current simulated STAT data.

Return type

StatMonitorData

class ska_pst.lmc.stat.StatMonitorData(*, real_pol_a_mean_freq_avg: float = 0.0, real_pol_a_variance_freq_avg: float = 0.0, real_pol_a_num_clipped_samples: int = 0, imag_pol_a_mean_freq_avg: float = 0.0, imag_pol_a_variance_freq_avg: float = 0.0, imag_pol_a_num_clipped_samples: int = 0, real_pol_a_mean_freq_avg_rfi_excised: float = 0.0, real_pol_a_variance_freq_avg_rfi_excised: float = 0.0, real_pol_a_num_clipped_samples_rfi_excised: int = 0, imag_pol_a_mean_freq_avg_rfi_excised: float = 0.0, imag_pol_a_variance_freq_avg_rfi_excised: float = 0.0, imag_pol_a_num_clipped_samples_rfi_excised: int = 0, real_pol_b_mean_freq_avg: float = 0.0, real_pol_b_variance_freq_avg: float = 0.0, real_pol_b_num_clipped_samples: int = 0, imag_pol_b_mean_freq_avg: float = 0.0, imag_pol_b_variance_freq_avg: float = 0.0, imag_pol_b_num_clipped_samples: int = 0, real_pol_b_mean_freq_avg_rfi_excised: float = 0.0, real_pol_b_variance_freq_avg_rfi_excised: float = 0.0, real_pol_b_num_clipped_samples_rfi_excised: int = 0, imag_pol_b_mean_freq_avg_rfi_excised: float = 0.0, imag_pol_b_variance_freq_avg_rfi_excised: float = 0.0, imag_pol_b_num_clipped_samples_rfi_excised: int = 0)[source]

A data class to transfer current STAT scalar data between the process and the component manager.

Variables
  • real_pol_a_mean_freq_avg (float) – the mean voltage data across all channels for polarisation A and the I component

  • real_pol_a_variance_freq_avg (float) – the variance of voltage data across all channels for polarisation A and the I component

  • real_pol_a_num_clipped_samples (int) – the number of clipped samples across all channels for polarisation A and the I component

  • imag_pol_a_mean_freq_avg (float) – the mean voltage data across all channels for polarisation A and the Q component

  • imag_pol_a_variance_freq_avg (float) – the variance of voltage data across all channels for polarisation A and the Q component

  • imag_pol_a_num_clipped_samples (int) – the number of clipped samples across all channels for polarisation A and the Q component

  • real_pol_a_mean_freq_avg_rfi_excised (float) – the mean voltage data across channels not flagged for RFI for polarisation A and the I component

  • real_pol_a_variance_freq_avg_rfi_excised (float) – the variance of voltage data across channels not flagged for RFI for polarisation A and the I component

  • real_pol_a_num_clipped_samples_rfi_excised (int) – the number of clipped samples across channels without RFI for polarisation A and the I component

  • imag_pol_a_mean_freq_avg_rfi_excised (float) – the mean voltage data across channels not flagged for RFI for polarisation A and the Q component

  • imag_pol_a_variance_freq_avg_rfi_excised (float) – the variance of voltage data across channels not flagged for RFI for polarisation A and the Q component

  • imag_pol_a_num_clipped_samples_rfi_excised (int) – the number of clipped samples across channels without RFI for polarisation A and the Q component

  • real_pol_b_mean_freq_avg (float) – the mean voltage data across all channels for polarisation B and the I component

  • real_pol_b_variance_freq_avg (float) – the variance of voltage data across all channels for polarisation B and the I component

  • real_pol_b_num_clipped_samples (int) – the number of clipped samples across all channels for polarisation B and the I component

  • imag_pol_b_mean_freq_avg (float) – the mean voltage data across all channels for polarisation B and the Q component

  • imag_pol_b_variance_freq_avg (float) – the variance of voltage data across all channels for polarisation B and the Q component

  • imag_pol_b_num_clipped_samples (int) – the number of clipped samples across all channels for polarisation B and the Q component

  • real_pol_b_mean_freq_avg_rfi_excised (float) – the mean voltage data across channels not flagged for RFI for polarisation B and the I component

  • real_pol_b_variance_freq_avg_rfi_excised (float) – the variance of voltage data across channels not flagged for RFI for polarisation B and the I component

  • real_pol_b_num_clipped_samples_rfi_excised (int) – the number of clipped samples across channels without RFI for polarisation B and the I component

  • imag_pol_b_mean_freq_avg_rfi_excised (float) – the mean voltage data across channels not flagged for RFI for polarisation B and the Q component

  • imag_pol_b_variance_freq_avg_rfi_excised (float) – the variance of voltage data across channels not flagged for RFI for polarisation B and the Q component

  • imag_pol_b_num_clipped_samples_rfi_excised (int) – the number of clipped samples across channels without RFI for polarisation B and the Q component

imag_pol_a_mean_freq_avg: float = 0.0
imag_pol_a_mean_freq_avg_rfi_excised: float = 0.0
imag_pol_a_num_clipped_samples: int = 0
imag_pol_a_num_clipped_samples_rfi_excised: int = 0
imag_pol_a_variance_freq_avg: float = 0.0
imag_pol_a_variance_freq_avg_rfi_excised: float = 0.0
imag_pol_b_mean_freq_avg: float = 0.0
imag_pol_b_mean_freq_avg_rfi_excised: float = 0.0
imag_pol_b_num_clipped_samples: int = 0
imag_pol_b_num_clipped_samples_rfi_excised: int = 0
imag_pol_b_variance_freq_avg: float = 0.0
imag_pol_b_variance_freq_avg_rfi_excised: float = 0.0
real_pol_a_mean_freq_avg: float = 0.0
real_pol_a_mean_freq_avg_rfi_excised: float = 0.0
real_pol_a_num_clipped_samples: int = 0
real_pol_a_num_clipped_samples_rfi_excised: int = 0
real_pol_a_variance_freq_avg: float = 0.0
real_pol_a_variance_freq_avg_rfi_excised: float = 0.0
real_pol_b_mean_freq_avg: float = 0.0
real_pol_b_mean_freq_avg_rfi_excised: float = 0.0
real_pol_b_num_clipped_samples: int = 0
real_pol_b_num_clipped_samples_rfi_excised: int = 0
real_pol_b_variance_freq_avg: float = 0.0
real_pol_b_variance_freq_avg_rfi_excised: float = 0.0
class ska_pst.lmc.stat.StatMonitorDataStore[source]

A data store for STAT scalar subband monitoring data.

This data store will aggregate the separate data. For now this only handles 1 subband as needed for AA0.5 but for later array assembly releases this needs to aggregate the the separate subband data.

property monitor_data: StatMonitorData

Return the current calculated monitoring data.

This aggregates all the individual subband data values into one StatMonitorData instance.

Currently this only supports 1 subband but in the future this will should support multiple subbands. This can be done by knowing the number of samples per statistic from each subband, including the total number and the number that has not been flagged as RFI. For more information about how this can be achieved refer to Wikipedia - Algorithms for calculating variance - Parallel algorithm

Returns

current monitoring data.

ska_pst.lmc.stat.calculate_stat_subband_resources(beam_id: int, **kwargs: Any) Dict[int, dict][source]

Calculate the statistics (STAT) resources from request.

This is a common method to map a CSP JSON request to the appropriate STAT parameters. It is also used to calculate the specific subband resources.

This uses the SMRB generate_data_key(), generate_weights_key() functions to calculate the keys for the data and weight ring buffers that the STAT process will read from.

Parameters
  • beam_id – the numerical id of the beam that this STAT request is for.

  • request_params – a dictionary of request parameters that is used to configure PST, the specific parameters for STAT are extracted within this method.

Returns

a dict of dicts, with the top level key being the subband id, while the second level is the specific parameters. An example would response is as follows:

{
    1: {
        'data_key': "a000",
        'weights_key': "a010",
    }
}

ska_pst.lmc.stat.generate_stat_scan_request(request_params: dict) dict[source]

Get the scan request parameters for STAT.

This maps the given request parameters into a dictionary that will be passed to the STAT.CORE application via Protobuf. The parameters stat_processing_delay_ms, stat_req_freq_bins, stat_req_time_bins, stat_num_rebin are optional in the request parameters but this method will populate them with default values (see DEFAULT_PROCESSING_DELAY_MS, DEFAULT_REQ_TIME_BINS, DEFAULT_REQ_FREQ_BINS, and DEFAULT_NUM_REBIN respectively)

Parameters

request_params – a dictionary of request parameters that is used to configure PST, the specific parameters for STAT are extracted within this method.

Returns

a dictionary of specific parameters to send to a STAT.CORE process. An example would response is as follows:

{
    "execution_block_id": "eb-m001-20230712-56789",
    "processing_delay_ms": 5000,
    "req_time_bins": 1024,
    "req_freq_bins": 1024,
    "num_rebin": 256,
}