Math Functions
This module provides scalar implementations of common analytical filter functions used in Spectral Graph Signal Processing. These are useful for generating target functions for polynomial or rational approximations.
Low-Pass
High-Pass
Band-Pass
- bandpass(x, scale=1.0, order=1)[source]
Computes the spectral response of a band-pass filter.
This wavelet generating kernel is based on the SGWT design:
\[\Psi_s(\lambda) = \left( \frac{4\lambda/s}{(\lambda + 1/s)^2} \right)^n\]where \(n\) is the filter order. The filter peaks at \(\lambda = 1/s\) with maximum gain of 1, and satisfies the admissibility condition \(\Psi(0) = 0\).
- Parameters:
- Returns:
The filter’s gain at each point in x.
- Return type:
Gaussian Wavelet
- gaussian_wavelet(time, a=1, b=0, w0=1)[source]
Compute a Morlet-like Gaussian wavelet.
Generates a complex-valued wavelet with Gaussian envelope and oscillatory carrier, normalized for continuous wavelet transform applications.
The analytical form is:
\[\psi_{a,b}(t) = C e^{-\frac{(t')^2}{2}} \left( e^{i \omega_0 t'} - e^{-\frac{\omega_0^2}{2}} \right)\]where \(t' = (t-b)/a\) and the normalization constant is \(C = (\Delta t / a) \pi^{-1/4}\). The term \(e^{-\omega_0^2 / 2}\) ensures the wavelet has zero mean.
- Parameters:
time (
ndarray) – Time vector of shape(n_time,)in seconds. Must have at least 2 elements for timestep inference.a (
float, default1) – Scale parameter (temporal dilation). Larger values produce wider wavelets centered on lower frequencies.b (
float, default0) – Translation parameter (center time in seconds).w0 (
float, default1) – Central angular frequency in rad/s. Default of2*np.pigives 1 Hz center frequency.
- Returns:
Complex-valued wavelet of shape
(n_time,), normalized bydt/a.- Return type:
ndarray
Examples
>>> import numpy as np >>> from sgwt.functions import gaussian_wavelet >>> t = np.linspace(0, 10, 1000) >>> psi = gaussian_wavelet(t, a=0.5, b=5.0, w0=2*np.pi)