diff --git a/sci-rs/src/signal/convolve.rs b/sci-rs/src/signal/convolve.rs index ab925e8..b527805 100644 --- a/sci-rs/src/signal/convolve.rs +++ b/sci-rs/src/signal/convolve.rs @@ -171,6 +171,7 @@ mod tests { } #[test] + #[cfg(feature = "plot")] fn test_scipy_example() { use rand::distributions::{Distribution, Standard}; use rand::thread_rng; diff --git a/sci-rs/src/signal/filter/design/bilinear_zpk.rs b/sci-rs/src/signal/filter/design/bilinear_zpk.rs index f864702..103809b 100644 --- a/sci-rs/src/signal/filter/design/bilinear_zpk.rs +++ b/sci-rs/src/signal/filter/design/bilinear_zpk.rs @@ -39,8 +39,8 @@ use super::{ /// /// See Also /// -------- -/// lp2lp_zpk, lp2hp_zpk, lp2bp_zpk, lp2bs_zpk -/// bilinear +/// [lp2lp_zpk](super::lp2lp_zpk_dyn), [lp2hp_zpk](super::lp2hp_zpk_dyn), +/// [lp2bp_zpk](super::lp2bp_zpk_dyn), [lp2bs_zpk](super::lp2bs_zpk_dyn), bilinear /// /// Notes /// ----- @@ -48,7 +48,7 @@ use super::{ /// /// Examples /// -------- -/// ```ignore +/// ```custom,{class=language-python} /// >>> from scipy import signal /// >>> import matplotlib.pyplot as plt /// diff --git a/sci-rs/src/signal/filter/design/cplx.rs b/sci-rs/src/signal/filter/design/cplx.rs index 00a2e57..e1ffaf4 100644 --- a/sci-rs/src/signal/filter/design/cplx.rs +++ b/sci-rs/src/signal/filter/design/cplx.rs @@ -50,7 +50,6 @@ use super::{ /// -------- /// _cplxpair /// """ - #[cfg(feature = "alloc")] pub fn cplxreal_dyn(z: Vec>, tol: Option) -> (Vec>, Vec>) where @@ -84,7 +83,7 @@ where let mut zp: Vec> = zc.iter().filter(|zi| zi.im > F::zero()).cloned().collect(); let mut zn: Vec> = zc.iter().filter(|zi| zi.im < F::zero()).cloned().collect(); if zp.len() != zn.len() { - panic!("Array contains complex value with no matchin conjugate"); + panic!("Array contains complex value with no matching conjugate"); } // Find runs of (approximately) the same real part diff --git a/sci-rs/src/signal/filter/design/iirfilter.rs b/sci-rs/src/signal/filter/design/iirfilter.rs index 4bf84c8..b4caae4 100644 --- a/sci-rs/src/signal/filter/design/iirfilter.rs +++ b/sci-rs/src/signal/filter/design/iirfilter.rs @@ -42,7 +42,6 @@ use alloc::vec::Vec; /// #[allow(clippy::too_many_arguments)] #[cfg(feature = "alloc")] -#[allow(clippy::too_many_arguments)] pub fn iirfilter_dyn( order: usize, wn: Vec, diff --git a/sci-rs/src/signal/filter/design/lp2bp_zpk.rs b/sci-rs/src/signal/filter/design/lp2bp_zpk.rs index 594ba82..35b9b66 100644 --- a/sci-rs/src/signal/filter/design/lp2bp_zpk.rs +++ b/sci-rs/src/signal/filter/design/lp2bp_zpk.rs @@ -59,7 +59,6 @@ use alloc::vec::Vec; /// .. versionadded:: 1.1.0 /// /// """ - #[cfg(feature = "alloc")] pub fn lp2bp_zpk_dyn(zpk: ZpkFormatFilter, wo: Option, bw: Option) -> ZpkFormatFilter where diff --git a/sci-rs/src/signal/filter/design/lp2hp_zpk.rs b/sci-rs/src/signal/filter/design/lp2hp_zpk.rs index 695297b..e49d60d 100644 --- a/sci-rs/src/signal/filter/design/lp2hp_zpk.rs +++ b/sci-rs/src/signal/filter/design/lp2hp_zpk.rs @@ -66,7 +66,7 @@ use alloc::vec::Vec; ///>>> plt.semilogx() ///>>> plt.grid(True) ///>>> plt.xlabel('Frequency [rad/s]') -///>>> plt.ylabel('Magnitude [dB]') +///>>> plt.ylabel('Magnitude \[dB\]') ///>>> plt.legend() pub fn lp2hp_zpk_dyn(zpk: ZpkFormatFilter, wo: Option) -> ZpkFormatFilter where diff --git a/sci-rs/src/signal/filter/design/lp2lp_zpk.rs b/sci-rs/src/signal/filter/design/lp2lp_zpk.rs index 0875b29..ec9bf4a 100644 --- a/sci-rs/src/signal/filter/design/lp2lp_zpk.rs +++ b/sci-rs/src/signal/filter/design/lp2lp_zpk.rs @@ -15,35 +15,38 @@ use alloc::vec::Vec; /// Return an analog low-pass filter with cutoff frequency `wo` /// from an analog low-pass filter prototype with unity cutoff frequency, /// using zeros, poles, and gain ('zpk') representation. +/// /// Parameters /// ---------- -/// z : array_like +/// * z : array_like /// Zeros of the analog filter transfer function. -/// p : array_like +/// * p : array_like /// Poles of the analog filter transfer function. -/// k : float +/// * k : float /// System gain of the analog filter transfer function. -/// wo : float +/// * wo : float /// Desired cutoff, as angular frequency (e.g., rad/s). /// Defaults to no change. +/// /// Returns /// ------- -/// z : ndarray +/// * z : ndarray /// Zeros of the transformed low-pass filter transfer function. -/// p : ndarray +/// * p : ndarray /// Poles of the transformed low-pass filter transfer function. -/// k : float +/// * k : float /// System gain of the transformed low-pass filter. +/// /// See Also /// -------- -/// lp2hp_zpk, lp2bp_zpk, lp2bs_zpk, bilinear -/// lp2lp +/// [lp2lp_zpk](super::lp2lp_zpk_dyn), [lp2hp_zpk](super::lp2hp_zpk_dyn), +/// [lp2bp_zpk](super::lp2bp_zpk_dyn), [lp2bs_zpk](super::lp2bs_zpk_dyn), bilinear +/// /// Notes /// ----- -/// This is derived from the s-plane substitution -/// .. math:: s \rightarrow \frac{s}{\omega_0} +/// This is derived from the s-plane substitution +/// .. math:: s \rightarrow \frac{s}{\omega_0} /// .. versionadded:: 1.1.0 - #[cfg(feature = "alloc")] pub fn lp2lp_zpk_dyn(zpk: ZpkFormatFilter, wo: Option) -> ZpkFormatFilter where diff --git a/sci-rs/src/signal/filter/design/zpk2sos.rs b/sci-rs/src/signal/filter/design/zpk2sos.rs index ae33388..6535170 100644 --- a/sci-rs/src/signal/filter/design/zpk2sos.rs +++ b/sci-rs/src/signal/filter/design/zpk2sos.rs @@ -45,7 +45,6 @@ enum WhichNearestComplex { /// specification. /// /// - #[cfg(feature = "alloc")] pub fn zpk2sos_dyn( order: usize, diff --git a/sci-rs/src/signal/filter/sosfilt.rs b/sci-rs/src/signal/filter/sosfilt.rs index 9e5b69b..597b426 100644 --- a/sci-rs/src/signal/filter/sosfilt.rs +++ b/sci-rs/src/signal/filter/sosfilt.rs @@ -412,7 +412,7 @@ fn _sosfilt_isize_32>(y: &[I], sos: &mut [Sos32], z: &mut /// /// A specialized cascaded Biquad filter for 32-bit floating point samples /// -/// Including acceleratored +/// Including accelerated /// * Single-sided 4th and 8th order filters /// * Example: 4th or 8th order lowpass Butterworth /// * Double-sided 4th order filters are accelerated @@ -422,12 +422,11 @@ pub fn sosfilt_fast32_st(y: &[f32], sos: &mut [Sos32], z: &mut [f32]) { _sosfilt32(y, sos, z); } +/// A specialized cascaded Biquad filter for signed samples filtered as 32-bit floating point +/// samples. Samples implement `Into` to convert to a signed integer for speed on native +/// bitwidths. /// -/// A specialized cascaded Biquad filter for signed samples -/// filtered as 32-bit floating point samples. Samples implement -/// Into to convert to a signed integer for speed on native bitwidths. -/// -/// Including acceleratored +/// Including accelerated /// * Single-sided 4th and 8th order filters /// * Example: 4th or 8th order lowpass Butterworth /// * Double-sided 4th order filters are accelerated diff --git a/sci-rs/src/signal/wave/mod.rs b/sci-rs/src/signal/wave/mod.rs index 67e00e7..0e67155 100644 --- a/sci-rs/src/signal/wave/mod.rs +++ b/sci-rs/src/signal/wave/mod.rs @@ -6,7 +6,7 @@ use ndarray::{Array, ArrayBase, Data, Dimension, RawData}; /// /// The square wave has a period ``2*pi``, has value +1 from 0 to /// ``2*pi*duty`` and -1 from ``2*pi*duty`` to ``2*pi``. `duty` must be in -/// the interval [0,1]. +/// the interval \[0,1\]. /// /// Note that this is not band-limited. It produces an infinite number /// of harmonics, which are aliased back and forth across the frequency diff --git a/sci-rs/src/stats.rs b/sci-rs/src/stats.rs index 79cc737..06cb0c0 100644 --- a/sci-rs/src/stats.rs +++ b/sci-rs/src/stats.rs @@ -428,8 +428,9 @@ where y.map(move |yi| ((*yi.borrow() - median) * F::from(0.6745).unwrap() / mad)) } -/// The median absolute deviation (MAD, [1]) computes the median over the absolute deviations from the median. -/// It is a measure of dispersion similar to the standard deviation but more robust to outliers +/// The median absolute deviation ([MAD](https://en.wikipedia.org/wiki/Median_absolute_deviation)) +/// computes the median over the absolute deviations from the median. It is a measure of dispersion +/// similar to the standard deviation but more robust to outliers /// /// # Arguments ///