Skip to main content

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).

Feature Extraction

A named-scalar feature front-end turns a signal (or a PAC map) into a flat, self-documenting {names, values} descriptor — every value is traceable to its registry entry.

import scitex_dsp as dsp

# Canonical PAC-summary set from a PAC map (+ its provenance registry).
feats = dsp.pac_features(pac_z)          # {"names": [...], "values": [...]}
dsp.PAC_FEATURE_REGISTRY                  # what each feature means / how it is computed

# Multi-backend front-end over many engines (pac + catch22) in one call.
out = dsp.extract_all(x, fs)              # {"names": [...], "values": [...]}
dsp.AVAILABLE_BACKENDS                     # ("pac", "catch22")
dsp.extract_all_registry()                 # provenance for every emitted feature

# Real GPU-PAC engine (opt-in); "auto" keeps the CPU-safe default.
pac, f_pha, f_amp = dsp.pac(x, fs, backend="gpac")

# Quantify how much a mixed feature set duplicates itself.
dsp.feature_correlation(X, names)
dsp.redundancy_summary(X, names)
dsp.pca_loadings(X, names)
dsp.correlation_by_group(X, names)

The pip-installable optionals (tensorpac, pycatch22, scikit-learn, sounddevice, and the gpu-pac GPU-PAC engine behind pac(backend="gpac")) ship in a single [all] extra: pip install scitex-dsp[all] (or, for just the GPU engine, pip install gpu-pac).

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

Metadata

Release files for scitex-dsp 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scitex-dsp 0.2.0
File Size Uploaded Provenance
scitex_dsp-0.2.0.tar.gz 7.8 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scitex-dsp 0.2.0
File Interpreter ABI Platform
scitex_dsp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 MB

Release files / scitex_dsp-0.2.0.tar.gz

Download URL scitex_dsp-0.2.0.tar.gz
Size 7.8 MB
Tags Source
SHA-256 checksum
How to use checksums
92bf3e363d6ffa03a97ec20fa89251e776f9e1f3e9e4270b8ec885bb325e6e7c
BLAKE2b-256 checksum
How to use checksums
a5a10b84244af5991bd8d5cf23cdef6cd5b6ad905087fd2993ab0ec92fb8ad90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / scitex_dsp-0.2.0-py3-none-any.whl

Download URL scitex_dsp-0.2.0-py3-none-any.whl
Size 7.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
746b2708dfcca8b3af2a1e99360e5f9ec35b053a4004dd5188fb2ad3abe09cf8
BLAKE2b-256 checksum
How to use checksums
5f6c13f61e4ca58de0929786fe5e92db601770b682ae80465d1d74ffffae1e5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.12.13

Security for scitex-dsp 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page