Skip to main content

Easy digital signal processing

Project description

CI CI

EZDSP: Easy Digital Signal Processing

Key Features

  • PyTorch Integration: With functions written in PyTorch (./src/ezdsp/nn/), EZDSP leverages the power of parallel computation, making it ideal for machine learning applications.
  • Automatic Data Handling: Thanks to the torch_fn decorator, EZDSP functions accept torch.tensors (CPU & GPU), numpy.ndarray, and pd.DataFrame as input and return in the corresponding data type.
  • Practical Examples: ./example.py demonstrates all of the functions listed below and generates output figures in ./example_outputs/.

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

Quick Start

import ezdsp

# 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


# Demo Signal
xx, tt, fs = ezdsp.demo_sig(
    t_sec=T_SEC, fs=SRC_FS, freqs_hz=FREQS_HZ, sig_type="chirp"
)
# xx is compatible with torch.tensor (on cpu / cuda), numpy.ndarray, or pd.DataFrame.

# Normalization
xx_norm = ezdsp.norm.z(xx)
xx_minmax = ezdsp.norm.minmax(xx)

# Resampling
xx_resampled = ezdsp.resample(xx, fs, TGT_FS)

# Noise addition
xx_gauss = ezdsp.add_noise.gauss(xx)
xx_white = ezdsp.add_noise.white(xx)
xx_pink = ezdsp.add_noise.pink(xx)
xx_brown = ezdsp.add_noise.brown(xx)

# Filtering
xx_filted_bandpass = ezdsp.filt.bandpass(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)
xx_filted_bandstop = ezdsp.filt.bandstop(xx, fs, low_hz=LOW_HZ, high_hz=HIGH_HZ)
xx_filted_gauss = ezdsp.filt.gauss(xx, sigma=SIGMA)

# Hilbert Transformation
phase, amplitude = ezdsp.hilbert(xx) # or envelope

# Wavelet Transformation
wavelet_coef, wavelet_freqs = ezdsp.wavelet(xx, fs)

# Power Spetrum Density
psd, psd_freqs = ezdsp.psd(xx, fs)

# Phase-Amplitude Coupling
pac, freqs_pha, freqs_amp = ezdsp.pac(x_3d, fs) # This function is computationally demanding. Please monitor the RAM/VRAM usage.

Citation

To cite EZDSP in your work, please use the following format:

@misc{ezdsp2024,
  author = {Watanabe, Yusuke},
  title = {{EZDSP: Easy Digital Signal Processing}},
  year = {2023},
  howpublished = {\url{https://github.com/ywatanabe1989/ezdsp}},
}

Contact

Yusuke Watanabe (ywata1989@gmail.com).

Project details


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.2.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

ezdsp-1.2.0-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file ezdsp-1.2.0.tar.gz.

File metadata

  • Download URL: ezdsp-1.2.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for ezdsp-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6ff91a8f169252737a9ae6acce1094d7df9f693df72c029f19b2f25576cb6215
MD5 aa227a50769a7f11e1a23c221f2fd548
BLAKE2b-256 4b1f111b12e0e18683798962cca1418fc651cd0aaaec4c5ab93253d9f662aee1

See more details on using hashes here.

File details

Details for the file ezdsp-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: ezdsp-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for ezdsp-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4dde707c5b88c6b0aec1ade5e1abc2744a69ee550f0b7c71f62ff56925a461ca
MD5 76dcb3fedff137b432f695343d29d3f7
BLAKE2b-256 8bd8e0b9fd2a8e05d7bb51e9d20586e722432118beb3147bcb4546185a888974

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page