ska_pst.testutils.common

Module that includes common code for SKA PST Python code.

ska_pst.testutils.common.convert_value_to_quantity(value: str) Union[str, astropy.units.Quantity, Tuple[astropy.units.Quantity, astropy.units.Quantity]][source]

Convert a value string to a quantity.

This tries to use the astropy.units package to see if it can convert it to a quantity. If the value starts with a number then it is expected to be a quantity (value with optional unit). If it isn’t a number the string value is returned.

This is method should be extended to handled the edge cases that may arise in the future.

ska_pst.testutils.common.csp_scan_type(mode: ska_control_model.PstProcessingMode, facility: TelescopeFacilityEnum, version: str = ska_telmodel.pst.version.PST_CONFIG_VER3_0) str[source]

Get CSP Scan example string.

This is to be used when calling the ska_telmodel.pst.examples.get_pst_config_example() method to retrieve the correct example CSP-PST JSON data.

Parameters
  • mode (PstProcessingMode) – the PST processing mode to get the CSP scan type for.

  • facility (TelescopeFacilityEnum) – the telescope facility, for SKAMid the value is prefixed with ‘mid’.

  • version (str, optional) – the interface version to use, defaults to PST_CONFIG_VER3_0. This is used to ensure compatibility of detected filterbank processing mode in legacy versions as the string is pst_scan_ds

Returns

the CSP Scan example string

Return type

str

ska_pst.testutils.common.pst_processing_mode_from_str(value: str) ska_control_model.PstProcessingMode[source]

Get processing mode from a string.

PST BDD tests may use ‘voltage recorder’ or ‘pulsar timing’. This will capitalise the string and replace spaces with underscores before converting to an enum value.