Skip to content

Commit

Permalink
fix calc_part_uvws for ant-sel, run ant-sel tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Jun 25, 2024
1 parent d96231e commit 180817b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 6 additions & 8 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2159,18 +2159,16 @@ mod tests {
gpufits_paths[1],
];

let BirliContext {
vis_sel,
// corr_ctx,
..
} = BirliContext::from_args(&args).unwrap();
let birli_ctx = BirliContext::from_args(&args).unwrap();

// check baseline_idxs is the correct size
assert_eq!(vis_sel.baseline_idxs.len(), 10);
assert_eq!(&birli_ctx.vis_sel.baseline_idxs.len(), &10);
assert_eq!(
vis_sel.baseline_idxs,
[128, 129, 130, 131, 255, 256, 257, 381, 382, 506]
&birli_ctx.vis_sel.baseline_idxs,
&[128, 129, 130, 131, 255, 256, 257, 381, 382, 506]
);

birli_ctx.run().unwrap();
}

/// Test `--sel-ants` handles invalid antenna idxs
Expand Down
6 changes: 2 additions & 4 deletions src/corrections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ pub fn correct_geometry(
.collect::<Vec<_>>();
let dut1 = Duration::from_seconds(corr_ctx.metafits_context.dut1.unwrap_or(0.0));
let part_uvws = calc_part_uvws(
&ant_pairs,
&centroid_timestamps,
dut1,
phase_centre,
Expand Down Expand Up @@ -652,15 +651,14 @@ pub fn scrunch_gains(
// UVWs are in units of meters. To get the UVWs in units of wavelengths, divide by the wavelength.
// uvw at ts, (ant1, ant2) = part_uvw[ant1] - part_uvw[ant2]
fn calc_part_uvws(
ant_pairs: &[(usize, usize)],
centroid_timestamps: &[Epoch],
dut1: Duration,
phase_centre: RADec,
array_pos: LatLngHeight,
tile_xyzs: &[XyzGeodetic],
) -> Array2<UVW> {
let max_ant = ant_pairs.iter().map(|&(a, b)| a.max(b)).max().unwrap();
let mut part_uvws = Array2::from_elem((centroid_timestamps.len(), max_ant + 1), UVW::default());
let nants = tile_xyzs.len();
let mut part_uvws = Array2::from_elem((centroid_timestamps.len(), nants), UVW::default());
for (t, &epoch) in centroid_timestamps.iter().enumerate() {
let prec = precess_time(
array_pos.longitude_rad,
Expand Down

0 comments on commit 180817b

Please sign in to comment.