From d695b31426a3525caea2d58de1fb2ce22f9a0673 Mon Sep 17 00:00:00 2001 From: "J.A. de Jong - Redu-Sone B.V., ASCEE V.O.F" Date: Wed, 10 Jul 2024 00:23:34 +0200 Subject: [PATCH] Coarsened checks in test_ap() again. Import complexfloat traits in config --- src/config.rs | 1 + src/ps/aps.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index c8d7efc..64dbd05 100644 --- a/src/config.rs +++ b/src/config.rs @@ -42,6 +42,7 @@ if #[cfg(feature = "python-bindings")] { use ndarray::OwnedRepr; use num::complex::Complex; +pub use num::complex::ComplexFloat; /// View into 1D array of floats pub type VdView<'a> = ArrayView1<'a, Flt>; diff --git a/src/ps/aps.rs b/src/ps/aps.rs index 427c3fb..0bc81d1 100644 --- a/src/ps/aps.rs +++ b/src/ps/aps.rs @@ -451,9 +451,9 @@ mod test { } #[test] fn test_ap() { - let nfft = 256; + let nfft = 1024; let distr = Normal::new(1.0, 1.0).unwrap(); - let timedata = Dmat::random((100 * nfft, 1), distr); + let timedata = Dmat::random((150 * nfft, 1), distr); let timedata_mean_square = (&timedata * &timedata).sum() / (timedata.len() as Flt); for wt in [ @@ -466,7 +466,7 @@ mod test { let mut aps = AvPowerSpectra::build(nfft, wt, None, None).unwrap(); if let ApsResult::OnlyLastResult(v) = aps.compute_last(&timedata) { let ap = v.ap(0); - assert_abs_diff_eq!((&ap).sum().abs(), timedata_mean_square, epsilon = 8e-3); + assert_abs_diff_eq!((&ap).sum().abs(), timedata_mean_square, epsilon = 1e-2); } else { assert!(false); }