bsl.StreamRecorder#

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

Class for recording the signals coming from LSL streams.

Parameters
  • record_dir (None | 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.

  • fname (None | 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_name (list | str | None) – Servers’ name or list of servers’ name to connect to. If None, connects to all the available streams.

  • fif_subdir (bool) – If True, the .pcl files are converted to .fif in a subdirectory 'fif': record_dir/fif/... instead of record_dir.

  • verbose (bool) – 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 'fif': record_dir/fif/... instead of record_dir.

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 every seconds.

Methods

start([blocking])

Start the recording in a new process.

stop()

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 'fif': record_dir/fif/... instead of record_dir.

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

start(blocking=True)#

Start the recording in a new process.

Parameters

blocking (bool) – If True, waits for the child process to start recording data.

property state#

Recording state of the recorder

  • 0: Not recording.

  • 1: Recording.

Type

multiprocessing.Value

stop()#

Stop the recording.

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 every seconds.

Type

bool