Skip to main content

PiEEG Core

Native accelerator for PiEEG-server. Compiled Rust replacements for hot paths.

⚠️ Early development · experimental · no warranties. This project is in early development — APIs, behavior, and packaging may change without notice. Research/hobbyist software provided as-is, without warranty of any kind, express or implied. Not a medical device. Not intended for clinical, diagnostic, or safety-critical use. Use at your own risk. See LICENSE for full terms.

What it accelerates

Component What Speedup
MultichannelFilter Butterworth IIR bandpass (SOS cascade) ~1057x
HampelFilter Per-channel spike rejection (median + MAD) ~15x
decode_channels 24-bit ADC → µV conversion ~9x

When installed, pieeg-server detects it and switches to the compiled implementations automatically. No config needed.

On the Raspberry Pi it additionally provides a native acquisition loop (NativeAcquisition) that owns the SPI/GPIO hardware directly — see Native acquisition.

Benchmark

Hot path Python pieeg-core Speedup
MultichannelFilter (bandpass 1–40 Hz) 992 samples/s 1,048,658 samples/s ~1057×
HampelFilter (spike removal) 24,619 samples/s 358,361 samples/s ~15×
decode_channels (24-bit SPI → µV) 121,352 samples/s 1,134,301 samples/s ~9×

Native acquisition (Raspberry Pi)

Beyond the drop-in DSP accelerators, pieeg-core ships a hard-real-time acquisition loop that reads the ADS1299(s) directly (supporting PiEEG-8, PiEEG-16, and PiEEG-24). A dedicated OS thread owns the SPI buses and GPIO lines, polls DRDY, reads the ADC chip(s), decodes to microvolts and pushes frames into a lock-free single-producer/single-consumer queue — all with the GIL released. Acquisition timing is therefore fully decoupled from CPython's GIL and garbage collector.

This path is compiled into the Linux/Raspberry Pi wheels (built with the hardware Cargo feature); it depends on spidev and gpio-cdev, so it is absent from Windows builds.

from pieeg_core import NativeAcquisition

acq = NativeAcquisition(
    num_channels=16,      # 8 (PiEEG-8), 16 (PiEEG-16), or 24 (PiEEG-24)
    sample_rate=250,      # 250, 500, 1000, 2000 or 4000 SPS
    gpiochip="/dev/gpiochip4",
    spi_speed_hz=4_000_000,
    cs_pin=19,            # chip-select for ADC 2 (16/24-ch mode)
    cs2_pin=21,           # chip-select for ADC 3 (24-ch mode)
    drdy_pin=26,          # DRDY for ADC 1
    drdy2_pin=13,         # DRDY for ADC 2
    drdy3_pin=5,          # DRDY for ADC 3 (24-ch mode)
    queue_capacity=0,     # 0 → auto (~4 s of headroom)
)

acq.start()               # opens hardware, configures the ADC(s), spawns the read thread
try:
    while True:
        # Drain up to max_frames buffered samples in FIFO order.
        for seq, timestamp, channels in acq.read_batch(max_frames=256):
            ...           # channels is a list of microvolts, len == num_channels

        if acq.dropped:   # samples lost to consumer back-pressure (ring overflow)
            ...           # counted, never silent
finally:
    acq.stop()            # signals the read thread and joins it

API

Member Description
start() Open the hardware, configure the ADC(s) and spawn the read thread.
read_batch(max_frames=256) Drain up to max_frames buffered samples as a list of (seq, timestamp, [ch1..chN]) tuples in FIFO order. Releases the GIL.
stop() Signal the read thread to stop and join it. Also runs on drop.
pending Frames currently buffered and waiting to be read.
dropped Frames dropped because the consumer fell behind (ring overflow).
bad_frames Per-chip [chip1, chip2, chip3] count of frames dropped due to corrupted status headers.

The register-configuration sequence is a faithful port of pieeg_server's PiEEGHardware._configure_adc, with the CONFIG1 data rate parameterised so you can select 250–4000 SPS. Each frame carries a monotonically increasing sequence index internally, so any upstream sample loss is recorded rather than hidden.

The SPI/GPIO paths can only run on a Raspberry Pi with a PiEEG shield. The non-hardware logic (queue, decode, register mapping) is unit-tested off-device.

Install

pip install pieeg-core

To upgrade an existing installation to the latest release:

pip install --upgrade pieeg-core

Pre-built wheels are published for Linux (x86_64, aarch64, armv7 — including Raspberry Pi with native hardware acquisition enabled) and Windows (x86_64) on CPython 3.11–3.13.

Build from source

Requires Rust and maturin:

pip install maturin
cd PiEEG-core
maturin develop --release

To include the native acquisition loop (Raspberry Pi only), enable the hardware feature:

maturin develop --release --features hardware

Build inside the same Python environment where pieeg-server is installed.

Metadata

