Skip to content

Commit

Permalink
Merge branch 'master' into mwax_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gsleap committed Aug 21, 2023
2 parents 7c5b9ab + db2f797 commit 14ed878
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Changes in each release are listed below.
* MetafitsContext now supports: DR_FLAG and DR_PARAM from metafits. `deripple_applied`is a boolean and `dreipple_param` is a String. If deripple is true then a deripple has been applied to each coarse channel to smooth the passband.
* Weights (packet occupancy) is now available via the CorrelatorContext struct method `read_weights_by_baseline()` and `read_weights_by_baseline_into_buffer()`.

## 0.16.4 16-Jun-2023

* Modified rf_input.vcs_order to return `input` if `input` is > 255

## 0.16.3 09-Jun-2023

* Removed dependence on clap 3 via cbindgen
Expand Down
9 changes: 7 additions & 2 deletions src/rfinput/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ mod test;

/// VCS_ORDER is the order that comes out of PFB and into the correlator (for legacy observations)
/// It can be calculated, so we do that, rather than make the user get a newer metafits (only metafits after mid 2018
/// have this column pre populated).
/// have this column pre populated). The VCS_ORDER since it relates to the 256 input PFB has no value for inputs >255.
/// Therefore we simply return `input` if `input` is > 255
///
///
/// # Arguments
Expand All @@ -26,7 +27,11 @@ mod test;
/// * The PFB order - in other MWA code this is a hardcoded array but we prefer to calculate it.
///
fn get_vcs_order(input: u32) -> u32 {
(input & 0xC0) | ((input & 0x30) >> 4) | ((input & 0x0F) << 2)
if input < 256 {
(input & 0xC0) | ((input & 0x30) >> 4) | ((input & 0x0F) << 2)
} else {
input
}
}

/// mwax_order (aka subfile_order) is the order we want the antennas in, after conversion.
Expand Down
4 changes: 4 additions & 0 deletions src/rfinput/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ fn test_get_vcs_order() {
assert_eq!(194, get_vcs_order(224));
assert_eq!(251, get_vcs_order(254));
assert_eq!(255, get_vcs_order(255));
assert_eq!(256, get_vcs_order(256));
assert_eq!(271, get_vcs_order(271));
}

#[test]
Expand All @@ -33,6 +35,8 @@ fn test_get_mwax_order() {
assert_eq!(121, get_mwax_order(60, Pol::Y));
assert_eq!(254, get_mwax_order(127, Pol::X));
assert_eq!(255, get_mwax_order(127, Pol::Y));
assert_eq!(256, get_mwax_order(128, Pol::X));
assert_eq!(271, get_mwax_order(135, Pol::Y));
}

#[test]
Expand Down

0 comments on commit 14ed878

Please sign in to comment.