Setting up an experiment environment

Doing a scientific experiment generally involves some methodology in order to store / organize / backup the recorded data in a convenient way. OpenViBE proposes a few tools for this, mainly thanks to the configuration manager, and this is what I want to blog about today.

The configuration manager basically stores a list of token name / token value pairs. It also proposes a service to expand a token name to a token value or more generally, to expand the token names contained in a string. The list of tokens are stored in a configuration file, usually share/openvibe.conf. By default, this configuration file includes a custom file that you can edit depending on your needs and preferences : ~/.openviberc on Linux and C:\Document & Settings\your-name\openvibe.conf on Windows. The syntax is quite simple : 1 line per token, token name = token value, e.g. :

Example1 = this is an example
Example2 = this is another example
Example3 = Example 1 is ${Example1}

OpenViBE expands several box settings such as the filenames, thanks to the configuration manager (it should do so for all the settings in the future). For example, if you put this in your configuration file :

ExperimentPath = /home/me/openvibe-data/signals

Then your file writer boxes (be it GDF, OpenViBE, CSV or whatever other box writer) could use a filename such as ${ExperimentPath}/record.gdf

It is also important not to overwrite existing files. While doing an experiment, you will probably have to run the scenario several times for different subjects. The core prefix helps in doing so : each time a token name preceded with the core prefix is requested, the configuration manager dynamically updates its value. For example, $core{time} returns the current time and $core{date} returns the current date. So based on what was proposed earlier, the filenames could use something like ${ExperimentPath}/record-$core{date}-$core{time}.gdf

Any configuration filename that overrides the settings of your boxes can use the same syntax. You can also configure the results of trained classifiers or spatial filter the same way, as shown in the sample xDAWN P300 speller scenarios.

Finally, you can use a token value inside a token name. Suppose you have a configuration file with :

Current = Experiment1
CurrentPath = ${${Current}Path}

In this example, CurrentPath will automatically be expanded to ${Experiment1Path}. To take advantage of this, you could add the following to your configuration file :

## Configures what experiment is being performed
# ExperimentName = MotorImagery
ExperimentName = P300Speller
# ExperimentName = Neurofeedback

## Configures who is doing the experiment
SubjectName = yann.renard
# SubjectName = someone
# SubjectName = noname

ExperimentMotorImageryPath = /openvibe-data/motor-imagery
ExperimentP300SpellerPath = /openvibe-data/p300-speller
ExperimentNeurofeedbackPath = /openvibe-data/neurofeedback

ExperimentPath = ${Experiment${ExperimentName}Path}

ExperimentFilename = ${ExperimentPath}/record-${SubjectName}-$core{date}-$core{time}.gdf

The interesting line here is ExperimentPath = ${Experiment${ExperimentName}Path} that allows you to quickly switch from an experiment environment to another, depending on a single token : ExperimentName

In the future, I think allowing any box setting to be expanded by the configuration manager would be very valuable. Also, I think we could alter the configuration based on a per-directory or/and per-scenario custom configuration… Allowing more and more flexibility…

Of course, the Run Command box I wrote about a few weeks ago now expands its commands this way (was not the case in 0.5.0) allowing you to have e.g. a ${PlaySound} beep.ogg command while the PlaySound token is set in your configuration file to whatever sound player you prefer 😉

Comments are closed.