Setting up an experiment environment

  • NB: last update for OpenViBE 0.18.0

This document is based on an article from Yann Renard’s blog . It covers the use of the configuration file and configuration tokens to create a local experiment environment.

Introduction: the existing tokens

The configuration manager object provides access to different variables than can be used in OpenViBE, in any path or file name. The Configuration Manager dedicated page shows you how to set up the Designer and Acquisition Server configuration tokens (to show unstable drivers and boxes for example). We focuses here on the other tokens.

These configuration tokens can be divided in 3 groups:

  • the “openvibe” variables are those declared in the Kernel or in the local configuration file.
  • the “core” variables are predefined, and different each time they are called.
  • the “environment” variables are those declared in the operating system.

Here is a list of the existing variables. All paths are relative to the execution directory.

 

Group Variable Value
openvibe ${Path_Bin} ../bin
${Path_Lib} ../lib
${Path_Log} ../log
${Path_Root} ..
${Path_Samples} ../share/openvibe/scenarios
${Path_Tmp} ../tmp
${Path_Data} ..
core $core{date} Current date (y-m-d)
$core{index} A value incremented each time the variable is called
$core{random} Random value in [0,2^32]
$core{real-time} Time elapsed since start of the scenario
$core{time} Current time (h.m.s)
Environment $env{VariableName} Any environment variable set in the system
Other ${Player_ScenarioDirectory} Directory where the current scenario was loaded from
${__volatile_ScenarioDir} Directory where the current scenario was loaded from (deprecated name)

 

Setting up an experiment environment

The custom file that you can edit depending on your needs and preferences is ~/.config/openvibe/openviberc on Linux and @APPDATA@\openvibe\openvibe.conf on Windows. The syntax of the file 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}
# this is a comment

OpenViBE expands several box settings such as the filenames, thanks to the configuration manager. 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

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.

This entry was posted in Miscellaneous manual pages and tagged . Bookmark the permalink.