flint.misc.interopt

Helper functions and tools to update spectific features of ASKAP CASDA related data sets

Functions

_find_casda_bandpass_table_type(→ str)

Examine the bandpass table to determine if it is a CASDA provided table or not.

flag_antenna_from_casda_bandpass_table(→ flint.ms.MS)

Flag antennas in a MS if the bandpass table indicates that all solutions are invalid.

get_flagged_antenna_casda_solutions(→ dict[int, ...)

Examine a CASDA provided bandpass table to attempt to identify antennas

Module Contents

flint.misc.interopt._find_casda_bandpass_table_type(column_name: collections.abc.Sequence[str]) → str[source]

Examine the bandpass table to determine if it is a CASDA provided table or not. This is done by examining the columns of the table and looking for the expected columns that are present in a CASDA provided bandpass table.

Parameters:

column_name (Sequence[str]) – The columns of the bandpass table to examine

Raises:

ValueError – Raised if the table does not appear to be from CASDA

Returns:

The name of the column with the validity flags for the bandpass solutions. These could be ‘BANDPASS_VALID’ or ‘BPLEAKAGE_VALID’ for CASDA provided tables.

Return type:

str

flint.misc.interopt.flag_antenna_from_casda_bandpass_table(ms: flint.ms.MS | pathlib.Path, bandpass_table: pathlib.Path) → flint.ms.MS[source]

Flag antennas in a MS if the bandpass table indicates that all solutions are invalid. There are instances where resetting the flags may be preferred, and corner cases where uncalibrated data may make it into a ‘CORRECTED_DATA’ column with appropriate flags being set.

Parameters:
  • ms (MS | Path) – The measurement set to examine and flag

  • bandpass_table (Path) – The bandpass table that will be examined to assess flagging

Returns:

The measurement set that was modified to update flags

Return type:

MS

flint.misc.interopt.get_flagged_antenna_casda_solutions(bandpass_table: pathlib.Path) → dict[int, numpy.typing.NDArray[numpy.bool]][source]

Examine a CASDA provided bandpass table to attempt to identify antennas that are completely flagged from their solutions. Examine the BANDPASS_VALID column to do this. The shape of the bandpass solutions should be:

>>> (TIME, BEAM, ANT, GAIN)

The time dimension is enforced to be length 1 in this function.

Parameters:

bandpass_table (Path) – Path to the table to examine

Raises:

ValueError – Raised if the table does not appear to be from CASDA

Returns:

Antenna indices that are completely flagged for each beam.

Return type:

dict[int, NDArray[np.bool]]