cardioception.devices.beat_source.LSLBeatSource#
- class cardioception.devices.beat_source.LSLBeatSource(recorder, detector=None)[source]#
R peaks found online in the ECG of an
LSLRecorder.Pulls the recorder’s inlet and feeds the samples of its channel to an
OnlineRDetector. The anticipated period is the mean of the last 3 accepted RR intervals; an interval longer thanMAX_RRis taken for a gap in the signal and starts the count again, and one outsideRR_BANDtimes the median of the recent ones for a missed or extra beat, which is left out (see the module docstring).While this source is in use it is the only reader of the inlet: do not call the recorder’s
read,readInWaitingorwaitBeatat the same time, they would take samples the detector never sees.- Parameters
- recorder
A connected
LSLRecorder(anything withinlet,channelandsfreq).- detector
An
OnlineRDetector; one is made for the recorder’s rate if omitted.
Methods
__init__(recorder[, detector])poll()Beats committed since the last call.
start()Drop what the inlet holds and start detecting from now.
stop()Stop; the next
start()begins afresh.wait_next_beat(after[, timeout])Block until a beat with
r_time > afteris found, ortimeouts pass.Attributes
periodvirtualThis source follows a real heart.
n_rejectedRR intervals left out of the period as a missed or extra beat, since
start().n_samplesSamples fed to the detector since
start().last_sample_timeClock time at which the last sample arrived.