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 26, 2024
1 parent 924013f commit 7686c9f
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,9 +1850,11 @@ 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::{
passband_gains::{PFB_COTTER_2014_10KHZ, PFB_JAKE_2022_200HZ},
test_common::{get_1254670392_avg_paths, get_mwax_data_paths},
BirliContext, BirliError, VisSelection,
};
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 7686c9f

Please sign in to comment.