GitHub license GitHub release pre-commit pip black mypy Imports: isort Gitter


The Cardioception Python Package - Measuring Interoception with Psychopy - implements two measures of cardiac interoception (cardioception):

  1. The Heartbeat counting task (HBC), also known as the Heartbeat tracking task, developed by Rainer Schandry [Dale and Anderson, 1978, Schandry, 1981]. This task cardiac measures interoception by asking participants to count their heartbeats for a given period of time. An accuracy score is then derived by comparing the reported number of heartbeats and the true number of heartbeats.

  2. The Heart Rate Discrimination task [Legrand et al., 2022] implementing an adaptive psychophysical measure of cardiac interoception where participants have to estimate the frequency of their heart rate by comparing it to tones that can be faster or slower. By manipulating the difference between the true heart rate and the presented tone using different staircase procedures, the bias (threshold) and precision (slope) of the psychometric function can be estimated either online or offline (see Analyses below), together with metacognitive efficiency.


While having slightly similar names, the Heartbeat counting task (HBC) and the Heart Rate Discrimination task are different in term of implementation and the measures they provided and should not be conflated. We developped the cardioception package first to provide an open sourced version of the HBC, which was lacking, with easy support to record heart rate via cheap pulse oximetry via Systole. In addition to that, we developped the HRD task as a new measure of cardiac interoception [Legrand et al., 2022], grounding on a different reasonning and trying to control for the confounds other interoception tasks migh have.

These tasks can run using minimal experimental settings: a computer and a recording device to monitor the heart rate of the participant. The default version of the task use the Nonin 3012LP Xpod USB pulse oximeter together with Nonin 8000SM ‘soft-clip’ fingertip sensors. This sensor can be plugged directly into the stim PC via USB and will work with Cardioception without any additional coding required. The tasks can also integrate easily with other recording devices and experimental settings (ECG, M/EEG, fMRI…).

Looking for help?#

If you have questions regarding the tasks or want discuss data analysis, please ask on our public Gitter.

If you want to report a bug, you can open an issue on the GitHub page.


This package was created and is maintained by Nicolas Legrand and Micah Allen from the ECG group.