Frites: A Python package for functional connectivity analysis and group-level statistics of neurophysiological data

Etienne Combrisson, Ruggero Basanisi, Vinicius Lima Cordeiro, Robin A. A. Ince, Andrea Brovelli, Vinícius LimaJ. Open Source Softw 2022 · DOI · DBLP

Abstract

Frites is an open-source Python package designed to bridge the gap between information-theoretical measures and group-level statistical analysis in neurophysiology. By implementing Gaussian Copula Mutual-Information (GCMI) and robust permutation-based clustering, Frites enables researchers to identify complex, non-linear relationships in brain networks across multiple subjects. The package is optimized for performance using Numba and parallel processing, providing high-level workflows for M/EEG and iEEG data.

Introduction

In cognitive neuroscience, a central challenge is understanding how the brain coordinates activity across large-scale networks to produce thought and behavior. Researchers need to link neural activity—captured via M/EEG or intracranial recordings—to external variables such as sensory stimuli or behavioral responses. However, this process is hindered by three primary factors:

  1. Non-linearity: Neural relationships are often complex and non-linear, making them difficult to capture with traditional methods.
  2. Inter-subject Variability: Biological differences mean a statistical effect in one participant may look different in another, complicating group-level conclusions.
  3. Technical Barriers: Implementing advanced information-theoretic tools alongside rigorous statistical testing requires significant programming expertise.

Frites (Framework for Information Theoretical analysis of Electrophysiological data and Statistics) addresses these gaps by providing a unified, high-level framework that handles both information measurement and statistical validation across cohorts.

Methodology

The Frites framework is built upon three core pillars:

Information Theory (GCMI)

By default, Frites utilizes Gaussian Copula Mutual-Information (GCMI). This method is highly effective at detecting statistical dependencies (both linear and non-linear) between variables. GCMI is "agnostic" to data types, allowing it to be applied to local brain activity, cross-frequency coupling, or functional connectivity.

Functional Connectivity (FC)

The package includes specialized tools to estimate dynamic, time-resolved interactions. It supports both undirected (mutual information) and directed (Granger causality) interactions between brain regions on a single-trial basis.

Non-parametric Statistics

To manage the inherent noise in biological data, Frites employs permutation-based clustering. This approach allows for group-level inferences without assuming a normal distribution and includes built-in corrections for the multiple comparisons problem, reducing the risk of false positives across thousands of time points or brain regions.

Data Compatibility and Integration

As a software-focused contribution, Frites emphasizes compatibility with existing neurophysiological standards. It natively supports:

  • M/EEG: Non-invasive recordings with uniform spatial sampling.
  • iEEG/LFP: Invasive, spatially sparse recordings (intracranial EEG or Local Field Potentials).
  • Software Ecosystem: Frites integrates seamlessly with NumPy, MNE-Python (the industry standard for M/EEG), and Xarray for multi-dimensional labeled data.

Key Features and Performance

Frites is designed with a "workflow" philosophy, allowing researchers to move from raw neural data to group-level statistical maps with minimal code. Key technical features include:

  • Flexibility: Users can plug in custom estimators from libraries like scikit-learn or IDTxl.
  • Computational Efficiency: To handle the heavy load of information-theoretic calculations and permutation tests, Frites utilizes NumPy tensor-based implementations, Numba (Just-In-Time compilation), and Joblib for parallel processing.

Conclusion

Frites stands out in the Python ecosystem as a unique solution that combines information-theoretical approaches with flexible group-level analyses tailored for cognitive brain networks. It supports both fixed-effect and random-effect models, providing researchers with the tools to account for inter-subject variation. By wrapping complex mathematical operations into accessible workflows, Frites lowers the barrier to entry for advanced neurophysiological analysis. While currently focused on electrophysiological data, its modular design paves the way for future expansions into diverse connectivity measures and deep-learning integration.

Summary updated

BibTeX
@article{combrisson2022frites,
  author = {Etienne Combrisson and Ruggero Basanisi and Vinicius Lima Cordeiro and Robin A. A. Ince and Andrea Brovelli and Etienne Combrisson and Ruggero Basanisi and Vinícius Lima},
  title = {{Frites: A Python package for functional connectivity analysis and group-level statistics of neurophysiological data}},
  journal = {J. Open Source Softw.},
  year = {2022},
  doi = {10.21105/joss.03842},
}
Figure