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, write_flags, cxx_aoflagger_new};
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() };

// generate imagesets for each baseline in the format required by aoflagger
let baseline_imgsets = context_to_baseline_imgsets(&aoflagger, &context);

// 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
let baseline_flagmasks = flag_imgsets(&aoflagger, &strategy_filename, baseline_imgsets);

// Get a list of all gpubox IDs
let gpubox_ids: Vec<usize> = context
            .coarse_chans
            .iter()
            .map(|chan| chan.gpubox_number)
            .collect();

// write the flags to disk as .mwaf
write_flags(&context, baseline_flagmasks, flag_template.to_str().unwrap(), &gpubox_ids);

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

Modules

error

Errors that can occur in Birli

flag_io

Items related to the reading and writing of the FITS-based MWA Flag file format.

Structs

CxxAOFlagger

CXX Wrapper for aoflagger::AOFlagger, the main class for access to the flagger functionality.

CxxFlagMask

CXX Wrapper for aoflagger::FlagMask, a two-dimensional mask of bool flags.

CxxImageSet

CXX Wrapper for aoflagger::ImageSet, a set of time-frequency ‘images’ which together contain data for one correlated baseline.

CxxStrategy

CXX Wrapper for aoflagger::Strategy, a flagging strategy definition.

Functions

context_to_baseline_imgsets

Read aan observation’s visibilities into a vector containing a CxxImageSets for each baseline in the observation, given a CxxAOFlagger instance and that observation’s mwalib::CorrelatorContext.

cxx_aoflagger_new

Create a new CxxAOFlagger instance

flag_imgsets

Flag an observation’s visibilities, given a CxxAOFlagger instance, a CxxStrategy filename, and a vector of CxxImageSets for each baseline in the observation returning a vector of CxxFlagMasks.

get_aoflagger_version_string

Get the version of the AOFlagger library from the library itself.

write_flags

Write flags to disk, given an observation’s mwalib::CorrelatorContext, a vector of CxxFlagMasks for each baseline in the observation, a filename template and a vector of gpubox IDs.