bci2000chain

Known Issues and Problems with BCI2000
Post Reply
ecolamarino
Posts: 5
Joined: 09 Aug 2020, 05:24

bci2000chain

Post by ecolamarino » 09 Aug 2020, 05:46

Hi,
I would like to reproduce a BCI2000 processing chain offline, exploring the effect of parameter changes and specifically the effect of NormalizerGains parameter changes. My data have been acquired by means a 2D-Cursor Task Application Module. I've used "bci2000chain" Matlab function as follows

olddir = pwd;
cd('C:\Users\Emma\Desktop\BCI2000')
cd tools, cd matlab
bci2000path -AddToMatlabPath tools/matlab
bci2000path -AddToMatlabPath tools/mex
bci2000path -AddToSystemPath tools/cmdline
cd(olddir)
clear olddir

%% Loading BCI2000 dat file and apply bci2000chain function
fn = bci2000path('data','prova','prova_file.dat');

s1=bci2000chain(fn, 'ARSignalProcessing');
s2=bci2000chain(fn, 'ARSignalProcessing', 'ExampleParameters1.prm'); % ExampleParameters1.prm is a prm file contaning information about the desidered NormalizerGains parameter value
s3=bci2000chain(fn, 'ARSignalProcessing', 'NormalizerGains', [0; 4]);

In the structure s1 I've found the BCI control feature, matrix size [time_points x 2], and the States (CursorPos, Result Code) I expected. Instead, in the structures s2 and s3 I've found a BCI control feature, matrix size [time_point x 1], containing all zero values and the same States of the structure s1. Could anyone help me in understanding which is wrong in my implementation, please?
Thank you
Emma

mellinger
Posts: 1210
Joined: 12 Feb 2003, 11:06

Re: bci2000chain

Post by mellinger » 10 Aug 2020, 13:04

I don't know the contents of your .prm file, so I don't know if there is a problem. Any way, you cannot use Matlab vectors in .prm files. You have to write

Code: Select all

Filtering list NormalizerGains= 2 0 4
Version 3 looks correct, though.

ecolamarino
Posts: 5
Joined: 09 Aug 2020, 05:24

Re: bci2000chain

Post by ecolamarino » 11 Aug 2020, 10:07

Thank you very much for your reply. The contents of the prm file are exactly those you posted in the reply :-(
Emma

jhill
Posts: 34
Joined: 17 Nov 2009, 15:15

Re: bci2000chain

Post by jhill » 12 Aug 2020, 16:49

Hi Emma,

Could you post a filebin.net link (or public Google Drive or Dropbox link, or similar) to the .dat file you're using, so that we can try to replicate this?

Any or all of the syntax variants you're using should work (yes, you can use Matlab vectors) but I don't know why you would be getting just a one-channel output when a similar configuration had previously correctly delivered two.

This may be a bug. Can you tell us which version of BCI2000 you're using? The way to find out: in Matlab, after configuring your paths the way you did, type this:

Code: Select all

>>  ! bci_dat2stream --version
and copy-paste everything it outputs.

Best regards, --jez

ecolamarino
Posts: 5
Joined: 09 Aug 2020, 05:24

Re: bci2000chain

Post by ecolamarino » 17 Aug 2020, 11:24

Hi,
thanks for your reply. Here the link to the folder where one of the dat files I used is: https://drive.google.com/drive/folders/ ... sp=sharing.
About the BCI2000 version, I've tried with 2 versions:
1)
bci_dat2stream Version: 3.6 BETA.5570.5
Source Revision: 5570.5
Source Date: 2016-10-12T19:27:33Z
Build Date: 2016-10-16T14:46:24Z
Build Type: release
Build User: user@user-PC
Compiler: MSVC-17.0.61030.0-AMD64
2)
bci_dat2stream $Version: 3.0.5
Revision: 4229
Source Date: 2012/07/03 18:02:30
Build Date: 2012/07/03 20:12:06
Compiler: MSVC $

Thank you very much
Emma

jhill
Posts: 34
Joined: 17 Nov 2009, 15:15

Re: bci2000chain

Post by jhill » 18 Aug 2020, 17:17

Thank you for uploading the file.

We have a number of bugs to fix in the command-line binaries so it's been a little hard to replicate your problem exactly. Maybe your problem is a manifestation of one of these bugs - we'll have a more definitive answer within the next few weeks.

Immediately there's one strange thing I see about the parameters in your .dat file: the Classifier parameter only has one row, yet it addresses output signal number 2. First you appear to be using the SpatialFilter parameter to select just one channel, EEG1: OK. Then you compute its spectrum in 2-Hz bins: also fine. Your Classifier then takes the 7th frequency bin from that single-channel spectrum, negates it, and calls the result "output number 2". You don't define output number 1. So I would expect the first output signal to be all zeros whatever else happens.

For me, using revision 5738, the component that seems to reduce your output to one signal rather than two is the ExpressionFilter, which you don't use anyway. That's a bug, I think, but one workaround worth attempting would be to explicitly omit it from your chain (i.e. use 'TransmissionFilter|SpatialFilter|ARFilter|LinearClassifier|LPFilter|Normalizer' instead of 'ARSignalProcessing').

ecolamarino
Posts: 5
Joined: 09 Aug 2020, 05:24

Re: bci2000chain

Post by ecolamarino » 21 Aug 2020, 09:03

Thank you very much for your reply.
I've just omitted the ExpressionFilter, i.e. applying the chain 'TransmissionFilter|SpatialFilter|ARFilter|LinearClassifier|LPFilter|Normalizer', and the output has two signals rather than one. Therefore, changing the NormalizerGains results in different signals :)
Do you know if there is a way I can also display the states ResultCode or CursorPos that I would have with the new control signal obtained after chaning the normalizer gain, please?

About your considerations "Immediately there's one strange thing I see about the parameters in your .dat file: the Classifier parameter only has one row, yet it addresses output signal number 2. First you appear to be using the SpatialFilter parameter to select just one channel, EEG1: OK. Then you compute its spectrum in 2-Hz bins: also fine. Your Classifier then takes the 7th frequency bin from that single-channel spectrum, negates it, and calls the result "output number 2". You don't define output number 1. So I would expect the first output signal to be all zeros whatever else happens.", it is what I want to do.

Thanks again
Best regards,
Emma

jhill
Posts: 34
Joined: 17 Nov 2009, 15:15

Re: bci2000chain

Post by jhill » 24 Aug 2020, 10:45

Good to know it's working. We'll investigate the issue with `ExpressionFilter`. If `ResultCode` and `CursorPos` are generated by a Filter in the Application module, then I think there will not be a corresponding command-line tool, so they would not be available from `bci2000chain`. As far as I know, only filters from a SignalProcessing module can be run offline from the command line, and it would be non-trivial to adapt Application filters for this purpose.

ecolamarino
Posts: 5
Joined: 09 Aug 2020, 05:24

Re: bci2000chain

Post by ecolamarino » 26 Aug 2020, 12:39

Thank you very much :)
Emma

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests