Crate birli[−][src]
Expand description
Birli is a library of common preprocessing tasks performed in the data pipeline of the Murchison Widefield Array (MWA) Telescope.
Examples
Here’s an example of how to flag some visibility files
use birli::{ context_to_baseline_imgsets, flag_imgsets_existing, write_flags, cxx_aoflagger_new, get_flaggable_timesteps, init_baseline_flagmasks, get_antenna_flags }; use mwalib::CorrelatorContext; use tempfile::tempdir; // define our input files let metafits_path = "tests/data/1297526432_mwax/1297526432.metafits"; let gpufits_paths = vec![ "tests/data/1297526432_mwax/1297526432_20210216160014_ch117_000.fits", "tests/data/1297526432_mwax/1297526432_20210216160014_ch117_001.fits", "tests/data/1297526432_mwax/1297526432_20210216160014_ch118_000.fits", "tests/data/1297526432_mwax/1297526432_20210216160014_ch118_001.fits", ]; // define a temporary directory for output files let tmp_dir = tempdir().unwrap(); // define our output flag file template let flag_template = tmp_dir.path().join("Flagfile%%%.mwaf"); // Create an mwalib::CorrelatorContext for accessing visibilities. let context = CorrelatorContext::new(&metafits_path, &gpufits_paths).unwrap(); // create a CxxAOFlagger object to perform AOFlagger operations let aoflagger = unsafe { cxx_aoflagger_new() }; // Determine which timesteps and coarse channels we want to use let img_coarse_chan_idxs = &context.common_coarse_chan_indices; let img_timestep_idxs = get_flaggable_timesteps(&context).unwrap(); // Prepare our flagmasks with known bad antennae let mut baseline_flagmasks = init_baseline_flagmasks( &aoflagger, &context, &img_coarse_chan_idxs, &img_timestep_idxs, Some(get_antenna_flags(&context)), ); // generate imagesets for each baseline in the format required by aoflagger let baseline_imgsets = context_to_baseline_imgsets( &aoflagger, &context, &img_coarse_chan_idxs, &img_timestep_idxs, Some(&mut baseline_flagmasks), ); // use the default strategy file location for MWA let strategy_filename = &aoflagger.FindStrategyFileMWA(); // run the strategy on the imagesets, and get the resulting flagmasks for each baseline flag_imgsets_existing( &aoflagger, &strategy_filename, &baseline_imgsets, &mut baseline_flagmasks, true ); // write the flags to disk as .mwaf write_flags(&context, &baseline_flagmasks, flag_template.to_str().unwrap(), img_coarse_chan_idxs);
Details
Birli reads visibilities with MWALib
and uses CXX to bind to the AOFlagger
C++ library.
For more details about AOFlagger’s interface, check out the aoflagger::AOFlagger
documentation
Re-exports
pub use io::mwaf::FlagFileSet;
pub use io::uvfits::UvfitsWriter;
pub use corrections::correct_cable_lengths;
pub use flags::flag_imgsets;
pub use flags::flag_imgsets_existing;
pub use flags::get_antenna_flags;
pub use flags::get_flaggable_timesteps;
pub use flags::init_baseline_flagmasks;
pub use flags::write_flags;
Modules
Useful constants.
Corrections that can be performed on visibility data
Errors that can occur in Birli
Methods for manipulating flagmasks and flagging imagesets
Input and Ouput data file format modules
Positional coordinate types.
Utility functions
Structs
CXX Wrapper for aoflagger::AOFlagger
, the main class for access to the flagger functionality.
CXX Wrapper for aoflagger::FlagMask
, a two-dimensional mask of bool flags.
CXX Wrapper for aoflagger::ImageSet
, a set of time-frequency ‘images’ which
together contain data for one correlated baseline.
CXX Wrapper for aoflagger::Strategy
, a flagging strategy definition.
Functions
Read an observation’s visibilities for the provided coarse channel and timestep indices into a
vector containing a CxxImageSet
s for each baseline in the observation, given a
CxxAOFlagger
instance and that observation’s mwalib::CorrelatorContext
Create a new CxxAOFlagger
instance
Get the version of the AOFlagger library from the library itself.
Initialize a vector of length [num_baselines
] containing CxxImageSet
of dimensions
[width
] and [height
],