CSV File format description

  • NB: last update for OpenViBE 2.0 (sep-2017).

Introduction

CSV files are text files with different values separated by a special character. This basic syntax makes them very easy to parse.
OpenViBE 2.0 version uses a new  CSV Reading/Writing module. The file format for each stream data is described in this post with an associated example file for an easier description.

Signal stream file (non overlapping epochs)

Time:8Hz,Epoch,O1,O2,Pz,P1,P2,Event Id,Event Date,Event Duration
0.00000,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.12500,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.25000,0,-20.20,-10.10,0.0,10.10,20.20,32000:32010,0.25000:0.25000,0:0
0.37500,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.50000,1,-80.80,-40.40,0.0,40.40,80.80,,,
0.62500,1,-80.80,-40.40,0.0,40.40,80.80,,,
0.75000,1,-80.80,-40.40,0.0,40.40,80.80,35000,0.75250,0
0.87500,1,-80.80,-40.40,0.0,40.40,80.80,,,
1.00000,2,-320.320,-160.160,0.0,160.160,320.320,,,

Timestamp and sampling rate

The first header column – Time:8Hz – contains two pieces of information:

  • First column will contain timestamp information
  • The sampling rate of the current file is 8Hz

The timestamp field will contain information about the time at which the matrix/events were received. Note that it is redundant with the sampling rate. In case of signal, the sampling rate should be used by reader boxes otherwise the timestamps should be used. Note that the timestamps can suffer rounding errors.
In signal stream file, timestamp is a Time-point timestamp: representing a point in time (e.g.: 1.00000 represents the time at 1 second).

Epoch

Second header column with label – Epoch – will contain Epoch index.

Matrix data

Next five columns  – O1,O2,Pz,P1,P2 –  represent the names of channels.
Matrix data columns simply carry the data information, recorded in floating format with arbitrary precision.

Events

Finally the Events columns – Event Id,Event Date,Event Duration – will contain information about stimulations:

  • Event Id: data will be a list of stimulations identifier separated by :
  • Event Date: data will be a list of date in seconds associated to the stimulations and separated by :
  • Event Duration: data will be a list of durations in seconds associated to the stimulations and separated by :

Events are recorded as numbers, several events can be present on the same line (timestamp) separated by colons.
Examples:

  • Single event: 35001
  • Multiple events: 35800:32000

Signal stream file with overlapping epochs

In this example, the signal file has overlapping epochs (each epoch is 0.5 second long and each epoch is separated from the previous one by 0.250 seconds)

Time:8Hz,Epoch,O1,O2,Pz,P1,P2,Event Id,Event Date,Event Duration
0.00000,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.12500,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.25000,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.37500,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.25000,1,-80.80,-40.40,0.0,40.40,80.80,,,
0.37500,1,-80.80,-40.40,0.0,40.40,80.80,,,
0.50000,1,-80.80,-40.40,0.0,40.40,80.80,,,
0.62500,1,-80.80,-40.40,0.0,40.40,80.80,,,
0.50000,2,-320.320,-160.160,0.0,160.160,,,
0.62500,2,-320.320,-160.160,0.0,160.160,,,

Signal stream file with holes in epochs

For example after a stimulation based epoching

Time:8Hz,Epoch,O1,O2,Pz,P1,P2,Event Id,Event Date,Event Duration
0.00000,0,-20.20,-10.10,0.0,10.10,20.20,35000,0.00000,0
0.12500,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.25000,0,-20.20,-10.10,0.0,10.10,20.20,,,
0.37500,0,-20.20,-10.10,0.0,10.10,20.20,,,
1.50000,1,-80.80,-40.40,0.0,40.40,80.80,35000,1.50000,0
1.62500,1,-80.80,-40.40,0.0,40.40,80.80,,,
1.75000,1,-80.80,-40.40,0.0,40.40,80.80,,,
1.87500,1,-80.80,-40.40,0.0,40.40,80.80,,,
2.00000,2,-320.320,-160.160,0.0,160.160,35000,2.00000,0
2.12500,2,-320.320,-160.160,0.0,160.160,,,

