Skip to content

How to synchronize OpenMATB with neurophysiological streams?

Benoît Valéry edited this page Apr 7, 2023 · 2 revisions

You should read how to write correctly a scenario file first.

In OpenMATB, there are two ways to synchronize your data with neurophysiological devices, corresponding to two plugins: the labstreaminglayer plugin, and the parallelport plugin.

The labstreaminglayer plugin

Presentation

When you want to add neurophysiological measurements to your experiment, the most efficient way is to synchronize your various devices through the LSL protocol (see this page). OpenMATB offers the possibility to add a dedicated stream to your LSL setup.

Basic operations

The use of the labstreaminglayer plugin is straight. Once started (at the top of your experiment), you can use the marker parameter to send any marker you want. For instance, if you want to send Block-1 at 30 seconds, just do the following :

0:00:00;labstreaminglayer;start
0:00:30;labstreaminglayer;marker;Block-1
[...]

This marker will be available in an OpenMATB stream, that you can catch with a dedicated recorder. You can also decide to stream the whole session information into the OpenMATB outlet, with the streamsession parameter set to True. If so, the output stream will contain all the log information of the session (which is also available in the sessions/ directory).

Last but not least, you have the possibility to trigger a pause at labstreaminglayer startup, by setting pauseatstart to True. It can be very useful to give you the time to add the OpenMATB stream to your record after it has been created: to do so, just set pauseatstart to True, before the plugin is started.

List labstreaminglayer parameters

Variable Description Possible values Default
marker Set this parameter with a string chain to send it through LSL (string) (empty)
streamsession Should the whole session log be streamed through LSL? (boolean) False
pauseatstart Should a pause screen be proposed at LSL start, to allow the user to add the stream in the LabRecorder? (boolean) False

The parallelport plugin

Presentation

Parallel port is a more traditional way to send physical marker to compatible neurophysiological devices, so as to synchronize them to your experimental scenario.

Basic usage

The usage of parallelport plugin is even more simple than the labstreaminglayer plugin. Just start the plugin, and send trigger when desired. Be careful that, with parallel ports, you must send 8-bits values (1-256). So, for instance, sending the 40 values at 30 seconds would be achieved like this:

0:00:00;parallelport;start
0:00:30;parallelport;40
[...]

Depending on your setup, you might want to adjust the duration of the impulse, with the delayms parameter. After this delay, the parallel port will automatically turn back to its default state (0).

List of parallelport parameters

Variable Description Possible values Default
trigger Set this parameter with a 8-bit integer (1-256), to change the parallel port state (positive integer) 0
delayms Delay (ms) before the parallel port is set back to its default value (0) (positive integer) 5