orca.flagging.flagoperations
Low-level flag manipulation operations for measurement sets.
Provides functions for directly manipulating FLAG columns in CASA measurement sets, including flagging antennas, baselines, merging flags between observations, and I/O with numpy arrays.
Originally adapted from Marin Anderson’s code (3/8/2019).
Functions
- flag_ants
Flag all visibilities involving specified antennas.
- merge_flags
OR-merge flags between two measurement sets.
- merge_group_flags
OR-merge flags across a group of measurement sets.
- write_to_flag_column
Apply flags from a numpy array to a measurement set.
- save_to_flag_npy
Save the FLAG column to a numpy file.
- flag_bls
Apply baseline flags from a text file.
Attributes
Functions
|
Flag all visibilities involving specified antennas. |
|
OR-merge flags between two measurement sets. |
|
OR-merge flags across a group of measurement sets. |
|
Apply flags from a numpy array to a measurement set. |
|
Save the FLAG column from a measurement set to a numpy file. |
|
Apply baseline flags from a text file to a measurement set. |
Module Contents
- orca.flagging.flagoperations.flag_ants(ms: str, ants: List[int]) str[source]
Flag all visibilities involving specified antennas.
- Parameters:
ms – Path to the measurement set.
ants – List of antenna indices (0-indexed) to flag.
- Returns:
Path to the modified measurement set.
- orca.flagging.flagoperations.merge_flags(ms1: str, ms2: str) Tuple[str, str][source]
OR-merge flags between two measurement sets.
Updates both measurement sets so their FLAG columns contain the logical OR of the original flags from both files.
- Parameters:
ms1 – Path to the first measurement set.
ms2 – Path to the second measurement set.
- Returns:
Tuple of (ms1, ms2) paths.
- orca.flagging.flagoperations.merge_group_flags(ms_list: List[str]) List[str][source]
OR-merge flags across a group of measurement sets.
Updates all measurement sets so they share the same merged FLAG column, containing the logical OR of flags from all input files.
- Parameters:
ms_list – List of measurement set paths.
- Returns:
The input list of paths (all now updated).
- orca.flagging.flagoperations.write_to_flag_column(ms: str, flag_npy: str) str[source]
Apply flags from a numpy array to a measurement set.
The numpy array is OR-merged with existing flags.
- Parameters:
ms – Path to the measurement set.
flag_npy – Path to the numpy file containing boolean flag array.
- Returns:
Path to the modified measurement set.
- Raises:
AssertionError – If the flag array shape doesn’t match the MS.
- orca.flagging.flagoperations.save_to_flag_npy(ms: str, flag_npy: str) str[source]
Save the FLAG column from a measurement set to a numpy file.
- Parameters:
ms – Path to the measurement set.
flag_npy – Output path for the numpy file.
- Returns:
Path to the saved numpy file.
- orca.flagging.flagoperations.flag_bls(msfile: str, blfile: str) str[source]
Apply baseline flags from a text file to a measurement set.
- Parameters:
msfile – Path to the measurement set.
blfile – Path to the baseline flag file. Format is one baseline per line as ‘ant1&ant2’ (0-indexed).
- Returns:
Path to the modified measurement set.
- Raises:
ValueError – If the number of visibilities is unexpected.