Struct HilbertSpectrumConfig
#[non_exhaustive]pub struct HilbertSpectrumConfig {
pub num_freq_bins: usize,
pub freq_range: (f64, f64),
pub log_freq: bool,
pub time_smoothing: Option<usize>,
pub mask_unreliable_phase: bool,
}Expand description
Configuration for hilbert_spectrum.
Constructed via HilbertSpectrumConfig::new (which requires the
frequency range, since it is data-dependent and has no universal default)
and chained with_* setters. The struct is #[non_exhaustive] so
struct-literal construction from outside the crate is blocked.
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.num_freq_bins: usizeNumber of frequency bins spanning freq_range. Must be ≥ 2.
Default 128.
freq_range: (f64, f64)(f_min, f_max) in Hz. Required; must satisfy
0 ≤ f_min < f_max ≤ sample_rate / 2, with f_min > 0 when
Self::log_freq is true.
log_freq: boolUse logarithmic bin spacing across freq_range. Default false.
time_smoothing: Option<usize>Optional conservative Gaussian time-smoothing σ in samples, applied per
freq bin after binning. None (default) leaves the density unsmoothed.
mask_unreliable_phase: boolMask samples whose instantaneous amplitude is below the per-IMF
noise floor 1e-6 · max_t |a_k(t)|. Default true. The phase of the
analytic signal becomes ill-conditioned as the envelope approaches
zero: tiny real/imaginary noise dominates arg, and the
central-difference instantaneous frequency derived from that phase
is garbage. Setting this false includes those samples; they
typically scatter energy into random bins.
Implementations§
§impl HilbertSpectrumConfig
impl HilbertSpectrumConfig
pub fn new(f_min: f64, f_max: f64) -> Self
pub fn new(f_min: f64, f_max: f64) -> Self
Create a config for a given (f_min, f_max) band in Hz. Other fields
take their documented defaults.
pub fn with_num_freq_bins(self, n: usize) -> Self
pub fn with_num_freq_bins(self, n: usize) -> Self
Override the number of frequency bins.
pub fn with_log_freq(self, yes: bool) -> Self
pub fn with_log_freq(self, yes: bool) -> Self
Toggle logarithmic frequency-bin spacing.
pub fn with_time_smoothing(self, sigma: Option<usize>) -> Self
pub fn with_time_smoothing(self, sigma: Option<usize>) -> Self
Set the time-smoothing σ in samples. Pass None to disable.
pub fn with_mask_unreliable_phase(self, yes: bool) -> Self
pub fn with_mask_unreliable_phase(self, yes: bool) -> Self
Toggle the amplitude noise-floor mask.
Trait Implementations§
§impl Clone for HilbertSpectrumConfig
impl Clone for HilbertSpectrumConfig
§fn clone(&self) -> HilbertSpectrumConfig
fn clone(&self) -> HilbertSpectrumConfig
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HilbertSpectrumConfig
impl RefUnwindSafe for HilbertSpectrumConfig
impl Send for HilbertSpectrumConfig
impl Sync for HilbertSpectrumConfig
impl Unpin for HilbertSpectrumConfig
impl UnwindSafe for HilbertSpectrumConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§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.