Skip to content

Commit

Permalink
Merge pull request #61 from SpookyYomo/docs
Browse files Browse the repository at this point in the history
Documentation fixes
  • Loading branch information
trueb2 authored Jan 13, 2025
2 parents bdeaf1d + 6727a65 commit 711a178
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 30 deletions.
1 change: 1 addition & 0 deletions sci-rs/src/signal/convolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ mod tests {
}

#[test]
#[cfg(feature = "plot")]
fn test_scipy_example() {
use rand::distributions::{Distribution, Standard};
use rand::thread_rng;
Expand Down
6 changes: 3 additions & 3 deletions sci-rs/src/signal/filter/design/bilinear_zpk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ 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
/// -----
/// .. versionadded:: 1.1.0
///
/// Examples
/// --------
/// ```ignore
/// ```custom,{class=language-python}
/// >>> from scipy import signal
/// >>> import matplotlib.pyplot as plt
///
Expand Down
3 changes: 1 addition & 2 deletions sci-rs/src/signal/filter/design/cplx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ use super::{
/// --------
/// _cplxpair
/// """
#[cfg(feature = "alloc")]
pub fn cplxreal_dyn<F>(z: Vec<Complex<F>>, tol: Option<F>) -> (Vec<Complex<F>>, Vec<Complex<F>>)
where
Expand Down Expand Up @@ -84,7 +83,7 @@ where
let mut zp: Vec<Complex<F>> = zc.iter().filter(|zi| zi.im > F::zero()).cloned().collect();
let mut zn: Vec<Complex<F>> = 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
Expand Down
1 change: 0 additions & 1 deletion sci-rs/src/signal/filter/design/iirfilter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(
order: usize,
wn: Vec<F>,
Expand Down
1 change: 0 additions & 1 deletion sci-rs/src/signal/filter/design/lp2bp_zpk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ use alloc::vec::Vec;
/// .. versionadded:: 1.1.0
///
/// """
#[cfg(feature = "alloc")]
pub fn lp2bp_zpk_dyn<F>(zpk: ZpkFormatFilter<F>, wo: Option<F>, bw: Option<F>) -> ZpkFormatFilter<F>
where
Expand Down
2 changes: 1 addition & 1 deletion sci-rs/src/signal/filter/design/lp2hp_zpk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(zpk: ZpkFormatFilter<F>, wo: Option<F>) -> ZpkFormatFilter<F>
where
Expand Down
27 changes: 15 additions & 12 deletions sci-rs/src/signal/filter/design/lp2lp_zpk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(zpk: ZpkFormatFilter<F>, wo: Option<F>) -> ZpkFormatFilter<F>
where
Expand Down
1 change: 0 additions & 1 deletion sci-rs/src/signal/filter/design/zpk2sos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ enum WhichNearestComplex {
/// specification.
///
///
#[cfg(feature = "alloc")]
pub fn zpk2sos_dyn<F>(
order: usize,
Expand Down
11 changes: 5 additions & 6 deletions sci-rs/src/signal/filter/sosfilt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ fn _sosfilt_isize_32<I: Copy + Into<isize>>(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
Expand All @@ -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<isize>` 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<isize> 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
Expand Down
2 changes: 1 addition & 1 deletion sci-rs/src/signal/wave/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions sci-rs/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down

0 comments on commit 711a178

Please sign in to comment.