pub struct Curve {
pub freq: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
pub spl: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
pub phase: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>,
pub coherence: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>,
pub noise_floor_db: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>,
pub min_phase: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>,
pub excess_phase: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>,
pub excess_delay_ms: Option<f64>,
}Expand description
A struct to hold frequency and SPL data. Re-exported from the main autoeq crate for compatibility.
Optional fields added for GD-Opt v2 (§2.3 of
docs/gd_opt_v2_plan.md):
coherence,noise_floor_dbcome from the extended CSVs.min_phase,excess_phase,excess_delay_msare derived at load time and cached; never persisted.
Construct curves with struct-update syntax — the Default impl
sets every optional field to None:
let freq = Array1::from_vec(vec![20.0, 200.0, 2000.0]);
let spl = Array1::from_vec(vec![0.0, 0.0, 0.0]);
let curve = Curve { freq, spl, ..Default::default() };Fields§
§freq: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>Frequency points in Hz
spl: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>Sound Pressure Level in dB
phase: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>Phase in degrees (optional)
coherence: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>Magnitude-squared coherence γ²(f) from the multi-sweep average.
Persisted to CSV as coherence; consumed by the GD confidence
gate and the optimiser objective weight in GD-Opt v2.
noise_floor_db: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>Per-bin noise-floor estimate in dB, derived from the
pre-silence window. Persisted to CSV as noise_floor_db.
min_phase: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>Minimum-phase component in degrees. Recomputed at load time via Hilbert-on-log-magnitude; never persisted.
excess_phase: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>Excess-phase residual in degrees after removing the minimum-phase component and the linear-delay term. Never persisted.
excess_delay_ms: Option<f64>Linear-delay term extracted during decomposition, in milliseconds. Never persisted.
Implementations§
Source§impl Curve
impl Curve
Sourcepub fn canonical_content_bytes(&self) -> Result<Vec<u8>, AutoeqError>
pub fn canonical_content_bytes(&self) -> Result<Vec<u8>, AutoeqError>
Return the versioned canonical byte representation used for content identity. Derived cache fields are deliberately excluded: they are implementation details which are recomputed when a measurement loads.
Sourcepub fn content_hash(&self) -> Result<String, AutoeqError>
pub fn content_hash(&self) -> Result<String, AutoeqError>
SHA-256 fingerprint of the persisted numerical measurement content.
-0.0 is canonicalised to 0.0, while invalid/non-finite values are
rejected by Self::validate before hashing.
Sourcepub fn validate_frequency_grid(
freq: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
context: &str,
) -> Result<(), AutoeqError>
pub fn validate_frequency_grid( freq: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, context: &str, ) -> Result<(), AutoeqError>
Validate a frequency grid used by public DSP and optimization APIs.
Sourcepub fn validate(&self, context: &str) -> Result<(), AutoeqError>
pub fn validate(&self, context: &str) -> Result<(), AutoeqError>
Validate the core and optional arrays of a measurement curve.
Sourcepub fn decompose_into_cache(&mut self)
pub fn decompose_into_cache(&mut self)
Populate min_phase, excess_phase, and excess_delay_ms from the
measured magnitude + phase via Hilbert-on-log-magnitude decomposition
(§2.3 of docs/gd_opt_v2_plan.md).
Idempotent: repeated calls are no-ops after the first success.
No-op guards (all three cache fields stay None):
phaseisNonefreq,spl, andphasedo not all share the same length
The decomposition steps are:
- Unwrap the measured phase to remove ±180° discontinuities.
- Reconstruct minimum phase from magnitude via Hilbert transform of
ln|H|(Hilbert-on-log-magnitude). Result is in degrees. excess_phase = unwrapped_measured − min_phase(degrees).- Fit a linear slope
−2πfτto the excess phase via ordinary least-squares to yieldexcess_delay_ms = τ × 1000.
Phase values are in degrees throughout, matching Curve::phase.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Curve
impl<'de> Deserialize<'de> for Curve
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Curve, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Curve, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Curve
impl Serialize for Curve
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Curve
impl RefUnwindSafe for Curve
impl Send for Curve
impl Sync for Curve
impl Unpin for Curve
impl UnsafeUnpin for Curve
impl UnwindSafe for Curve
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeParallel for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.