bbci / bbci_public

MATLAB toolbox for Brain-Computer Interfacing (BCI)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reproducibility issues of online results with BrainVision Hardware

jsosulski opened this issue · comments

I was trying to exactly match the data from the online recordings of an EEG experiment with the recorded offline data using a BrainVision Amplifier System and the BBCI toolbox. The mex files were used as provided in the GitHub Repo. The result is that the signals available in the online pipeline are off by 0.1µV if the signal is negative.

For testing purposes I recorded only EEG noise without any cap attached to it. The signal was not preprocessed at all and recorded with a sampling rate of 1000Hz (This sampling rate was also set in the BrainVision Workspace), i.e. no subsampling was performed. After recording approximately 10 seconds of signal, I stopped the recording and compared the data that is available online in Matlab (using bbci_acquire_bv), with the data that was written to disk. The offline data I read using file_readBV. After matching the signal in the time domain exactly, I could observe that for positive signals, both offline and online data matched. However, for negative signal values, offline and online differ by 0.1µV (i.e. the resolution of the electrodes) in EEG channels. As the data is stored as INT16, this is an off-by-one error.

As the negative values of the online pipeline are +0.1µV larger than the offline values, I suspect an error that has to do with two-complement's and one-complement's interpretation of integer values. This error can be observed, when data is stored as two-complement's integer, but then interpreted as one-complement's integer. However, I do not know why that would happen with modern compilers.

If anyone has any ideas why that error occurs, please let me know. We are currently still investigating where this error is introduced.

Note:
It seems that the RDA implementation by BrainVision is not correct. The RDAClient example program provided by BrainVision reproduces the same deviations. We will contact them and inquire about whether this is a known problem.

FollowUp:
Issue was caused by BrainProducts hardware / driver. A Patch will be issued somewhen in December

Dear jsosulski,
thanks for spotting and identifying the bug. Very good detective work. For some reason, I did not receive notifications about the issue in April.
Best regards,
Benjamin