HEPPy is a simple, user friendly pipeline for extracting heartbeat-evoked potentials (HEPs) from EEG recordings that include an ECG channel. It provides a thin GUI to:
- run ecg analysis to detect R-peaks and generate per-file QRS plots;
- review those plots to make sure the R peaks are fitted properly.
- run HEP extraction using your QC decisions.
- Optional HRV metrics
Outputs are standard MNE objects on disk plus a summary CSV. Optionally, HEPPy can compute HRV metrics via NeuroKit2.
- Simple GUI wrapper over a robust MNE-Python pipeline.
- Automatic R-peak detection (+ manual RR hint when needed).
- QRS QC plots for rapid screening.
- Epoching and amplitude rejection around R-peaks (configurable).
- Error logs per file with full Python tracebacks.
- Optional HRV metrics (time/frequency/non-linear) via NeuroKit2.
- Works with EDF or FIF inputs; handles typical montages.
The GUI requires an input directory, and supplies defaults for other values. A config file can be set up to import new settings - recommended for reproducibilty/convenience.
While the underlying methods were written by myself, development of the streamlit-based app was largely AI driven. If you are using the GUI, be aware that there may be some glitches as a result. Let me know if there are any errors that pop up - which should display in the window.
HEPPy requires Python 3.8+ requirements.txt lists the required packages. To install, clone this repository and run:
pip install -r requirements.txtThe easiest way to run this is to load your python environment (with the installed requirements) and then run:
streamlit run heppy_gui.py- Prepare your EEG data files in a directory (EDF or FIF format) with an ECG channel.
- Launch the GUI using the command above.
- Select your input directory and configure parameters as needed.
- Run the ECG analysis to detect R-peaks and generate QRS plots. (optionally run HRV metrics)
- Review the QRS plots and make QC decisions.
- Run the HEP extraction using your QC decisions.
- Find the outputs in the specified output directory.
- Add statistical analysis options
- Add some sort of file grouping/handling (?regex etc.)
The paper "The heartbeat evoked potential and the prediction of functional seizure semiology" used the code herein to generate the epoched HEP data for the study. However, this was done using the script directly, as the GUI had not been built yet. It remains possible to use the code "headless" but you must manually plot and review the epochs for R-peak fit.
MIT. See LICENSE.
If you use HEPPy in a paper or product, please cite the preprint: The heartbeat evoked potential and the prediction of functional seizure semiology Rohan Kandasamy, Samia Elkommos, Ineke van Rossum, David Martin-Lopez, Akihiro Koreki, Fiona Farrell, Suzanne O’Sullivan, Beate Diehl, Fahmida Chowdhury, Hugo Critchley, Matthew Walker, Sarah Garfinkel, Mahinda Yogarajah medRxiv 2025.07.28.25332134; doi: https://doi.org/10.1101/2025.07.28.25332134
(Please check to see whether this has been updated with the accepted version of the paper)