Python package for FII BCI Corpus (NY format). A lightweight Eegle.jl port.
Project description
pyLittleEegle: Python package for FII BCI Corpus
Version: 0.1.1 (Jan 2026)
Authors: Fahim Doumi (CeSMA, University Federico II, Naples),
Marco Congedo (CNRS, University Grenoble Alpes, Grenoble)
This repository contains a suite of Python tools designed to manage, process, and analyze EEG data from the FII BCI Corpus, specifically formatted in the NY format.
pyLittleEegle is a pure-Python, pyRiemann-friendly and MNE-free port of the core BCI functionalities from the Julia Eegle package. It leverages the Python scientific ecosystem to streamline the management of NY-format databases and facilitate BCI classification pipelines.
Installation
You can install pyLittleEegle directly from using pip:
pip install pylittleeegle
Core Dependencies
To use these tools, you will need the following libraries (automatically installed when using pip):
numpypandasscikit-learnpyriemannscipypyyaml
Modules Overview
The toolkit is divided into three main modules, designed to be used sequentially:
1. Database Management (ple.Database)
The Librarian.
This module handles the exploration and selection of datasets without loading all data into memory. It allows you to filter the massive FII BCI Corpus based on specific criteria.
Key Features:
InfoDBStructure: An immutable dataclass that summarizes all metadata of a database (Subject count, sampling rate, paradigms, hardware, etc.).selectDB: The main entry point. It scans directories to find databases matching your requirements.- Filter by Paradigm: Select only 'MI' (Motor Imagery), 'P300', or 'ERP'.
- Filter by Class: Keep only databases containing specific classes (e.g.,
["right_hand", "feet"]). - Filter by Minimum number of trial per class: Exclude sessions that do not have enough trials via the
minTrialsargument.
Example:
import pylittleeegle as ple
# Find all Motor Imagery databases containing "right_hand" and "feet"
# with at least 20 trials per class.
DBs = ple.selectDB(
corpusDir="./Data",
paradigm="MI",
classes=["right_hand", "feet"],
minTrials=20
)
2. Input/Output & Preprocessing (ple.InOut)
The Loader.
Once a database is selected, this module reads the actual recordings (.npz and .yml files) and structures them for analysis.
Key Features:
-
readNY: The core function to load an EEG recording. -
Filtering: Can apply BandPass or BandStop filters on the fly.
-
Class Selection: Can load specific classes (e.g., ignore "rest" and keep only active tasks).
-
Standardization (
stdClass): Automatically maps class labels to a standard numerical convention (e.g.,right_hand-> 2), facilitating transfer learning across different datasets. -
EEGStructure: A comprehensive dataclass containing the signal matrix (.X), the stimulation vector (.stim), trial markers, and all acquisition metadata.
Example:
import pylittleeegle as ple
# Load a specific session, apply a 8-30Hz bandpass filter,
# and keep only right_hand and feet classes.
o = ple.readNY(
"path/to/subject_01_session_01.npz",
bandPass=(8, 32),
classes=["right_hand", "feet"]
)
3. BCI Classification (ple.BCI)
The Analyst.
This module provides tools to encode EEG data into geometric features (Covariance Matrices) and perform classification using Riemannian Geometry.
Key Features:
-
encode: Converts the raw EEG trials from theEEGstructure into Covariance Matrices. -
Seamless Integration: It explicitly handles the data formatting logic to ensure compatibility with the Python ecosystem. It automatically reshapes and transposes the internal data into the standard
(n_trials, n_channels, n_samples)numpyarray format strictly required bypyriemannandscikit-learn, abstracting away the manual formatting usually needed. -
Versatility: Supports different estimators (SCM, LWF, OAS) and paradigms (ERPCovariances for P300, direct Covariances for MI).
-
crval: A streamlined Cross-Validation wrapper. It takes a classifier (e.g., frompyriemannorsklearn), the covariance matrices, and labels, then returns aCVressummary object containing accuracy metrics (balanced accuracy, mean, std) and execution time.
Example:
import pylittleeegle as ple
from pyriemann.classification import MDM
# 1. Encode data to Covariance Matrices
# Automatically handles the reshape to (n_trials, n_channels, n_samples)
covs = ple.encode(o, paradigm="MI")
# 2. Define a Classifier (Minimum Distance to Mean)
clf = MDM(metric='riemann')
# 3. Run Cross-Validation
results = ple.crval(clf, covs, o.y, n_folds=10)
display(results)
Documentation & Eegle.jl Heritage
Most functions in this package are exact or lightweight ports of functionalities from the original Julia Eegle.jl package.
- Theoretical logic: Since the logic and parameters remain consistent between the two versions, you can refer to the Eegle.jl documentation for in-depth theoretical explanations and methodological details.
- Implementation details: For Python-specific implementation details (arguments, return types, and syntax), please refer directly to the source code files. All functions are fully documented with extensive comments and docstrings.
📚 Tutorial
A complete step-by-step workflow is available in FullTutorial.ipynb.
This notebook demonstrates the entire pipeline:
- Selecting databases using
ple.Database. - Loading and preprocessing data with
ple.InOut. - Encoding and classifying signals using
ple.BCI.
Copyright © 2025 Fahim Doumi, CeSMA, University Federico II, Marco Congedo, CNRS, University Grenoble Alpes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylittleeegle-0.1.1.tar.gz.
File metadata
- Download URL: pylittleeegle-0.1.1.tar.gz
- Upload date:
- Size: 24.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0a903d0fa0bfa3d3b8b949c9d16195fafaa437aac08f53fed4222137d721d18
|
|
| MD5 |
11c537531c9dfd0e1ea698c256186fb4
|
|
| BLAKE2b-256 |
5df291009feee2682eff0d34297435a522081b8207754cab3a49e8a707ab10af
|
File details
Details for the file pylittleeegle-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pylittleeegle-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88ff27372572c4c119fb5c689b3709c2d0cccc6a85f9e7e8bdcdcd4e904aea64
|
|
| MD5 |
b916221378e2f1b59971c8c1a6769e78
|
|
| BLAKE2b-256 |
85c197a44ac57c3be63fbce73b26ab01653392093ad20fdb6807925a6ff7339d
|