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 · pip install scitex-dsp

PyPI Python Tests Coverage Docs License: AGPL v3


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

Uploaded Python 3

File details

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

File metadata

  • Download URL: scitex_dsp-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 3fb89bb351dec861822266330e559281d392713fe64f35768349fc3146a6b02b
MD5 8a59343fc1ebb8a6efd50741f877625a
BLAKE2b-256 e67eb922296904641c0a170c18fef71a69ada3a9978e6abc17051341a8061521

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.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.7-py3-none-any.whl.

File metadata

  • Download URL: scitex_dsp-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 7.8 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1149e865de081fe056ce813f9cf45c2e969b50ed5216583cf75f0e06b90c0d98
MD5 accb224baf9426261dc2141fdd1fa0f0
BLAKE2b-256 f5ac41e15336087ba720b840c0efaac64a933b4f6bac3ef1ca82c91767592bad

See more details on using hashes here.

Provenance

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

Publisher: publish-pypi.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