Spectrum Stream file

Here is a spectrum file with 2 channels, 128Hz signal and spectra calculated on periods of 1 second every 0.125 seconds
The last element in the Time column (128) represents the original sampling rate.
The timestamp is of type Time-span which represents a period of time (e.g: 1.00000:1.10000 representing time between 1 and 1.1 seconds)
Time-span timestamps are divided into two columns, the first column remains identical to Time-point type, the second column is labeled End Time
The Time-span timestamps is used for metrics and spectral data or any other data that is calculated on a period of time which can potentially overlap.

Time:2x64:128,End Time,O1:0,O1:1.015873,...,O1:64,O2:0,...,O2:64,Event Id,Event Date,Event Duration
0.00000,1.00000,x,x,...,x,x,...,x,
0.12500,1.12500,x,x,...,x,x,...,x,
0.25000,1.25000,x,x,...,x,x,...,x,32000:32010,0.25100:1.00000,0:0
0.37500,1.37500,x,x,...,x,x,...,x,
0.50000,1.50000,x,x,...,x,x,...,x,
0.62500,1.62500,x,x,...,x,x,...,x,
0.75000,1.75000,x,x,...,x,x,...,x,35000,1.750000,0
0.87500,1.87500,x,x,...,x,x,...,x,
1.00000,2.00000,x,x,...,x,x,...,x,
1.12500,2.12500,x,x,...,x,x,...,x

 

Streamed Matrix stream file

Here is a Streamed Matrix file with 2x2x2 matrices produced every 0.125 seconds and spanning one second.
Let the labels be

  • for first dimension “LA”, “LB”
  • for second dimension “1”, “2”
  • for third dimension “X”, “Y”
Time:2x2x2,End Time,LA:1:X,LA:1:Y,LA:2:X,LA:2:Y,LB:1:X,...,LB:2:Y,Event Id,Event Date,Event Duration
0.00000,1.00000,x,x,x,x,x,...,x,
0.12500,1.12500,x,x,x,x,x,...,x,
0.25000,1.25000,x,x,x,x,x,...,x,32000:32010,0.25100:1.00000,0:0
0.37500,1.37500,x,x,x,x,x,...,x,
0.50000,1.50000,x,x,x,x,x,...,x,
0.62500,1.62500,x,x,x,x,x,...,x,
0.75000,1.75000,x,x,x,x,x,...,x,35000,0.80000,0
0.87500,1.62500,x,x,x,x,x,...,x,
1.00000,2.00000,x,x,x,x,x,...,x,
1.12500,2.12500,x,x,x,x,x,...,x,

Feature Vector stream file

The feature vector stream is a stream matrix stream of dimension 1.
In this example, the feature vector contains 3 features,is produced every seconds and is spanning one second.

Time:3,End Time,F1,F2,F3,Event Id,Event Date,Event Duration
0.0000000000,1.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
1.0000000000,2.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
2.0000000000,3.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
3.0000000000,4.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
4.0000000000,5.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
5.0000000000,6.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
6.0000000000,7.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,35001,6.5000000000,1.0000000000
7.0000000000,8.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
8.0000000000,9.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,35001,8.5000000000,1.0000000000
9.0000000000,10.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,,,
10.0000000000,11.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,35001,10.5000000000,1.0000000000

Covariance Matrix stream file

This file example shows a block of N covariance(s) matrix(ces) computed on a signal of C channel(s).
Then the Time header become Time:CxCxN

Time:2x2x2,End Time,C1:C1:Matrix 1,C1:C1:Matrix 2,C1:C2:Matrix 1,..,C2:C2:Matrix 2,Event Id,Event Date,Event Duration
0.0000000000,1.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
1.0000000000,2.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
2.0000000000,3.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
3.0000000000,4.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
4.0000000000,5.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
5.0000000000,6.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
6.0000000000,7.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
7.0000000000,8.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
8.0000000000,9.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,
9.0000000000,10.0000000000,-20.2000000000,-15.1500000000,-10.1000000000,..,20.2000000000,,,

 

This entry was posted in Data formats documentation. Bookmark the permalink.