Release files for pieeg-core 0.5.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 pieeg-core 0.5.1
File Size Uploaded Provenance Actions
pieeg_core-0.5.1.tar.gz 232.4 kB With provenance Details for pieeg_core-0.5.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pieeg-core 0.5.1
File Actions
pieeg_core-0.5.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pieeg_core-0.5.1-cp313-cp313-win_amd64.whl
pieeg_core-0.5.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for pieeg_core-0.5.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pieeg_core-0.5.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARMv7l Details for pieeg_core-0.5.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
pieeg_core-0.5.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details for pieeg_core-0.5.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pieeg_core-0.5.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pieeg_core-0.5.1-cp312-cp312-win_amd64.whl
pieeg_core-0.5.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for pieeg_core-0.5.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pieeg_core-0.5.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARMv7l Details for pieeg_core-0.5.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
pieeg_core-0.5.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details for pieeg_core-0.5.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pieeg_core-0.5.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pieeg_core-0.5.1-cp311-cp311-win_amd64.whl
pieeg_core-0.5.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for pieeg_core-0.5.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pieeg_core-0.5.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARMv7l Details for pieeg_core-0.5.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
pieeg_core-0.5.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details for pieeg_core-0.5.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Total release size: 3.1 MB

Release files / pieeg_core-0.5.1.tar.gz

Download URL pieeg_core-0.5.1.tar.gz
Size 232.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b72ef8c5261c8698896089891c0cd530e4e681898da1f2c29ba7826d7f7dc359
BLAKE2b-256 checksum
How to use checksums
c4e21ce34f03a32de0da3aa12190e69ab6cceb94741f175d78a315d5eeca7dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp313-cp313-win_amd64.whl

Download URL pieeg_core-0.5.1-cp313-cp313-win_amd64.whl
Size 150.3 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a753b2d28b78361cbc66d26170455da090d89b383a24ab3cfc8fcd033c2a4d50
BLAKE2b-256 checksum
How to use checksums
e8eaaf1e3a642ba2c011993703a73801c3b76383b19c99610d39d6d183f87ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pieeg_core-0.5.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 266.0 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5c43199b8c532f8fda629eace4fe582c8cf213cabed230d5ad0c28a76c6c5c7c
BLAKE2b-256 checksum
How to use checksums
5ee8b75dfb9e0869803aa43ef8ed134f8bd2b10801de8789a57f7fa5edf78895
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl

Download URL pieeg_core-0.5.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
Size 266.2 kB
Tags CPython 3.13 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
1ebf52664ff7b33a99b15578dc718caf90c879d5fb3b7e333fed2f5c309cd893
BLAKE2b-256 checksum
How to use checksums
4b51bc6c683207e914413de3adefbb2eaf1da2c59f7a8981763c41d3c82c9f59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pieeg_core-0.5.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 258.2 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
9efe107427e21a95527c854e2d025095a7a6ceaf5562feac988bcb5e1273b0d8
BLAKE2b-256 checksum
How to use checksums
519b7c61712590bebe54760314cee42d51e5722d9a95a892caeeae478fa1f022
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp312-cp312-win_amd64.whl

Download URL pieeg_core-0.5.1-cp312-cp312-win_amd64.whl
Size 150.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
72fb1b042961f748c28bab33c4ed1e87b52236cb73701cf859cbb7d7cb615198
BLAKE2b-256 checksum
How to use checksums
59e3f59ea8c70e9c04b57fa0d5814129e226b357130f22e33f7d0ed95e8b0394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pieeg_core-0.5.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 266.3 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
44d91f43500bab514f78bf680db465cccf004cff28c3b38f91e0fda600ac93a1
BLAKE2b-256 checksum
How to use checksums
1437424f21560d4d32905c635509509a050457329b3ffa304d6ffb5087868fcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl

Download URL pieeg_core-0.5.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
Size 266.5 kB
Tags CPython 3.12 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
86fcd2423c3dc3d1f51ec0947e7fc6e0fe5994a8ddee91787e929f2638aa4173
BLAKE2b-256 checksum
How to use checksums
bfc37014a2f80fd51aeba0666486666fc7a29044645cfdb6fc11bfaf94c2e9c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pieeg_core-0.5.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 258.5 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
8c798c1dfea25a832faaab9c910d7c68561255dbfc9c4058a5a56f69b5b21ffa
BLAKE2b-256 checksum
How to use checksums
9b2c87abaebd0b58f2744461e1530a69f3181e39ef5a09fd3205e5a09ab7441e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp311-cp311-win_amd64.whl

Download URL pieeg_core-0.5.1-cp311-cp311-win_amd64.whl
Size 150.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
691f9b5a9c2e7b57fa120d6029d70846487b3038704657548e6928a708707b4a
BLAKE2b-256 checksum
How to use checksums
acdd2969eb9dea0508157cc378327dfb3e9e9c9471493065e96a8caa502e3c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pieeg_core-0.5.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 265.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1ed31f71444e30f75300a59feded10bc752c2ba4d68b546edbea58438a4d0d48
BLAKE2b-256 checksum
How to use checksums
f6e6c1c0b9774754b2f7ea93285e13592d523a4cc64f67256b1d7cedc457ef52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl

Download URL pieeg_core-0.5.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
Size 266.1 kB
Tags CPython 3.11 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
60287ad2b6569026ac5a076115b55a72157b892b972fd9cac47a81d44390b340
BLAKE2b-256 checksum
How to use checksums
d10764cdf21cd456cd985f54b4601b511f9e6006b2574b079f238009674e17b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / pieeg_core-0.5.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pieeg_core-0.5.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 258.5 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
df29eea140ba7c7c0792d258d3a93ca9f5c2ebc41a984fe0346f0545d7e68236
BLAKE2b-256 checksum
How to use checksums
4b9302a13a76ec30335631173f7a8a67793441d38ed205aba9ff98c166944021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for pieeg-core 0.5.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.

Full provenance

All 13 files in this release have been uploaded with provenance metadata.

Select from 13 files

Attestation for pieeg_core-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

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