CaliBrain#
CaliBrain: A Python toolbox for uncertainty estimation and calibration in EEG/MEG inverse source imaging.
Overview#
Inverse source imaging is an ill-posed problem: different source configurations can explain the same sensor data. CaliBrain addresses a central question in Bayesian source imaging: are posterior uncertainty estimates empirically reliable? The toolbox provides simulation-based workflows for generating source activity, propagating it through forward models, reconstructing posterior source estimates, quantifying empirical coverage, and evaluating recalibration maps under controlled experimental conditions.
Documentation#
See the tutorials, API reference, and workflow guides in the navigation menu for runnable examples and detailed usage.
Citation#
If you use CaliBrain in academic work, please cite the software archive:
Orabe, Mohammad, Huseynov, Ismail T., Nagarajan, Srikantan, & Haufe, Stefan. (2026). CaliBrain: A Python toolbox for uncertainty estimation and calibration in EEG/MEG inverse source imaging (v1.0.2). Zenodo. https://doi.org/10.5281/zenodo.20721580
Workflow#
The package follows this workflow:
generate source-level ground truth under controlled sparsity and amplitude assumptions;
project sources to sensors through a leadfield and add noise at defined SNR;
reconstruct posterior means and uncertainty summaries with inverse solvers;
convert uncertainty summaries into intervals, ellipses, or ellipsoids;
compare empirical against nominal coverage;
fit isotonic recalibration functions on training splits and evaluate them on held-out splits.
CaliBrain currently supports fixed and free-orientation source models for inverse source imaging methods:
gamma_map_sflexfor Gamma-MAP reconstruction with sparse basis field expansions;gamma_lambda_map_sflexfor the S-FLEX Gamma-MAP variant with joint sparsity and lambda regularization;BMNas a Bayesian minimum norm baseline;BMN_jointas a Bayesian minimum norm variant with joint gamma/lambda learning.
Installation#
From PyPI:
python -m pip install calibrain
From a local checkout:
git clone https://github.com/braindatalab/CaliBrain.git
cd CaliBrain
python -m pip install -e .
License#
CaliBrain is distributed under the BSD 3-Clause License. See LICENSE.