cardioception.devices.ReplayRecorder#

class cardioception.devices.ReplayRecorder(bpm=60.0, sfreq=75, realtime=False, add_channels=1, rng=None, artefact_every=None)[source]#

Stand-in for systole.recording.Oximeter.

Parameters
bpm

Heart rate to synthesise, in beats per minute. A sequence is consumed one entry per read call, which lets a test drive the rate over the course of a session.

sfreq

Sampling frequency, matching the Nonin default the tasks assume.

realtime

When False (the default here, unlike real hardware) read returns as soon as it has generated the samples, rather than waiting for them to arrive.

add_channels

Number of auxiliary channels, for trigger codes.

rng

Generator for the noise, so a seeded session replays identically.

artefact_every

When set, every Nth read produces a signal with no detectable beats, to exercise the task’s retry path.

__init__(bpm=60.0, sfreq=75, realtime=False, add_channels=1, rng=None, artefact_every=None)[source]#

Methods

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

close()

read([duration])

Append duration seconds of signal.

readInWaiting()

Append the handful of samples that would have arrived meanwhile.

save(path)

Record that a save happened, without writing megabytes in a test.

setup()

Clear the buffers, as Oximeter.setup does.

Attributes

trigger_codes

Every marker written, including those cleared by a reset.