Skip to content

Commit

Permalink
add test for auto pfb
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v-null committed Jun 25, 2024
1 parent d527d90 commit 4b898b1
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,11 +1850,13 @@ impl<'a> BirliContext<'a> {
#[cfg(test)]
#[cfg(feature = "aoflagger")]
mod tests {
use approx::{assert_abs_diff_eq, assert_abs_diff_ne};
use tempfile::tempdir;

use crate::{
test_common::get_1254670392_avg_paths, test_common::get_mwax_data_paths, BirliContext,
VisSelection,
passband_gains::{PFB_COTTER_2014_10KHZ, PFB_JAKE_2022_200HZ},
test_common::{get_1254670392_avg_paths, get_mwax_data_paths},
BirliContext, VisSelection,
};

#[test]
Expand Down Expand Up @@ -1975,6 +1977,56 @@ mod tests {
assert!(flag_ctx.flag_dc);
}

/// pfb gains is cotter by default for legacy correlator.
#[test]
fn test_auto_pfb_legacy() {
let (metafits_path, gpufits_paths) = get_1254670392_avg_paths();

#[rustfmt::skip]
let args = vec![
"birli",
"-m", metafits_path,
"--no-draw-progress",
gpufits_paths[0],
gpufits_paths[1],
];

let BirliContext { prep_ctx, .. } = BirliContext::from_args(&args).unwrap();

assert!(prep_ctx.passband_gains.is_some());
assert_abs_diff_eq!(
prep_ctx.passband_gains.unwrap()[0],
PFB_COTTER_2014_10KHZ[0]
);
// santiy check
assert_abs_diff_ne!(prep_ctx.passband_gains.unwrap()[0], PFB_JAKE_2022_200HZ[0]);
}

/// pfb gains is jake by default for mwax correlator.
#[test]
fn test_auto_pfb_mwax() {
let (metafits_path, gpufits_paths) = get_mwax_data_paths();

#[rustfmt::skip]
let args = vec![
"birli",
"-m", metafits_path,
"--no-draw-progress",
gpufits_paths[0],
gpufits_paths[1],
];

let BirliContext { prep_ctx, .. } = BirliContext::from_args(&args).unwrap();

assert!(prep_ctx.passband_gains.is_some());
assert_abs_diff_eq!(prep_ctx.passband_gains.unwrap()[0], PFB_JAKE_2022_200HZ[0]);
// santiy check
assert_abs_diff_ne!(
prep_ctx.passband_gains.unwrap()[0],
PFB_COTTER_2014_10KHZ[0]
);
}

/// DC flagging is off by default for MWAX inputs.
#[test]
fn test_no_automatic_dc_flagging() {
Expand Down

0 comments on commit 4b898b1

Please sign in to comment.