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.9.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.9-py3-none-any.whl (7.9 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_dsp-0.1.9.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.9.tar.gz
Algorithm Hash digest
SHA256 f24a98f64bf4e116671683cb956a55ddfe524fc05d6a45b1b7628c52266822f9
MD5 e70bfa1fb56f1ca8ac94f1e1bc029bce
BLAKE2b-256 c995965b4effee7d0e8b86fe8c2a20567ec501bd8260138e5aa86dc3e96f18b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dsp-0.1.9.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.9-py3-none-any.whl.

File metadata

  • Download URL: scitex_dsp-0.1.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 08d2896170018fc786beb412cd557e84939ba03c854721405513892fb2f07180
MD5 c1c0f551ddc517cfa9cd82aef2bd1b11
BLAKE2b-256 13022e30be9e1092ea23ad4bdac68f6bc90d5f3d0391ba4c5f81abad858ac83b

See more details on using hashes here.

Provenance

The following attestation bundles were made for scitex_dsp-0.1.9-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