lfpack
Lossy LFP codec for Neuropixels recordings
lfpack compresses raw Neuropixels LFP recordings at >100× compression with median RMSE < 25 µV, using an 8-stage pipeline followed by adaptive SVD + wavelet-packet thresholding.
Documentation
| Section | Content |
|---|---|
| Tutorial | Install, compress, and read your first recording |
| How-To: Write your own file | Write an HDF5 archive from your own LFP data, not via compress_bin_to_h5 |
| How-To: Binned reads | Memory-efficient channel-binned access |
| How-To: Multi-recording | Work with multi-recording HDF5 files |
| Reference: API | Full API reference |
| Reference: HDF5 format | File format specification |
| Explanation: Pipeline | Design rationale for each pipeline stage |
| Explanation: Benchmark gallery | Compression benchmarks across 11 IBL recordings |
Quick start
pip install lfpackfrom lfpack import compress_bin_to_h5, LFPackReader
# Compress a raw LFP binary
compress_bin_to_h5("recording.lf.cbin", "recording.lf.h5")
# Read back on demand — same interface as spikeglx.Reader
sr = LFPackReader("recording.lf.h5")
traces = sr[0:1000] # (1000, n_channels) float32, voltsBenchmark — IBL PID dab512bd (NP1, 61 min, 384 ch, original: 7.0 GB)
| Parameter set | ε (SVD) | α (WP) | File size | CR | RMSE median | RMSE p95 |
|---|---|---|---|---|---|---|
| mild | 100 | 14 | 26 MB | 270× | 15 µV | 17 µV |
| default | 150 | 28 | 15 MB | 461× | 24 µV | 26 µV |
