FlagContext

Struct FlagContext 

Source
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: bool

Whether auto-correlations are flagged

§flag_dc: bool

Whether DC (centre) fine channel indices are flagged

§flag_init: f32

How many seconds to flag from the start of the observation

§flag_end: f32

How many seconds to flag from the end of the observation

Implementations§

Source§

impl FlagContext

Source

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

Source

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
Source

pub fn get_flagged_antenna_idxs(&self) -> Vec<usize>

Get the mwalib antenna indices which are flagged

Source

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.

Source

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.

Source

pub fn set_flags( &self, flag_array: ArrayViewMut3<'_, bool>, timestep_range: &Range<usize>, coarse_chan_range: &Range<usize>, ant_pairs: &[(usize, usize)], ) -> Result<(), BirliError>

Set flags from this context in an existing array.

§Errors

Can throw error if array is not the correct shape.

Trait Implementations§

Source§

impl Debug for FlagContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FlagContext

Source§

fn default() -> FlagContext

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.