pub struct FlagContext {
pub timestep_flags: Vec<bool>,
pub coarse_chan_flags: Vec<bool>,
pub fine_chan_flags: Vec<bool>,
pub antenna_flags: Vec<bool>,
pub autos: bool,
pub flag_dc: bool,
pub flag_init: f32,
pub flag_end: f32,
}Expand description
Which timesteps, channels and baselines are flagged in a given observation
Fields§
§timestep_flags: Vec<bool>Which mwalib timestep indices are flagged
coarse_chan_flags: Vec<bool>Which mwalib coarse channel indices are flagged
fine_chan_flags: Vec<bool>Which fine channel indices are flagged in every coarse channel
antenna_flags: Vec<bool>Which mwalib antenna indices are flagged
autos: boolWhether auto-correlations are flagged
flag_dc: boolWhether DC (centre) fine channel indices are flagged
flag_init: f32How many seconds to flag from the start of the observation
flag_end: f32How many seconds to flag from the end of the observation
Implementations§
Source§impl FlagContext
impl FlagContext
Sourcepub fn blank_from_dimensions(
num_timesteps: usize,
num_coarse_chans: usize,
num_fine_chans_per_coarse: usize,
num_ants: usize,
) -> Self
pub fn blank_from_dimensions( num_timesteps: usize, num_coarse_chans: usize, num_fine_chans_per_coarse: usize, num_ants: usize, ) -> Self
Create a new FlagContext with all flags false, in the given dimensions
Sourcepub fn from_mwalib(corr_ctx: &CorrelatorContext) -> Self
pub fn from_mwalib(corr_ctx: &CorrelatorContext) -> Self
Create a new FlagContext from a marlu::mwalib::CorrelatorContext, flagging anything not provided.
- Timesteps are flagged in they are not provided in any of the gpubox files.
- Coarse channels are flagged if they appear in the metafits, but are not provided.
- No fine channel flags are set by default.
§Examples
use birli::{FlagContext, mwalib::CorrelatorContext};
// define our input files
let metafits_path = "tests/data/1196175296_mwa_ord/1196175296.metafits";
let gpufits_paths = vec![
"tests/data/1196175296_mwa_ord/1196175296_20171201145440_gpubox01_00.fits",
"tests/data/1196175296_mwa_ord/1196175296_20171201145540_gpubox01_01.fits",
"tests/data/1196175296_mwa_ord/1196175296_20171201145440_gpubox02_00.fits",
"tests/data/1196175296_mwa_ord/1196175296_20171201145540_gpubox02_01.fits",
];
// Create an mwalib::CorrelatorContext for accessing visibilities.
let corr_ctx = CorrelatorContext::new(metafits_path, &gpufits_paths).unwrap();
let flag_ctx = FlagContext::from_mwalib(&corr_ctx);
assert!(!flag_ctx.antenna_flags[0]);
assert!(flag_ctx.antenna_flags[63]);
assert!(flag_ctx.coarse_chan_flags[0]);
assert!(!flag_ctx.coarse_chan_flags[23]);TODO:
- quack time
- flag side bandwidth
- auto flag centre
Sourcepub fn get_flagged_antenna_idxs(&self) -> Vec<usize>
pub fn get_flagged_antenna_idxs(&self) -> Vec<usize>
Get the mwalib antenna indices which are flagged
Sourcepub fn get_baseline_flags(&self, ant_pairs: &[(usize, usize)]) -> Vec<bool>
pub fn get_baseline_flags(&self, ant_pairs: &[(usize, usize)]) -> Vec<bool>
Produce a vector of flags for baslines where either antenna is flagged in antenna_flags
or if autos is true and it is an autocorrelation.
Sourcepub fn finalise_flag_settings(&mut self, corr_ctx: &CorrelatorContext)
pub fn finalise_flag_settings(&mut self, corr_ctx: &CorrelatorContext)
Apply timestep flags from flag_init and flag_end
Default values for these are inferred from metadata, but may be overridden by command line arguments, so we apply the flags only after both have been considered.
TODO: move DC flagging and other flags that combine contextual defaults and command line arguments here.
Trait Implementations§
Source§impl Debug for FlagContext
impl Debug for FlagContext
Source§impl Default for FlagContext
impl Default for FlagContext
Source§fn default() -> FlagContext
fn default() -> FlagContext
Auto Trait Implementations§
impl Freeze for FlagContext
impl RefUnwindSafe for FlagContext
impl Send for FlagContext
impl Sync for FlagContext
impl Unpin for FlagContext
impl UnwindSafe for FlagContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more