Skip to main content

flash-eeg

GPU-accelerated electrophysiology (EEG, iEEG, LFP) transforms for large batch jobs. Built on PyTorch and CUDA (cuFFT) under the hood.

benchmark

GPU: NVIDIA GH200 with torch.compile. CPU: MNE-Python / Scipy, fully parallelized (2x Xeon 8568Y+). 8 channels, 30s @ 250Hz.

Install

pip install flash-eeg

Usage

import flash_eeg as feeg
import torch

x = torch.randn(1024, 8, 7500, device="cuda")  # [batch, channels, samples]

# One-line transforms
spec = feeg.spectrogram(x)     # STFT spectrogram     -> [B, C, 224, 224]
morlet = feeg.morlet(x)        # Morlet wavelet        -> [B, C, 224, 224]
conn = feeg.connectivity(x)    # WPLI connectivity     -> [B, 1, 224, 224]
img = feeg.reshape(x)          # Signal-to-image       -> [B, C, 224, 224]
filt = feeg.bandpass(x)        # FFT bandpass filter    -> [B, C, T]

# Raw output (no normalization or resize)
raw = feeg.spectrogram(x, output="raw")  # [B, C, n_freqs, T_frames]

# Works with float16 / bfloat16 (AMP training)
x_fp16 = x.half()
spec = feeg.spectrogram(x_fp16)  # computes in fp32, returns fp16

Class API

spec_fn = feeg.Spectrogram(device="cuda")  # nn.Module
for batch in dataloader:
    images = spec_fn(batch)  # auto-compiles on A100/H100/H200

Both APIs have identical performance. The functional API uses lru_cache internally — same parameters reuse the compiled module.

Options

feeg.spectrogram(x, output_size=128, n_fft=512, hop_length=64)
feeg.morlet(x, n_freqs=30, freq_min=1.0, freq_max=100.0, n_cycles=5)
feeg.connectivity(x, n_fft=1024, num_tapers=5)
feeg.bandpass(x, sfreq=250.0, low=0.5, high=45.0, rolloff=2.0)
feeg.spectrogram(x, compile=True)   # force compile on/off
feeg.clear_cache()                   # free cached GPU modules

Performance

Transform CPU (B=1024) GPU compiled Speedup
STFT Spectrogram (vs Scipy) 7.17s 6.3ms 1,146x
Morlet Wavelet (vs MNE) 59.2s 41.1ms 1,439x
WPLI Connectivity (vs MNE) 72.1s 1.1ms 66,870x
Reshape + Interpolate 6.96s 0.9ms 8,089x

License

MIT

Metadata

Release files for flash-eeg 0.4.1

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

Source distribution (sdist)

Source distribution for flash-eeg 0.4.1
File Size Uploaded Provenance Actions
flash_eeg-0.4.1.tar.gz 11.4 kB Without provenance Details for flash_eeg-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flash-eeg 0.4.1
File Interpreter ABI Platform Actions
flash_eeg-0.4.1-py3-none-any.whl Python 3 none any Details for flash_eeg-0.4.1-py3-none-any.whl

Total release size: 22.6 kB

Release files / flash_eeg-0.4.1.tar.gz

Download URL flash_eeg-0.4.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8027030e0f671a54cea9686588447037eefbb7f14c93ce68a4bea9fc88455064
BLAKE2b-256 checksum
How to use checksums
fd07f72adbaec156f9d3eb33b56f6934f4bd669db312b71e433b658a700cbf4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.6

Release files / flash_eeg-0.4.1-py3-none-any.whl

Download URL flash_eeg-0.4.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b7326430f7f9a4fe527c7a7e1df4d08762e80f8c0cde7e5beb8b74aa86e422d
BLAKE2b-256 checksum
How to use checksums
b7f74dc31f59db41ad58316b061df951d8036b5ef1fcbb82e937e70961933640
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.6

Security for flash-eeg 0.4.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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