pub struct SpectralAnalysis;Expand description
Spectral processing and analysis utilities.
Implementations§
Source§impl SpectralAnalysis
impl SpectralAnalysis
Sourcepub fn find_peaks(
record: &SpectrumRecord,
window: usize,
threshold: f64,
) -> Vec<PeakResult>
pub fn find_peaks( record: &SpectrumRecord, window: usize, threshold: f64, ) -> Vec<PeakResult>
Find peaks in the Y array using a simple local-maximum criterion.
A point is a peak if it is strictly greater than its window neighbours
on each side and above the given threshold.
Sourcepub fn als_baseline(y: &[f64], lam: f64, p: f64, iterations: usize) -> Vec<f64>
pub fn als_baseline(y: &[f64], lam: f64, p: f64, iterations: usize) -> Vec<f64>
Asymmetric Least Squares (ALS) baseline correction.
Returns the corrected Y array (input Y minus estimated baseline).
§Parameters
y— input intensity array.lam— smoothing parameter (typically 1e4 – 1e7).p— asymmetry parameter (typically 0.001 – 0.1).iterations— number of ALS iterations (typically 10–30).
Sourcepub fn savitzky_golay(y: &[f64], window: SgWindow) -> Vec<f64>
pub fn savitzky_golay(y: &[f64], window: SgWindow) -> Vec<f64>
Savitzky-Golay smoothing filter applied to Y values.
Uses a 2nd-order polynomial over the given window. Returns the smoothed Y array (same length as input).
Sourcepub fn moving_average(y: &[f64], half_window: usize) -> Vec<f64>
pub fn moving_average(y: &[f64], half_window: usize) -> Vec<f64>
Simple moving-average smoothing.
The output at index i is the average of y[i-half..=i+half].
Boundary points are left unchanged.
Sourcepub fn derivative(record: &SpectrumRecord) -> Vec<f64>
pub fn derivative(record: &SpectrumRecord) -> Vec<f64>
Compute the first derivative of Y with respect to X using central differences.
Boundary points use one-sided differences.
Auto Trait Implementations§
impl Freeze for SpectralAnalysis
impl RefUnwindSafe for SpectralAnalysis
impl Send for SpectralAnalysis
impl Sync for SpectralAnalysis
impl Unpin for SpectralAnalysis
impl UnsafeUnpin for SpectralAnalysis
impl UnwindSafe for SpectralAnalysis
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.