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. A dedicated OS thread owns the SPI buses and GPIO lines, polls DRDY, reads both ADC chips, 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 only into the Linux/Raspberry Pi wheels (built with the hardware Cargo feature); it depends on spidev and gpio-cdev, so it is absent from the Windows/macOS wheels.

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

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

Pre-built wheels are published for Linux (x86_64, aarch64, armv7 — including Raspberry Pi), Windows (x86_64) and macOS (arm64) on CPython 3.10–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.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 pieeg-core 0.5.0
File Size Uploaded Provenance Actions
pieeg_core-0.5.0.tar.gz 232.2 kB With provenance Details for pieeg_core-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pieeg-core 0.5.0
File Actions
pieeg_core-0.5.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pieeg_core-0.5.0-cp313-cp313-win_amd64.whl
pieeg_core-0.5.0-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.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pieeg_core-0.5.0-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.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
pieeg_core-0.5.0-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.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pieeg_core-0.5.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pieeg_core-0.5.0-cp312-cp312-win_amd64.whl
pieeg_core-0.5.0-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.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pieeg_core-0.5.0-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.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
pieeg_core-0.5.0-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.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pieeg_core-0.5.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pieeg_core-0.5.0-cp311-cp311-win_amd64.whl
pieeg_core-0.5.0-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.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pieeg_core-0.5.0-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.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
pieeg_core-0.5.0-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.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Total release size: 3.1 MB

Release files / pieeg_core-0.5.0.tar.gz

Download URL pieeg_core-0.5.0.tar.gz
Size 232.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0437f1f53ad1cade805f2233bd344c6fe1c8deda0e7ae80e3b5f91c33cfa2c27
BLAKE2b-256 checksum
How to use checksums
8564e281823c64b27119ed9aea0a8f9c35369fe3eed4635052d90ee597bebe75
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.0-cp313-cp313-win_amd64.whl

Download URL pieeg_core-0.5.0-cp313-cp313-win_amd64.whl
Size 150.1 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
70065e145ec5ccfd1bba6c4884cdddb9424db255eb39e4f817f1ee66e19301ef
BLAKE2b-256 checksum
How to use checksums
2d12d0d2681da1f1ef9319fe3b16fca10063371ec67b6ec5925ef97d40bb8a03
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.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pieeg_core-0.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 265.9 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
90dde9a8715e8afc75159ebffa3c42a89203b4d42ff38a69826cfd772a8eeb8a
BLAKE2b-256 checksum
How to use checksums
1ee5f0e5910cbdf1520e742afbec1897ab43cba3d15a5e3a10fded2aaa9571fd
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.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl

Download URL pieeg_core-0.5.0-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
Size 266.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
872866552c3f453176d599fd43b136422bcfe5bf282c80647e11e49882e5f183
BLAKE2b-256 checksum
How to use checksums
87f2bcff28956316dd5af098640bd05ac8ad6767a6e40c90f0d6b443e375c846
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.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pieeg_core-0.5.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 258.1 kB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
69b008b48fa5c6d18c82e3d3a869ed6d6cf646911e62d1aa4089c850a1eb3f0b
BLAKE2b-256 checksum
How to use checksums
10b39c0a705610c7790f410f48579665f028ba89c55bf7fbbf6721bbe696b1a3
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.0-cp312-cp312-win_amd64.whl

Download URL pieeg_core-0.5.0-cp312-cp312-win_amd64.whl
Size 150.5 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
941422f98ad99c10f920ec61066b5f10e504630b237e9d719cba24e48ea577f5
BLAKE2b-256 checksum
How to use checksums
e6e1aa946e32eb1263dda08f521486b8940224c181adb33c21707c8c0863c900
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.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pieeg_core-0.5.0-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
a123d14a42cc997d3e873cd4e32ac707c7a93b1809f0643c8b173b547d67e275
BLAKE2b-256 checksum
How to use checksums
33ed9e07dab49438f0a66942d77a58aded42b3219e0314e1ef7db0e2a42bddc0
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.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl

Download URL pieeg_core-0.5.0-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
Size 266.4 kB
Tags CPython 3.12 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
3f179d44f275e2a9e6a08b82ecbf9b32a41d9299f73e76dd6772eb9e6ec0e3a6
BLAKE2b-256 checksum
How to use checksums
f652ec3d5ac9757afdd87e56e9149da9d2b722baccb4109fef79b5d36453f495
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.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pieeg_core-0.5.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 258.4 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
7f6acea436702215a211d58592bbe2ef5f7d8dc05521d5a7b552d223e220a12a
BLAKE2b-256 checksum
How to use checksums
aae513603176cadf10b78fb2308f877aabf851c175d511766e9555e4a63d2764
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.0-cp311-cp311-win_amd64.whl

Download URL pieeg_core-0.5.0-cp311-cp311-win_amd64.whl
Size 149.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
642ff494e8b70a91b45c3cd74a1935afac07611fcfe1f4b3da293359b6e6746e
BLAKE2b-256 checksum
How to use checksums
797fd4ac26b4b3dabfe456a2bdd6b05f7ba1a5586cbe573559042289f02e2950
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.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pieeg_core-0.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 265.8 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
010da6251808ff396aebc5da4f4a9b259f861b4504aaa29fa55710f7cf99ef70
BLAKE2b-256 checksum
How to use checksums
25aa88be6ec1100cf7ff7c1f249ac5dea834a0ec76b277c3d34b817875b904cf
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.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl

Download URL pieeg_core-0.5.0-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl
Size 266.0 kB
Tags CPython 3.11 Linux glibc 2.17+ ARMv7l
SHA-256 checksum
How to use checksums
fbdacee5a9dcc353d7d789244ce88345fcf832d903b53163b0a1d5957d6035c0
BLAKE2b-256 checksum
How to use checksums
39428c7705be3dfc85c681d6fc1b717d0ec768549c6ca52c2d1b50b37fd011a5
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.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pieeg_core-0.5.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 258.4 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
75b61ae6ff2f7df167a65781ddb6cc6d57d1f145843c89dd122ba2df660cb163
BLAKE2b-256 checksum
How to use checksums
db6bb8715364657135baf0d5573291af70b9bdb6e8106f0e5928f9e057d2777b
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.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.

Full provenance

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

Select from 13 files

Attestation for pieeg_core-0.5.0.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