SSWTConfig

Struct SSWTConfig 

#[non_exhaustive]
pub struct SSWTConfig { pub wavelet: Box<dyn ContinuousWavelet>, pub scales: Vec<f64>, pub sampling_freq: f64, pub num_freq_bins: usize, pub freq_range: (f64, f64), pub gamma: Option<f64>, pub log_freq_bins: bool, }
Expand description

Configuration for sswt.

Not Clone. Box<dyn ContinuousWavelet> cannot be cloned through the trait (there is no clone_box method), and the crate does not depend on the dyn-clone crate. Construct configs fresh per call when you need a fresh instance. The issue #35 spec showed a Clone derive on the config; the math doesn’t change but the API does.

No serde. Box<dyn ContinuousWavelet> cannot be deserialized via a derive (no default function, no type registry). SSWTResult and GreedyRidgeConfig do derive serde under the serde feature.

Debug is implemented manually because ContinuousWavelet does not require Debug as a supertrait, so a derived Debug impl could not print the wavelet field. The manual impl elides it as a placeholder.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§wavelet: Box<dyn ContinuousWavelet>

Wavelet used for the underlying CWT. Owned so the config carries itself across function boundaries.

Must be complex/analytic. SST extracts instantaneous frequency from CWT phase; a real-valued wavelet (e.g. super::cwt::MexicanHat) has CWT coefficients pinned to phase {0, π} and produces a meaningless IF. sswt rejects such wavelets up front via super::cwt::ContinuousWavelet::is_complex. Use super::cwt::Morlet, super::complex_wavelets::ComplexMorlet, super::complex_wavelets::ComplexPaul, or super::complex_wavelets::ComplexMexicanHat.

§scales: Vec<f64>

Scales a > 0 passed to crate::transform::cwt_fft. Must be finite, positive, and non-empty. Best results come from log-spaced scales covering the expected component bandwidths.

§sampling_freq: f64

Sampling frequency in Hz (matches cwt_fft’s sampling_freq).

§num_freq_bins: usize

Number of output frequency bins. Must be >= 2. Default 256.

§freq_range: (f64, f64)

(f_min, f_max) of the output frequency grid in Hz. Must satisfy 0 < f_min < f_max when Self::log_freq_bins is true, or 0 <= f_min < f_max when it is false.

§gamma: Option<f64>

Hard threshold below which |W(a, b)| is treated as noise and the corresponding cell is excluded from reassignment. None resolves to 1e-6 · ‖x‖₂ at call time, where ‖x‖₂ is the input signal’s L2 norm; see SSWTResult::gamma_used.

§log_freq_bins: bool

true for logarithmic frequency spacing (the Daubechies-Lu-Wu recommendation; better resolution at low frequencies where most AM-FM components sit), false for linear spacing.

Implementations§

§

impl SSWTConfig

pub fn with_wavelet(self, wavelet: Box<dyn ContinuousWavelet>) -> Self

Set the wavelet used for the underlying CWT.

pub fn with_scales(self, scales: Vec<f64>) -> Self

Set the scales (a > 0) passed to crate::transform::cwt_fft.

pub fn with_sampling_freq(self, fs: f64) -> Self

Set the sampling frequency (Hz).

pub fn with_num_freq_bins(self, n: usize) -> Self

Set the number of output frequency bins.

pub fn with_freq_range(self, range: (f64, f64)) -> Self

Set the (f_min, f_max) output frequency range (Hz).

pub fn with_gamma(self, gamma: Option<f64>) -> Self

Set the magnitude threshold below which ω̂ is treated as unreliable (and the cell skipped). None resolves to 1e-6 · ‖x‖₂.

pub fn with_log_freq_bins(self, log: bool) -> Self

Toggle log vs linear frequency-bin spacing.

Trait Implementations§

§

impl Debug for SSWTConfig

§

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

Formats the value using the given formatter. Read more
§

impl Default for SSWTConfig

§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> IntoEither for T

§

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
§

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

§

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

§

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

§

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