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::{
write_flags,
mwalib::CorrelatorContext, write_uvfits,
get_weight_factor, flag_to_weight_array,
FlagContext, VisSelection
};
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 paths
let flag_template = tmp_dir.path().join("Flagfile%%%.mwaf");
let uvfits_out = tmp_dir.path().join("1297526432.uvfits");
// Create an mwalib::CorrelatorContext for accessing visibilities.
let corr_ctx = CorrelatorContext::new(&metafits_path, &gpufits_paths).unwrap();
// Determine which timesteps and coarse channels we want to use
let vis_sel = VisSelection::from_mwalib(&corr_ctx).unwrap();
// Prepare our flagmasks with known bad antennae
let flag_ctx = FlagContext::from_mwalib(&corr_ctx);
// Create a blank array to store flags and visibilities
let fine_chans_per_coarse = corr_ctx.metafits_context.num_corr_fine_chans_per_coarse;
let mut flag_array = vis_sel.allocate_flags(fine_chans_per_coarse).unwrap();
flag_ctx.set_flags(
&mut flag_array,
&vis_sel.timestep_range,
&vis_sel.coarse_chan_range,
&vis_sel.get_ant_pairs(&corr_ctx.metafits_context)
);
let mut jones_array = vis_sel.allocate_jones(fine_chans_per_coarse).unwrap();
// read visibilities out of the gpubox files
vis_sel
.read_mwalib(&corr_ctx, jones_array.view_mut(), flag_array.view_mut(), false)
.unwrap();
// write the flags to disk as .mwaf
write_flags(&corr_ctx, &flag_array, flag_template.to_str().unwrap(), &vis_sel.coarse_chan_range).unwrap();
// write the visibilities to disk as .uvfits
let num_pols = corr_ctx.metafits_context.num_visibility_pols;
let weight_factor = get_weight_factor(&corr_ctx);
let weight_array = flag_to_weight_array(&flag_array.view(), weight_factor);
write_uvfits(
uvfits_out.as_path(),
&corr_ctx,
jones_array.view(),
weight_array.view(),
&vis_sel.timestep_range,
&vis_sel.coarse_chan_range,
&vis_sel.baseline_idxs,
None,
None,
1,
1,
false,
).unwrap();
Details
Birli reads visibilities with MWALib
and uses CXX to bind to the AOFlagger
C++ library.
For more details its interface, check out the aoflagger::AOFlagger
documentation
Re-exports
pub use io::mwaf::FlagFileSet;
pub use io::write_ms;
pub use io::write_uvfits;
pub use corrections::correct_cable_lengths;
pub use corrections::correct_geometry;
pub use corrections::ScrunchType;
pub use flags::flag_to_weight_array;
pub use flags::get_weight_factor;
pub use flags::write_flags;
pub use flags::FlagContext;
pub use marlu;
pub use marlu::mwalib;
pub use marlu::mwalib::fitsio;
pub use marlu::mwalib::fitsio_sys;
pub use marlu::ndarray;
pub use preprocessing::PreprocessContext;
pub use cli::BirliContext;
pub use flags::flag_jones_array;
pub use flags::flag_jones_array_existing;
Modules
Calibrating visibilities.
Command Line Interface helpers for Birli
Corrections that can be performed on visibility data
Methods for manipulating flagmasks and flagging imagesets
Input and Ouput data file format modules
Possible choices for polyphase filter bank gains for the MWA.
Crate for preprocessing visibilities
Macros
Parallelized array zip macro: lock step function application across several arrays and producers.
Time a statement and increment the timer given by name in the hashmap of durations
Structs
An axis index.
A complex number in Cartesian form.
mwalib
correlator observation context. This represents the basic metadata for a correlator observation.
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.
Binding to C++ std::unique_ptr<T, std::default_delete<T>>
.
Keep track of which mwalib indices the values in a jones array, its’ weights and its’ flags
came from. Similar to a VisSelection
, but requires an mwalib::CorrelatorContext
to be
fully interpreted
Enums
An enum of all the errors possible in Birli
Traits
An iterator that supports “random access” to its data, meaning that you can split it at arbitrary indices and draw data from those points.
IntoParallelIterator
implements the conversion to a ParallelIterator
.
IntoParallelRefIterator
implements the conversion to a
ParallelIterator
, providing shared references to the data.
IntoParallelRefMutIterator
implements the conversion to a
ParallelIterator
, providing mutable references to the data.
Parallel version of the standard iterator trait.
Functions
Create a new CxxAOFlagger
instance
Type Definitions
three-dimensional array