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
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: f64Sampling frequency in Hz (matches cwt_fft’s sampling_freq).
num_freq_bins: usizeNumber 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: booltrue 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
impl SSWTConfig
pub fn with_wavelet(self, wavelet: Box<dyn ContinuousWavelet>) -> Self
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
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
pub fn with_sampling_freq(self, fs: f64) -> Self
Set the sampling frequency (Hz).
pub fn with_num_freq_bins(self, n: usize) -> Self
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
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
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
pub fn with_log_freq_bins(self, log: bool) -> Self
Toggle log vs linear frequency-bin spacing.
Trait Implementations§
§impl Debug for SSWTConfig
impl Debug for SSWTConfig
Auto Trait Implementations§
impl Freeze for SSWTConfig
impl !RefUnwindSafe for SSWTConfig
impl Send for SSWTConfig
impl Sync for SSWTConfig
impl Unpin for SSWTConfig
impl !UnwindSafe for SSWTConfig
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> IntoEither for T
impl<T> IntoEither for T
§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 more§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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.