CaliBrain: A Python toolbox for uncertainty quantification, calibration, and benchmarking in Bayesian M/EEG inverse source imaging
Preprint, not yet peer reviewed. Electroencephalography (EEG) and magnetoencephalography (MEG) source imaging estimates underlying neural current sources from non-invasive sensor recordings. Bayesian reconstruction methods address this ill-posed inverse problem by providing source estimates together with posterior uncertainty. However, the resulting credible regions are not necessarily empirically calibrated, as their nominal credibility may differ from actual coverage. While existing software packages support forward modelling and Bayesian source reconstruction, dedicated tools for evaluating and recalibrating source-wise posterior uncertainty remain unavailable. CaliBrain is an open-source Python toolbox for uncertainty quantification, calibration, and benchmarking in Bayesian M/EEG inverse source imaging. The package provides an end-to-end workflow encompassing source simulation, leadfield preparation, sensor-level data projection and noise generation, Bayesian source reconstruction, construction of voxel-wise credible regions from posterior means and covariance matrices, empirical coverage assessment, and post-hoc uncertainty recalibration. Its reproducible benchmarking workflows enable systematic comparisons across inverse solvers, orientation models, noise specifications, and simulation settings. Depending on the source orientation model, uncertainty is represented by one-dimensional credible intervals, two-dimensional credible ellipses, or three-dimensional credible ellipsoids. CaliBrain provides a unified Python framework for Bayesian source reconstruction, voxel-wise uncertainty assessment, and post-hoc recalibration across EEG and MEG modalities and source-orientation models. While it can use forward solutions prepared with established neuroimaging software, its reconstruction, uncertainty quantification, and calibration procedures are implemented within CaliBrain, enabling reproducible methodological comparisons. Software: https://doi.org/10.5281/zenodo.24459785 (version 1.1.0).Source code at https://github.com/braindatalab/CaliBrain.Documentation at https://calibrain.readthedocs.io.
Authors
- Srikantan S. Nagarajan (ORCID: https://orcid.org/0000-0001-7209-3857)
- Ismail T. Huseynov (ORCID: https://orcid.org/0000-0002-4141-3544)
- Stefan Haufe (ORCID: https://orcid.org/0000-0003-1470-9195)
- Mohammad Orabe (ORCID: https://orcid.org/0009-0004-7177-799X)
Institutions
- Physikalisch-Technische Bundesanstalt (DE)
- Federal Institute For Materials Research and Testing (DE)
- University of California, San Francisco (US)
- Technische Universität Berlin (DE)
- Charité - Universitätsmedizin Berlin (DE)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-25
- DOI
- https://doi.org/10.5281/zenodo.24544960
- Primary Topic
- EEG and Brain-Computer Interfaces
- Type
- preprint