Skip to main content

Digital signal processing (PAC, Hilbert, Wavelet, filters, demo signals, …) — standalone module from the SciTeX ecosystem

Project description

scitex-dsp

SciTeX

Digital signal processing for scientific Python — PAC, Hilbert, wavelet, filters, resampling, demo signals.

Full Documentation · uv pip install scitex-dsp[all]

pypi python docs

tests quality cov


Problem and Solution

# Problem Solution
1 Signal-processing pipelines mix NumPy, SciPy, MNE, and PyTorch with incompatible array shapes. scitex_dsp exposes a uniform (batch, channel, time) 3-D contract via ensure_3d and the @torch_fn decorator.
2 Phase-Amplitude Coupling (PAC), wavelets, and ripple detection are scattered across one-off scripts. First-class pac, wavelet, hilbert, detect_ripples, modulation_index reproducible primitives.
3 Demo signals for testing pipelines have to be re-rolled by every project. demo_sig(sig_type=...) produces deterministic chirp / periodic / ripple test signals.

Installation

pip install scitex-dsp

Architecture

scitex_dsp is organised as flat building blocks plus four sub-modules. Public entry points compose left-to-right into typical neuroscience pipelines:

flowchart LR
    raw[(raw LFP / EEG)] --> ensure_3d
    ensure_3d --> reference[reference.common_average]
    reference  --> filt[filt.bandpass]
    filt --> hilbert
    hilbert --> psd
    hilbert --> wavelet
    wavelet --> modulation_index
    modulation_index --> pac
    hilbert --> detect_ripples[detect_ripples]
    psd  --> band_powers[per-band power]
src/scitex_dsp/
├── _hilbert.py   _psd.py        _wavelet.py
├── _pac.py       _modulation_index.py
├── _detect_ripples.py
├── _resample.py  _crop.py       _ensure_3d.py
├── _demo_sig.py  _transform.py
├── filt.py       norm.py        reference.py
├── add_noise.py  params.py      example.py
└── utils/        # ensure_*, zero-pad, differential filters

All public functions accept (channels, samples) or (batch, channels, samples).

2 Interfaces

Python API
import scitex_dsp as dsp

xx, tt, fs = dsp.demo_sig(sig_type="chirp", fs=1024)
psd, ff = dsp.psd(xx, fs)
xf = dsp.filt.bandpass(xx, fs, bands=[[8, 12]])
hp = dsp.hilbert(xx)
pac, freqs_pha, freqs_amp = dsp.pac(xx, fs)
Importable from the umbrella
import scitex
scitex.dsp.demo_sig(sig_type="chirp")  # `scitex.dsp` aliases `scitex_dsp`

Demo

A 13-notebook progressive tutorial lives in examples/, committed with executed cell outputs — read on GitHub without running anything locally.

flowchart LR
    A[01 demo_sig] --> B[02 ensure_3d / crop]
    B --> C[03 norm]
    C --> D[04 filt]
    D --> E[05 hilbert]
    E --> F[06 psd]
    E --> G[07 wavelet]
    D --> H[08 resample]
    A --> I[09 add_noise]
    B --> J[10 reference]
    E --> K[11 modulation_index]
    K --> L[12 pac]
    E --> M[13 detect_ripples]

See examples/README.md for the full index and suggested reading paths.

# Notebook Topic Cross-check
01 01_demo_sig.ipynb synthetic test signals — uniform / gauss / periodic / chirp
04 04_filt.ipynb Butterworth bandpass / bandstop
05 05_hilbert.ipynb analytic signal — phase + envelope scipy.signal.hilbert
06 06_psd.ipynb PSD + per-band integrated power
07 07_wavelet.ipynb continuous wavelet transform
09 09_add_noise.ipynb gauss / white / pink / brown — traces + PSDs
12 12_pac.ipynb phase-amplitude coupling heatmap tensorpac.Pac
13 13_detect_ripples.ipynb end-to-end ripple detection — DataFrame + shaded events

Re-run them all with ./examples/00_run_all.sh.

Part of SciTeX

scitex-dsp is part of SciTeX.

Install via the umbrella with pip install scitex[dsp], then access as scitex.dsp or run scitex dsp from the CLI.

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.


SciTeX

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

scitex_dsp-0.1.11.tar.gz (7.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scitex_dsp-0.1.11-py3-none-any.whl (7.9 MB view details)

Uploaded Python 3

File details

Details for the file scitex_dsp-0.1.11.tar.gz.

File metadata

  • Download URL: scitex_dsp-0.1.11.tar.gz
  • Upload date:
  • Size: 7.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_dsp-0.1.11.tar.gz
Algorithm Hash digest
SHA256 1641146c5c15f58906db1ad9995540a77a65b4f06b975f8beadb34004fe25e18
MD5 8242ae2bc8777c616fc2b9c2e40e14b0
BLAKE2b-256 3e3aa31865a7edf95854d54deca5811fe34323efff863b0b10dfccfd3dedefc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dsp-0.1.11.tar.gz:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-dsp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scitex_dsp-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: scitex_dsp-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scitex_dsp-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8e287f608d1d05beb121a62ce82025b5b2716550861035a3add49c8bf93b5d03
MD5 15269aaf36e713163ab4abc60dd0bcf3
BLAKE2b-256 44c2ba6707f845d4dc7ad6a1b366ce1b17ec7cf65235e69289089f40e686de68

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dsp-0.1.11-py3-none-any.whl:

Publisher: pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-dsp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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