pub fn correct_geometry(
    corr_ctx: &CorrelatorContext,
    jones_array: ArrayViewMut3<'_, Jones<f32>>,
    timestep_range: &Range<usize>,
    coarse_chan_range: &Range<usize>,
    array_pos: Option<LatLngHeight>,
    phase_centre: Option<RADec>,
    draw_progress: bool
)
Expand description

Perform geometric corrections, given an observation’s mwalib::CorrelatorContext and an ndarray::Array3 of marlu::Jones visibilities

Complex visibilities are phase-shifted by an angle determined by the length of the w-coordinate for the baseline and the channel’s frequency.

Accuracy

Corrections are performed in double precision, which is more accurate than Cotter.

Examples

use birli::{
    FlagContext, correct_geometry, mwalib::CorrelatorContext, VisSelection,
    correct_cable_lengths, io::read_mwalib
};

// 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",
];

// 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 mut vis_sel = VisSelection::from_mwalib(&corr_ctx).unwrap();

let sel_timestep_idxs = &corr_ctx.common_timestep_indices;
vis_sel.timestep_range =
    *sel_timestep_idxs.first().unwrap()..(*sel_timestep_idxs.last().unwrap() + 1);

// 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();
let mut jones_array = vis_sel.allocate_jones(fine_chans_per_coarse).unwrap();

// read visibilities out of the gpubox files
read_mwalib(&vis_sel, &corr_ctx, jones_array.view_mut(), flag_array.view_mut(), false)
    .unwrap();

correct_cable_lengths(&corr_ctx, jones_array.view_mut(), &vis_sel.coarse_chan_range, false);

correct_geometry(
    &corr_ctx,
    jones_array.view_mut(),
    &vis_sel.timestep_range,
    &vis_sel.coarse_chan_range,
    None,
    None,
    false,
);