API#

Tasks#

Heart Rate Discrimination task#

Parameters#

getParameters([participant, session, ...])

Create Heart Rate Discrimination task parameters.

Configuration#

TaskConfig([respMax, minRatingTime, ...])

Design factors an experimenter is likely to want to change.

Scripts#

run(parameters[, confidenceRating, runTutorial])

Run the Heart Rate Discrimination task.

trial(parameters, alpha, modality[, ...])

Run one trial of the Heart Rate Discrimination task.

tutorial(parameters)

Walk the participant through the task before it starts.

confidenceRatingTask(parameters)

Confidence rating scale, using keyboard or mouse inputs.

Languages#

available([texts_dir])

Languages that can be passed as language.

get_texts(language, device, exteroception[, ...])

Every string this session will show the participant.

Heartbeat Counting task#

Parameters#

getParameters([participant, session, ...])

Create Heartbeat Counting task parameters.

Scripts#

run(parameters[, runTutorial])

Run the entire task sequence.

trial(condition, duration, nTrial, parameters)

Run one trial.

tutorial(parameters)

Run tutorial for the Heartbeat Counting Task.

rest(parameters[, duration])

Run a resting state period for heart rate variability before running the Heart Beat Counting Task.

Languages#

available()

Languages that can be passed as language.

get_texts(language)

Every string this session will show the participant.

Phase Adjustment Task#

Beta, after the PAT-ECG of Hodgetts et al. (2026); see the PAT page.

Parameters#

getParameters([participant, session, ...])

Create Phase Adjustment Task parameters.

startPhaseSequence(n[, phases, rng])

Draw the start phase of each trial, as the PAT-ECG firmware does.

Scripts#

run(parameters[, runTutorial, confidenceRating])

Run the Phase Adjustment Task.

trial(parameters, trialNumber, block, startPhase)

Run one trial of the Phase Adjustment Task.

tutorial(parameters)

Guide the participant through the wheel on free beats.

dialLoop(parameters, trialNumber, block, ...)

Run the engine and the dial until space ends the last stage.

confidenceRatingTask(parameters)

Confidence rating, with the wheel and arrow keys or with the mouse.

Engine#

PhaseEngine(source, player, mode[, ...])

Play one tone per heartbeat at the phase set with the dial.

Scoring#

consistency_grid(final_df[, n_sim, q, seed, k])

Score one participant on the 2 x 2 x 2 grid of Hodgetts et al. (2026).

mean_resultant_length(theta[, weights])

Mean resultant length of a set of angles.

phase_angles(delay_ms, period_ms)

Turn delays after the R-wave into phase angles of the cardiac cycle.

monte_carlo_threshold(periods_ms, n_trials)

Chance threshold for the mean resultant length, by Monte Carlo.

extero_threshold(n_trials[, period_ms, ...])

Chance threshold for the exteroceptive task with a fixed period.

mad_outliers(x[, k, min_sd])

Flag values more than k robust standard deviations from the median.

Languages#

available()

Languages that can be passed as language.

get_texts(language[, device, extero, low, ...])

Every string this session will show the participant.

Heartbeat Synchrony Discrimination task#

Beta; see the design document and the HSD page.

Parameters#

getParameters([participant, session, setup, ...])

Create Heartbeat Synchrony Discrimination task parameters.

Configuration#

TaskConfig([axis, nTones, minTones, ...])

Design factors of an HSD session.

Scripts#

run(parameters[, confidenceRating, runTutorial])

Run the Heartbeat Synchrony Discrimination task.

trial(parameters, nTrial[, ...])

Run one trial of the Heartbeat Synchrony Discrimination task.

tutorial(parameters)

Walk the participant through the task before it starts.

Engine#

SynchronyPsi(delays[, mu, sigma, floor, ...])

Posterior over the envelope parameters, and the next delay to test.

gaussian_envelope(d, mu, sigma, floor, peak)

Probability of a "simultaneous" judgement at delay d.

default_grids([max_delay, mu_step, n_sigma])

Parameter grids wide enough for the published range of observers.

Languages#

available()

Languages that can be passed as language.

get_texts(language, device)

Every string this session will show the participant.

Recording devices#

ContinuousOximeter(*args, **kwargs)

Oximeter with an O(1) add_paquet, and a clock on every packet.

LSLRecorder([name, stream_type, channel, ...])

Record ECG or PPG from an LSL stream, with the surface of Oximeter.

ReplayRecorder([bpm, sfreq, realtime, ...])

Stand-in for systole.recording.Oximeter.

Beat sources and tone player#

Shared by the Phase Adjustment Task and the Heartbeat Synchrony Discrimination task, which time their tones from the R-wave.

LSLBeatSource(recorder[, detector])

R peaks found online in the ECG of an LSLRecorder.

VirtualBeatSource([period, seed, clock, lead_in])

Beats known in advance, for the exteroceptive task.

TonePlayer([freq, duration, ramp, volume, ...])

Tones and vibration bursts at scheduled times, through PsychPortAudio.

Confidence scales#

ConfidenceScale([kind, low, high, ...])

How confidence is collected and what its numbers mean.