Skip to content

Commit

Permalink
For C compatibility, changed CableDelaysApplied:No to CableDelaysAppl…
Browse files Browse the repository at this point in the history
…ied:NoCableDelaysApplied
  • Loading branch information
gsleap committed Apr 20, 2022
1 parent 51b1e3f commit d3d404b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/metafits_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl std::str::FromStr for GeometricDelaysApplied {
#[repr(C)]
#[derive(Debug, PartialEq, Clone, Copy, FromPrimitive)]
pub enum CableDelaysApplied {
No = 0,
NoCableDelaysApplied = 0,
CableAndRecClock = 1,
CableAndRecClockAndBeamformerDipoleDelays = 2,
}
Expand All @@ -179,7 +179,7 @@ impl fmt::Display for CableDelaysApplied {
f,
"{}",
match self {
CableDelaysApplied::No => "No",
CableDelaysApplied::NoCableDelaysApplied => "No",
CableDelaysApplied::CableAndRecClock => "Cable and receiver clock cable length",
CableDelaysApplied::CableAndRecClockAndBeamformerDipoleDelays =>
"Cable, receiver clock cable and pointing-dependent beamformer dipole delays",
Expand All @@ -193,7 +193,7 @@ impl std::str::FromStr for CableDelaysApplied {

fn from_str(input: &str) -> Result<CableDelaysApplied, Self::Err> {
match input {
"No" => Ok(CableDelaysApplied::No),
"No" => Ok(CableDelaysApplied::NoCableDelaysApplied),
"Cable and receiver clock cable length" => Ok(CableDelaysApplied::CableAndRecClock),
"Cable, receiver clock cable and pointing-dependent beamformer dipole delays" => {
Ok(CableDelaysApplied::CableAndRecClockAndBeamformerDipoleDelays)
Expand Down Expand Up @@ -740,7 +740,7 @@ impl MetafitsContext {
})
}
},
None => CableDelaysApplied::No,
None => CableDelaysApplied::NoCableDelaysApplied,
};

// This next key is specified as TINT not TBOOL in the metafits, so we need to translate 0=false, 1=true
Expand Down
5 changes: 4 additions & 1 deletion src/metafits_context/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ fn test_metafits_context_new_corrlegacy_valid() {
// Geometric delays - this old metafits has none of these keys so it will be No
assert_eq!(context.geometric_delays_applied, GeometricDelaysApplied::No);
// Cable delays applied - this old metafits has none of these keys so it will be No
assert_eq!(context.cable_delays_applied, CableDelaysApplied::No);
assert_eq!(
context.cable_delays_applied,
CableDelaysApplied::NoCableDelaysApplied
);

// Calibration delays & gains applied - this old metafits has none of these keys so it will be false
assert!(!context.calibration_delays_and_gains_applied);
Expand Down

0 comments on commit d3d404b

Please sign in to comment.