-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add observed nucleus, spectrometer frequency and reference compound fields. These are not needed for initialization, so they will take on default values at first. - Add methods to access and mutate these values - Observed nucleus and spectrometer frequency have no effect on the data and only serve as additional information - Reference compound is used to shift the x values - Update serialization, and python bindings and type hints - Add parsing/mutation of these values to Bruker and JCAMP-DX implementations with tests - Update Nucleus, ReferencingMethod and ReferenceCompound - Update tests
- Loading branch information
1 parent
cbe1667
commit c84cee4
Showing
12 changed files
with
572 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,43 @@ | ||
/// Test utility macro to check if the simulated spectrum was read correctly. | ||
#[macro_export] | ||
#[cfg(test)] | ||
macro_rules! check_sim_spectrum { | ||
($spectrum:expr) => { | ||
assert_eq!($spectrum.chemical_shifts().len(), 2048); | ||
assert_eq!($spectrum.intensities().len(), 2048); | ||
assert_approx_eq!( | ||
f64, | ||
$spectrum.signal_boundaries().0, | ||
3.339007, | ||
epsilon = $crate::CHECK_PRECISION | ||
f64::min( | ||
$spectrum.signal_boundaries().0, | ||
$spectrum.signal_boundaries().1 | ||
), | ||
3.339007 | ||
); | ||
assert_approx_eq!( | ||
f64, | ||
$spectrum.signal_boundaries().1, | ||
3.553942, | ||
epsilon = $crate::CHECK_PRECISION | ||
f64::max( | ||
$spectrum.signal_boundaries().0, | ||
$spectrum.signal_boundaries().1 | ||
), | ||
3.553942 | ||
); | ||
assert_eq!( | ||
$spectrum.nucleus(), | ||
$crate::spectrum::meta::Nucleus::Hydrogen1 | ||
); | ||
assert_approx_eq!(f64, $spectrum.frequency(), 600.252806949999695); | ||
assert_approx_eq!( | ||
f64, | ||
$spectrum.reference_compound().chemical_shift(), | ||
$spectrum.chemical_shifts()[0] | ||
); | ||
assert_eq!($spectrum.reference_compound().index(), 0); | ||
assert_eq!($spectrum.reference_compound().name(), None); | ||
assert_eq!( | ||
$spectrum | ||
.reference_compound() | ||
.referencing_method(), | ||
None | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.