Easy digital signal processing
Project description
ezDSP: Easy Digital Signal Processing
ezDSP is a digital signal processing toolbox written in PyTorch (./src/ezdsp/nn/
). However, ezDSP not only processes torch.tensors (CPU & GPU) but also handles numpy.ndarray and pd.DataFrame, enabling a consistent and intensive workflow.
Installation
$ pip install ezdsp
$ python ./example.py # ./example_outputs/ will be generated.
Samples
Normalization, Resampling, Noise Addition, Filtering, Hilbert Transformation
Wavelet Transformation
Power Spectrum Density
Phase-Amplitude Coupling
fixme
Quick Start
import ezdsp as ed
# Parameters
SRC_FS = 1024 # Source sampling frequency
TGT_FS = 512 # Target sampling frequency
FREQS_HZ = [10, 30, 100] # Frequencies in Hz
LOW_HZ = 20 # Low frequency for bandpass filter
HIGH_HZ = 50 # High frequency for bandpass filter
SIGMA = 10 # Sigma for Gaussian filter
SIG_TYPES = [
"uniform",
"gauss",
"periodic",
"chirp",
"ripple",
"meg",
"tensorpac",
] # Available signal types
# Demo Signal
xx, tt, fs = ed.demo_sig(
t_sec=T_SEC, fs=SRC_FS, freqs_hz=FREQS_HZ, sig_type="chirp"
)
# xx is either of torch.tensor (on cpu / cuda), numpy.ndarray, or pd.DataFrame.
# Normalization
xx_norm = ed.norm.z(xx)
xx_minmax = ed.norm.minmax(xx)
# Resampling
xx_resampled = ed.resample(xx, fs, TGT_FS)
# Noise addition
xx_gauss = ed.add_noise.gauss(xx)
xx_white = ed.add_noise.white(xx)
xx_pink = ed.add_noise.pink(xx)
xx_brown = ed.add_noise.brown(xx)
# Filtering
xx_filted_bandpass = ed.filt.bandpass(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)
xx_filted_bandstop = ed.filt.bandstop(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)
xx_filted_gauss = ed.filt.gauss(xx, sigma=SIGMA)
# Hilbert Transformation
phase, amplitude = ed.hilbert(xx) # or envelope
# Wavelet Transformation
wavelet_coef, wavelet_freqs = ed.wavelet(xx, fs)
# Power Spetrum Density
psd, psd_freqs = ed.psd(xx, fs)
# Phase-Amplitude Coupling
pac, freqs_pha, freqs_amp = ed.pac(x_3d, fs) # This function is computationally demanding. Please monitor the RAM/VRAM usage.
Alias
mngs.dsp
has the same functionalities.
Contact
Yusuke Watanabe (ywata1989@gmail.com).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ezdsp-1.3.1.tar.gz
(24.2 kB
view details)
Built Distribution
ezdsp-1.3.1-py3-none-any.whl
(32.2 kB
view details)
File details
Details for the file ezdsp-1.3.1.tar.gz
.
File metadata
- Download URL: ezdsp-1.3.1.tar.gz
- Upload date:
- Size: 24.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9fa9fef0e579f89cf8b786cb8bb84afaebce3a99d349e4aa883f15b24cd125b |
|
MD5 | 05f896471fd3fc9708eff836f4e789e1 |
|
BLAKE2b-256 | f988780f82dea36d124fde64772da39c296d467f094fd6cab47ceaaccf675b8d |
File details
Details for the file ezdsp-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: ezdsp-1.3.1-py3-none-any.whl
- Upload date:
- Size: 32.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e076fae006d45183f181d91f33861da9a5f0be743bb9ddc9f11dd884ef2b9c6a |
|
MD5 | f43cceab64e6859ec7159e9244b02924 |
|
BLAKE2b-256 | a1aa35ea986fed4cdbd4682308a71325e3aa4798d69d2e55ed00735eb23b9ac8 |