ska_pst.testutils.dada
Submodule for providing utilities working with DADA files.
- class ska_pst.testutils.dada.DadaFileReader(file: Path, logger: Optional[Logger] = None)[source]
Class that can be used to read a PSR DADA file.
- property data_size: int
Get the size of the data.
- property file_name: str
Get name of file.
- property file_number: int
Get the FILE_NUMBER value from header.
- property file_size: int
Get size of file in bytes.
- property header: Dict[str, str]
Get header for file.
- property obs_offset: int
Get the OBS_OFFSET value.
- property scan_id: int
Get the SCAN_ID value from header.
- class ska_pst.testutils.dada.DspDataAnalyser(scan_config: dict, base_dir: Path, subsystem_id: str, scan_id: int, eb_id: Optional[str] = None, logger: Optional[Logger] = None)[source]
Class for analysing files generated by DSP.CORE.
- check_contiguous_files(scanlen: float, calculated_resources: dict, file_type: str) None [source]
Check the files for the scan are contiguous.
- check_dada_files_exist(dsp_subpath: str | pathlib.Path) None [source]
Assert that DADA files exist for a given subpath.
This will check that *.dada files exist in the given dsp_subpath. Files are expected to be found at <base_dir>/product/<eb_id>/<subsystem_id>/<scan_id> / dsp_subpath.
- check_sinusoid_frequency(expected_frequency: float, eps: float = 0.1) None [source]
Analyse DSP artefacts.
This will find data and weights file for the given scan and assert that the frequency from data is within eps of the expected frequency.
- class ska_pst.testutils.dada.ScanFileMetadata(*, name: str, obs_offset: int, file_number: int, data_size: int, file_size: int, scan_id: int)[source]
A data class to store the metadata of a scan file.
- data_size: int
- file_number: int
- file_size: int
- name: str
- obs_offset: int
- scan_id: int
- class ska_pst.testutils.dada.WeightsFileReader(file: Path, unpack_scales: bool = True, unpack_weights: bool = True, logger: Optional[Logger] = None)[source]
Class that can be used to read a Weights PSRDADA file generated by ska_pst_dsp_disk.
- property dropped_packets: numpy.ndarray
Return a list of the dropped packets by inspecting NaNs in the scales.
- property packet_offset: int
Get the package offset for current file.
This converts the obs_offset a packet offset by dividing the value by the weights_packet_stride. This will assert that the obs_offset is a mulitple of weights_packet_stride
- property scales: nptyping.NDArray.(typing.Any, nptyping.Single)
Return the unpacked scales.
- property weights: nptyping.NDArray.(typing.Any, nptyping.UShort)
Return the unpacked weights.