bsl.StreamRecorder

class bsl.StreamRecorder(record_dir=None, fname=None, stream_name=None, fif_subdir=True, *, verbose=False)[source]

Class for recording the signals coming from LSL streams.

Parameters:
record_dirNone | path-like

Path to the directory where data will be saved. If the directory does not exist, it is created. If None, the current working directory is used.

fnameNone | str

File name stem used to create the files. The StreamRecorder creates 2 files plus an optional third if a software trigger was used, respecting the following naming:

PCL: '{fname}-[stream_name]-raw.pcl'
FIF: '{fname}-[stream_name]-raw.fif'
(optional) SOFTWARE trigger events: '{fname}-eve.txt'
stream_namelist | str | None

Servers’ name or list of servers’ name to connect to. If None, connects to all the available streams.

fif_subdirbool

If True, the .pcl files are converted to .fif in a subdirectory 'fif': record_dir/fif/... instead of record_dir.

verbosebool

If True, a timer showing since when the recorder started is displayed every seconds.

Attributes

eve_file

Path to the event file for SoftwareTrigger.

fif_subdir

If True, the .pcl files are converted to .fif in a subdirectory.

fname

File name stem used to create the files.

process

Launched process.

record_dir

Path to the directory where data will be saved.

state

Recording state of the recorder.

stream_name

Servers' name or list of servers' name to connect to.

verbose

If True, a timer showing since when the recorder started is displayed.

Methods

start([blocking])

Start the recording in a new process.

stop()

Stop the recording.

start(blocking=True)[source]

Start the recording in a new process.

Parameters:
blockingbool

If True, waits for the child process to start recording data.

stop()[source]

Stop the recording.

property eve_file

Path to the event file for SoftwareTrigger.

Type:

Path

property fif_subdir

If True, the .pcl files are converted to .fif in a subdirectory.

Type:

bool

property fname

File name stem used to create the files.

The StreamRecorder creates 2 files plus an optional third if a software trigger was used, respecting the following naming:

PCL: '{fname}-[stream_name]-raw.pcl'
FIF: '{fname}-[stream_name]-raw.fif'
(optional) SOFTWARE trigger events: '{fname}-eve.txt'
Type:

str

property process

Launched process.

Type:

Process

property record_dir

Path to the directory where data will be saved.

Type:

Path

property state

Recording state of the recorder.

  • 0: Not recording.

  • 1: Recording.

Type:

Value

property stream_name

Servers’ name or list of servers’ name to connect to.

Type:

str | list

property verbose

If True, a timer showing since when the recorder started is displayed.

Type:

bool

Examples using bsl.StreamRecorder

StreamPlayer: simulate an LSL stream

StreamPlayer: simulate an LSL stream

StreamRecorder: resting-state recording

StreamRecorder: resting-state recording

StreamReceiver: real-time buffer filtered with a causal filter

StreamReceiver: real-time buffer filtered with a causal filter

StreamReceiver: real-time alpha band power

StreamReceiver: real-time alpha band power