Struct birli::io::mwaf::FlagFileSet [−][src]
pub struct FlagFileSet { /* fields omitted */ }
Expand description
A group of .mwaf Files for the same observation
Implementations
Create a new set of flag files
filename_template
is a template string which is expanded to the list of flag files in the
set, by replacing the percent (%
) characters with each coarse channel’s zero-prefixed
GPUBox ID. This is to maintain backwards compatibility with Cotter.
For MWA Ord (legacy, pre-2021) correlator observations, the GPUBox ID is the two digit
correlator channel host number corresponding to [mwalib::CoarseChannel.corr_chan_number
]
For MWAX correlator observations, the GPUBox ID is the three-digit received channel number
corresponding to [mwalib::CoarseChannel.rec_chan_number
].
Be sure to specify the correct number of percent characters.
Errors
Will error with [BirliError::FitsOpen
] if there are files already present at the paths
specified in filename template.
Will error with [BirliError::InvalidFlagFilenameTemplate
] if an invalid flag filename
template is provided (wrong number of percents).
Open an existing set of flag files, given an observation’s MWA Version, the flag filename template, and a list of gpubox ids.
Errors
will error with [BirliError::FitsOpen
] if files don’t exist
Write flags to disk, given an observation’s [mwalib::CorrelatorContext
], and an ndarray
of boolean flags for the observation into a file for each gpubox_id
.
The filename template should contain two or 3 percentage (%
) characters which will be replaced
by the gpubox id or channel number (depending on correlator type). See FlagFileSet::new
Errors
Will error if the gpubox ids this flagset was initialized with is not contained in the
provided [mwalib::CorrelatorContext
].
TODO: These are just for tests, and should be deprecated. TODO: Why doesn’t #[cfg(test)] work?
pub fn read_chan_header_flags_raw(
&mut self
) -> Result<BTreeMap<usize, (FlagFileHeaders, Vec<i8>)>, BirliError>
pub fn read_chan_header_flags_raw(
&mut self
) -> Result<BTreeMap<usize, (FlagFileHeaders, Vec<i8>)>, BirliError>
Read raw flags and headers from disk, as a std::collections::BTreeMap
mapping from each
gpubox id to a tuple containing a FlagFileHeaders
and the raw flags as a vector of bytes.
Errors
Will error with [BirliError::MwafInconsistent
] if the mwaf files have inconsistent headers