GastroPy: An Open-Source Python Toolbox for Electrogastrography Signal Processing and Gastric-Brain Coupling Analysis

Read the full article See related articles

Discuss this preprint

Start a discussion What are Sciety discussions?

Listed in

This article is not in any list yet, why not save it to one of your lists.
Log in to save this article

Abstract

Electrogastrography (EGG) is a non-invasive technique for recording gastric myoelectrical activity via cutaneous abdominal electrodes. Recent advances in concurrent EGG-fMRI have revealed phase synchrony between the gastric rhythm and resting-state brain networks, opening a new window into brain-body interactions, interoception, and mental health. Despite growing interest, the field lacks a dedicated open-source software toolkit for EGG analysis in Python. Here we present GastroPy, a modular Python package for EGG signal processing and gastric-brain coupling analysis. GastroPy provides a full EGG processing pipeline, including spectral analysis, bandpass filtering, phase extraction, cycle-level metrics, and phase-based artifact detection. It also supports multichannel processing via ICA-based spatial denoising, time-domain preprocessing for spike and movement artifact removal, and time-frequency decomposition. A dedicated neuroimaging module supports the complete EGG-fMRI coupling workflow, including scanner trigger alignment, confound regression, voxelwise BOLD phase extraction, and whole-brain phase-locking value (PLV) mapping with surrogate-based statistical testing. The package also supports named, citable preprocessing pipelines to improve reproducibility across labs.Built on NumPy and SciPy, with optional integration of MNE-Python and nilearn (Abraham et al., 2014), GastroPy separates core signal processing from neuroimaging workflows and includes bundled sample data for tutorials and testing. GastroPy is freely available under the MIT license at [https://github.com/embodied-computation-group/gastropy](https://github.com/embodied-computation-group/gastropy).

Article activity feed