cardioception.devices.LSLRecorder#
- class cardioception.devices.LSLRecorder(name: Optional[str] = None, stream_type: Optional[str] = None, channel: Union[int, str] = 0, signal_type: str = 'ecg', add_channels: int = 1, marker_stream: Optional[str] = 'Cardioception', timeout: float = 10.0)[source]#
Record ECG or PPG from an LSL stream, with the surface of
Oximeter.- Parameters
- name
Name of the stream to read, e.g.
"PLUX". Either this orstream_typeis required.- stream_type
Type of the stream to read, e.g.
"ECG", when the name is not known in advance.- channel
The channel holding the heart signal: an index, or a label from the stream’s
channelsmetadata, e.g."ECG2".- signal_type
"ecg"or"ppg". Chooses the beat detector, and whether the tutorial asks for a pulse oximeter on the finger.- add_channels
Number of auxiliary channels, for trigger codes.
- marker_stream
Name of the LSL marker stream the trigger codes are sent to.
Nonesends nothing.- timeout
Seconds to look for the stream before giving up.
- Attributes
- lsl_timeslist of float
The LSL timestamp of each sample, on the clock LabRecorder writes.
- wall_timeslist of float
The same moments as
time.time(), to align with the results file.
- __init__(name: Optional[str] = None, stream_type: Optional[str] = None, channel: Union[int, str] = 0, signal_type: str = 'ecg', add_channels: int = 1, marker_stream: Optional[str] = 'Cardioception', timeout: float = 10.0)[source]#
Methods
__init__([name, stream_type, channel, ...])close()describe()What the recording is reading, for the session manifest.
read([duration])Record for
durationseconds.readInWaiting([stop])Append everything that has arrived since the last read, without waiting.
reset()Empty the buffers, keeping the connection.
save(fname)Write the recording, with beats found over the whole of it.
setup([read_duration])Start a new recording, as
Oximeter.setupdoes.waitBeat()Read until a beat arrives that was not there when this was called.