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.
- validate_configure_scan(configuration: dict) 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.
- class ska_pst.lmc.stat.PstStatGrpcApiStrategy[source]
Implementation of the GrpcApiStrategy for the STAT subcomponent.
- get_beam_configuration_msg(*, configuration: dict) ska_pst.grpc.lmc.ska_pst_lmc_pb2.BeamConfiguration[source]
Get the gRPC BeamConfiguration Protobuf message for STAT.
- Parameters
configuration (dict) – the PST beam configuration
- Returns
the gRPC BeamConfiguration Protobuf message for STAT.
- Return type
BeamConfiguration
- get_scan_configuration_msg(*, configuration: dict) ska_pst.grpc.lmc.ska_pst_lmc_pb2.ScanConfiguration[source]
Get the gRPC ScanConfiguration Protobuf message for STAT.
- Parameters
configuration (dict) – the PST scan configuration
- Returns
the gRPC ScanConfiguration Protobuf message for STAT.
- Return type
ScanConfiguration
- handle_monitor_response(*, data: ska_pst.grpc.lmc.ska_pst_lmc_pb2.MonitorData, callback: MonitorDataCallback) None[source]
Handle the gRPC monitoring data response.
- Parameters
data (MonitorData) – the gRPC/Protobuf monitoring data message from server
callback (MonitorDataCallback) – the callback used to update the LMC subcomponent model
- 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
- class ska_pst.lmc.stat.StatMonitorData(*, real_pol_a_mean_freq_avg: float = 0.0, real_pol_a_variance_freq_avg: float = 1.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 = 1.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 = 1.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 = 1.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 = 1.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 = 1.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 = 1.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 = 1.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 = 1.0
- imag_pol_a_variance_freq_avg_rfi_excised: float = 1.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 = 1.0
- imag_pol_b_variance_freq_avg_rfi_excised: float = 1.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 = 1.0
- real_pol_a_variance_freq_avg_rfi_excised: float = 1.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 = 1.0
- real_pol_b_variance_freq_avg_rfi_excised: float = 1.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 separate subband data.
- property monitor_data: StatMonitorData
Return the current calculated monitoring data.
This aggregates all the individual subband data values into one
StatMonitorDatainstance.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)
This method will also populate the dashboard_destinations field if the destinations were in the PST Scan Configuration request (available in schema versions >= 3.1). If there are no dashboard_destinations in the request then treat it as an empty dictionary.
- 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, "dashboard_destinations": { "pst_bandpass": "kafka://10.0.0.1:9092/pst-bandpass-pb-mvp01-20251105-00001", "pst_timeseries": "kafka://10.0.0.1:9092/pst-timeseries-pb-mvp01-20251105-00001", "pst_histogram": "kafka://10.0.0.1/pst-histogram-pb-mvp01-20251105-00001" } }