metadata module

Helper functions to parse sources of truth metadata from telmodel.

class aiv_utils.metadata.FibreMapping(sb, fem, has_antenna, fem_sn, tail, fibre, tpm, masked)

A dataclass to represent a mapping of a fibre to a TPM.

aiv_utils.metadata.get_antenna_locations(station)

Return the antenna locations for a given station.

Parameters:

station (str | DeviceProxy) – The station name (eg. “s10-3”, “s8-1”) or an SpsStation DeviceProxy.

Return type:

ndarray

Returns:

A numpy array of antenna locations in meters from the centre of the station where the columns are east, north and up.

aiv_utils.metadata.get_static_delays_from_file(station_name, static_delays_file)

Returns static delays in SpsStation ordering for the given station and file.

Parameters:
  • station_name (str) – The name of the station.

  • static_delays_file (PathLike) – A path to the file containing static delays.

Return type:

ndarray

Returns:

A flat 512 element Numpy array of the static delays from the file.

aiv_utils.metadata.get_station_location(station)

Return the station location (lat, long and elevation) for a given station.

Parameters:

station (str | DeviceProxy) – The station name (eg. “s10-3”, “s8-1”) or an SpsStation DeviceProxy.

Return type:

tuple

Returns:

a tuple of the station location (latitude, longitude and elevation in degrees, degrees and meters)

aiv_utils.metadata.get_station_preadu_attenuations(station, default_atten=20.0)

Fetch platform spec station preadu attenuation values.

Parameters:
  • station (str | DeviceProxy) – The station name (eg. “s10-3”, “s8-1”) or an SpsStation DeviceProxy.

  • default_atten – The default attenuation to use if not found in telmodel.

Return type:

list[float]

Returns:

List of floats of preadu-attenuation values.

aiv_utils.metadata.get_station_rotation(station)

Return the station rotation for a given station.

Parameters:

station (str | DeviceProxy) – The station name (eg. “s10-3”, “s8-1”) or an SpsStation DeviceProxy.

Return type:

float

Returns:

the station rotation in degrees

aiv_utils.metadata.get_station_static_delays(station)

Fetch platform spec file for given station and return static delays per TPM.

Parameters:

station (str | DeviceProxy) – The station name (eg. “s10-3”, “s8-1”) or an SpsStation DeviceProxy.

Return type:

list[list[float]]

Returns:

a list of lists of thirty-two floats representing the static delays for each of the antennas for a TPM, ordered by ADC number.

aiv_utils.metadata.load_tmdata(*args, **kwargs)

Wrap TMData with backoff to handle flaky networks.

Arguments are as for TMData.__init__().

Return type:

TMData

Returns:

A TMData object.

aiv_utils.metadata.parse_platform_spec(station_name)

Parse the platform spec file and return a list of FibreMapping objects.

aiv_utils.metadata.parse_tsv(tsv_path)

Parse a TSV file and return a list of FibreMapping objects.

aiv_utils.metadata.smartbox_ports_masked(station)

Returns a list of lists indicating which ports should be disabled for each smartbox.

This takes into account both the “masked” flag in the station spec, and the fact that not all ports have an antenna connected to them.

Return type:

dict[str, list[bool]]

aiv_utils.metadata.station_id_from_label(station_label)

Returns the station ID for a given station label.

Return type:

int

aiv_utils.metadata.station_label_from_id(station_id)

Returns the station label for a given station ID.

Return type:

str