Skip to content

Commit

Permalink
Fixes #58. rf_input.vcs_order now returns input if input is >255
Browse files Browse the repository at this point in the history
  • Loading branch information
gsleap committed Jun 16, 2023
1 parent 53b5978 commit b90b8bf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Changes in each release are listed below.

## 0.16.3 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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mwalib"
version = "0.16.3"
version = "0.16.4"
homepage = "https://github.com/MWATelescope/mwalib"
repository = "https://github.com/MWATelescope/mwalib"
readme = "README.md"
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 b90b8bf

Please sign in to comment.