FDNkit
Fractional Dynamical Network & Multifractal toolkit for intracranial EEG
FDNkit turns intracranial-EEG (iEEG) recordings into fractal and fractional-dynamical-network features and evaluates them honestly. It packages methods validated in Beeram et al. (2026, Front. Netw. Physiol. 6:1768476) and the fractional-dynamical-network line of work of Gupta et al. (2018) and Xue & Bogdan (2017) as a clean, documented, tested library, not a one-off GUI welded to a single dataset.
It computes:
- DFA: monofractal Hurst exponent
H. - MFDFA: generalized Hurst
h(q), multifractal widthΔh, and the singularity spectrumf(α). - FODN: a fractional-order dynamical network: per-channel fractional orders
α, a sparse directed coupling matrixA, and eigenvector "hub" scores. - Feature tables: tidy, one-row-per-trial pandas DataFrames.
- Honest classification: a logistic-regression harness that defaults to leave-one-subject-out cross-validation with a subject-level permutation test, because row-wise splits leak patient identity and inflate accuracy.
Install
pip install fdnkit # core: numpy, scipy, pandas, scikit-learn
pip install "fdnkit[viz]" # + matplotlib for plots
pip install "fdnkit[io]" # + mne (EDF) and h5py (HDF5) readers
pip install "fdnkit[all]" # everything
From source:
git clone https://github.com/SamirHossain099/fdnkit
cd fdnkit
pip install -e ".[dev]"
pytest
60-second example (no data download)
from fdnkit.synthetic import synthetic_ieeg
from fdnkit.features import extract_features
# A small, sparsely-coupled synthetic iEEG trial (8 channels, 5 s @ 1 kHz).
signals, channel_names = synthetic_ieeg(n_channels=8, n_samples=5000, seed=0)
# One tidy feature row: DFA H, MFDFA h(q)/Δh, FODN α / leading eigenvalue / hubs.
features = extract_features(signals)
print(features["MF_DFA_H"], features["MeanAlpha"], features["LeadingEig"])
Analyze a single signal directly:
import numpy as np
from fdnkit.dfa import dfa
from fdnkit.mfdfa import mfdfa
from fdnkit.fodn import fit_fodn
x = signals[0]
print("Hurst:", dfa(x).hurst)
print("multifractal width Δh:", mfdfa(x).delta_h)
fodn = fit_fodn(signals) # (channels, timepoints)
print("leading eigenvalue:", fodn.leading_eig)
print("hub scores:", np.round(fodn.dominant_eigvec, 3))
Honest classification
from fdnkit.classify import classify_dataframe
# df has feature columns plus 'label' and 'group' (e.g. subject id) columns.
result = classify_dataframe(df, label_col="label", group_col="group", cv="loso")
print(result.summary())
# Leave-one-subject-out balanced accuracy, ROC-AUC, a subject-level
# permutation p-value, and a bootstrap 95% CI.
cv="loso" (the default) holds out whole subjects and requires groups.
Trial-wise cv="loo" is available but must be requested explicitly and is
labeled optimistic: it is the leakage-prone scheme FDNkit exists to warn about.
Command line
# Self-contained demo: synthesize a labeled cohort and classify it honestly.
fdnkit demo --out demo_features.csv
fdnkit classify demo_features.csv --label label --group group
# Extract features from your own recording (EDF via MNE, or HDF5).
fdnkit extract recording.edf --window 1.0 --drop-bad --zscore --out features.csv
Design principles
- Array-first core.
dfa(signal),mfdfa(signal),fit_fodn(signals)are pure functions on NumPy arrays. Pandas/IO/plotting layer on top. - Depend, don't duplicate. IO, montages, and filtering defer to MNE-Python; FDNkit adds only the fractal/FODN methods.
- Deterministic and seedable. Bad channels log a warning instead of crashing.
- Honest by default. Subject-wise CV and permutation testing are the headline, not an afterthought.
Validation
FDNkit's numerical core is checked against ground truth (see tests/):
- DFA recovers the Hurst exponent of fractional Gaussian noise across
H = 0.3…0.9; white noise →H ≈ 0.5, Brownian motion →H ≈ 1.5. - MFDFA reports a wide
h(q)for a multiplicative binomial cascade and a narrow one for a monofractal signal;h(q=2)matches the DFA Hurst exponent exactly. - FODN recovers finite fractional orders, coupling, and hubs on synthetic coupled systems.
Citation
If you use FDNkit, please cite the software:
Hossain, S. (2026). FDNkit: Fractional Dynamical Network & Multifractal toolkit for intracranial EEG (v1.0.0). Zenodo. https://doi.org/10.5281/zenodo.22366240
(10.5281/zenodo.22366240 always resolves to the latest release; cite
10.5281/zenodo.22366241 for v1.0.0 specifically. See
CITATION.cff.)
Please also cite the methods paper:
Beeram, S. P., Farris, M., Hossain, S., Rethans, N., Kang, J. Y., & Pereira, E. A. (2026). Quantifying cognitive effort's impact on suppression of epilepsy-associated after discharges. Frontiers in Network Physiology, 6, 1768476. https://doi.org/10.3389/fnetp.2026.1768476
License
MIT; see LICENSE. The underlying fractional-dynamical-network method is due to Gupta, Pequito & Bogdan (2018) and Xue & Bogdan (2017); please cite them when using the FODN module.
Metadata
Release files for fdnkit 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fdnkit-1.1.0.tar.gz | 54.8 kB | Without provenance | Details for fdnkit-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fdnkit-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for fdnkit-1.1.0-py3-none-any.whl |
Total release size: 89.7 kB
Release files / fdnkit-1.1.0.tar.gz
| Download URL | fdnkit-1.1.0.tar.gz |
|---|---|
| Size | 54.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1af86c22817f15ec48de4d4b89cfa48ac66518ad0b506efeee73cbc28a88bba3
|
|
BLAKE2b-256 checksum How to use checksums |
a034ccc738789bd0c83841da3535972e6db7283baf8975ab93cde6b808be944c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / fdnkit-1.1.0-py3-none-any.whl
| Download URL | fdnkit-1.1.0-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
baab030bb34b9e18034e8a737f3a067beade8d6ba87d40a68aedc90ede863803
|
|
BLAKE2b-256 checksum How to use checksums |
a92bf48e65b6609e4d59c67b9f4f648424cc19a1ac4f74e91eb7293dd5ba0bef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for fdnkit 1.1.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.
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.