Skip to main content

Curve

Struct Curve 

Source
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_db come from the extended CSVs.
  • min_phase, excess_phase, excess_delay_ms are 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

Source

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.

Source

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.

Source

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.

Source

pub fn validate(&self, context: &str) -> Result<(), AutoeqError>

Validate the core and optional arrays of a measurement curve.

Source

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):

  • phase is None
  • freq, spl, and phase do not all share the same length

The decomposition steps are:

  1. Unwrap the measured phase to remove ±180° discontinuities.
  2. Reconstruct minimum phase from magnitude via Hilbert transform of ln|H| (Hilbert-on-log-magnitude). Result is in degrees.
  3. excess_phase = unwrapped_measured − min_phase (degrees).
  4. Fit a linear slope −2πfτ to the excess phase via ordinary least-squares to yield excess_delay_ms = τ × 1000.

Phase values are in degrees throughout, matching Curve::phase.

Trait Implementations§

Source§

impl Clone for Curve

Source§

fn clone(&self) -> Curve

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Curve

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Curve

Source§

fn default() -> Curve

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Curve

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Curve, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Curve

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> MaybeParallel for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more