No Signal in bci2000chain

This forum deals with BCI2000 configuration issues.
Post Reply
inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

No Signal in bci2000chain

Post by inesplc » 29 Apr 2016, 05:58

Hi all,

I am currently trying to check the output of my SignalProcessing offline using the bci2000chain in matlab.
During runtime, I can visualize both the data signal (using 32-channel BioSemi) and the output signal (I am running MatlabFilter only) without a problem.

However, later when I feed the data to the bci2000chain s.Signal is an empty array, s.Blocks is zero and s.ShellOutput gives me the following error:

Code: Select all

Runtime Error: HandleVisSignal: Ignored signal with inconsistent properties
The data itself is 28 seconds long, sampled at 512Hz with 25 SampleBlockSize, so I'm not sure why it shows the number of block as zero...
This is using the BCI2000Contrib version, running Windows 10 and MatlabR2015b 32-bit.

Any idea on what might be wrong?

Thank you,
Inês

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 09 May 2016, 11:43

Inês,

to isolate the issue, can you please let me know which version of BCI2000 you are using? If this is not the latest SVN source build, can you please check the latest beta (see link below) to see whether this bug still persists in this version?

http://www.bci2000.org/phpbb/viewtopic.php?f=1&t=2955

Regards, Peter

inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

Re: No Signal in bci2000chain

Post by inesplc » 10 May 2016, 13:03

Hi Peter,

Thanks again for always replying.
I downloaded the latest beta version from May 9th and tried to reproduce my problem but could not run the 32-bit bci200chain command due to the following error, which also happens when trying to use MatlabSignalProcessing online with versions other than the Contrib:

Code: Select all

Error using bci2000chain (line 403)
chain must have failed: no 'Index' variable found in C:\Users\INS~1\AppData\Local\Temp\tp4d8c6a26_5eb1_4264_b67c_1c7d5c4168a4\out.mat
Shell output was as follows:
Waiting for Matlab engine to start up ...
Runtime Error: MatlabFilter::Publish: Could not load functions from dynamic library "libmx" due to an error: Function mxErrMsgTxt not
found in library
An update to that library/driver may be necessary. More information may be available at:
http://www.google.com/search?q=site%3abci2000.org+libmx.
Could not load functions from dynamic library "libmx" due to an error: Function mxErrMsgTxt not found in library
An update to that library/driver may be necessary. More information may be available at:
http://www.google.com/search?q=site%3abci2000.org+libmx
Function: Dylib::StartupLoader::ThrowError()
File: C:\BCI2000.x32\src\shared\utils\Lib\DylibImports.cpp
[2 more lines omitted]
However, I just tried running it with vs305 and gave me a similar error as before:

Code: Select all

Runtime Error: HandleVisSignal: Ignored signal with inconsistent properties
Runtime Error: MatlabFilter::Process: Could not put value into "bci_InSignal"
Runtime Error: MatlabFilter::Process: Matlab function "bci_Process": Could not execute Matlab command:
bci_Error=''; try [bci_OutSignal]=bci_Process(bci_InSignal); catch bci_Error=lasterr; end;
Runtime Error: MatlabFilter::Process: Could not read "bci_States.BatteryLow" from Matlab workspace
Runtime Error: MatlabFilter::Process: Could not get scalar value "bci_States.BatteryLow"
Any suggestions on how to proceed?
Thank you,
Inês

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 10 May 2016, 16:15

Inês,

I cannot replicate your issue on my system (Win 7, 64-bit, MATLAB 64-bit 2015a) using the R5348 beta. Please see the output below.

Which version of Windows and MATLAB are you using?

Regards, Peter

Code: Select all

>> cd BCI2000.x32\
>> cd tools
>> cd matlab
>> ExampleBCI2000Chain
adding to the Matlab path:  C:\BCI2000\BCI2000 v3.6.beta.R5348\BCI2000.x32\tools\mex
adding to the Matlab path:  C:\BCI2000\BCI2000 v3.6.beta.R5348\BCI2000.x32\tools\matlab
adding to the operating-system PATH:  C:\BCI2000\BCI2000 v3.6.beta.R5348\BCI2000.x32\tools\cmdline

s = 

             FileName: 'C:\BCI2000\BCI2000 v3.6.beta.R5348\BCI2000.x32\data\samplefiles\eeg3_2.dat'
              DateStr: '2009-03-05 12:22:12'
              DateNum: 7.3384e+05
          FilterChain: {'TransmissionFilter'  'SpatialFilter'  'ARFilter'}
         ToolVersions: [1x1 struct]
           ShellInput: 'bci_dat2stream -pC:\Users\user\AppData\Local\Temp\tp37672b66_79a6_469f_a49f_597c8995a99f\in.prm < "C:\BCI2000\BCI20...'
          ShellOutput: 'Warning: SpatialFilter: SpatialFilter::Process: Execution required more than a sample block duration.
Warning: ARFi...'
            ChainTime: 7.4900
     ChainSpeedFactor: 29.6437
            Megabytes: 3.3989
                Parms: [1x1 struct]
               Blocks: 7105
      BlocksPerSecond: 32
      SecondsPerBlock: 0.0313
             Channels: 8
        ChannelLabels: {'Fz'  'Cz'  'P3'  'Pz'  'P4'  'PO7'  'Oz'  'PO8'}
             Elements: 9
        ElementLabels: {'1'  '2'  '3'  '4'  '5'  '6'  '7'  '8'  '9'}
        ElementValues: [0 5 10 15 20 25 30 35 40]
          ElementUnit: 'Hz'
          ElementRate: 288
                 Time: [7105x1 single]
             FullTime: [7105x1 single]
    FullElementValues: [0 5 10 15 20 25 30 35 40]
               Signal: [7105x8x9 single]
               States: [1x1 struct]

inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

Re: No Signal in bci2000chain

Post by inesplc » 11 May 2016, 04:47

Peter,

I can replicate your output using the example provided. However, when trying with my own data and the MatlabFilter, I get the previous errors (which appear as well on the operator log when trying to use MatlabFilter in the R5348 beta).

I have Windows 10 64-bit, and Matlab R2015b 32-bit.

In attempt to make what I'm doing as clear as possible, here's what I've done so far:
1) Run the MatlabDemo batch, with Signal Generator, MatlabSignalProcessing, DummyApplication, parameterfile "../parms/examples/MatlabDemo_SignalGenerator.prm" and my own parameter file "../parms/KesselTest.prm"
2) Record 1 minute data
3) Copy and pasted all the bci_Initialize, _Preflight and _Process, as well as the parameter files to ".../tools/matlab"
3) In matlab, execute the following commands:

Code: Select all

bci2000path -AddToMatlabPath tools/mex     % binary mex-files (load_bcidat and friends)
bci2000path -AddToMatlabPath tools/matlab  % matlab m-files
bci2000path -AddToSystemPath tools/cmdline 

filename = 'C:\Users\Inês\Desktop\BCI2000Contrib\data\Name001\NameS001R106.dat;

s = bci2000chain(filename, 'MatlabFilter', 'MatlabDemo_SignalGenerator.prm', 'KesselTest.prm');
In the Contrib version, the s.ShellOutput is as the first post.
I can't use the 32-bit beta version due to the previous errors (Matlab must be incompatible because of missing libraries).
When using vs305, the result is the same as the Contrib version.

Hope this helps you resolve the issue.
Inês

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 19 May 2016, 16:50

Inespic,

can you please update your BCI2000 source code to SVN revision 5367 and fully compile the source code, including the mex files (they should have current time stamps afterwards).

This should then resolve the issues that you have been reporting.

Let me know if this works for you.

Regards, Peter

inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

Re: No Signal in bci2000chain

Post by inesplc » 24 May 2016, 08:54

Hi Peter,

I downloaded and compiled the SVN revision 5367 (and 5372, since it was available) with the mex files included. All the mex files under tools/mex were updated with the time of compiling, so I suppose the compiling went as it should (it's my first time compiling BCI2000).

However, in both revisions the following error now appears:

Code: Select all

Error using cell2struct
Invalid field name "__pad0"

Error in rmfield (line 60)
t = cell2struct(reshape(c(idxkeep,:),newsizeofarray),f);

Error in bci2000chain (line 369)
	out.States = rmfield(mat.Index, 'Signal');  % TODO: how do the command-line tools handle event states? this seems to be set up
    to deliver one value per block whatever kind of state we're dealing with
The working example provided works fine. My data has state variables besides the normal EEG channels, and I think this is the problem.

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 27 May 2016, 10:10

Inesplc,

the remaining issue with the "__pad0" state is now resolved in R5380. I have verified this on newly recorded data.

You can download the release candidate R5380 binaries from the BCI2000 beta thread:

http://www.bci2000.org/phpbb/viewtopic.php?f=1&t=2955

Regards, Peter

inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

Re: No Signal in bci2000chain

Post by inesplc » 27 May 2016, 11:32

Hi Peter,

I'm starting to see the light at the end of the tunnel- after downloading the lastest binaries I no longer get any of the previous errors.
However I still can't get the results needed. In my bci_Initialize.m there's the following snippet:

Code: Select all

sr = str2double(bci_Parameters.SamplingRate); %sampling rate
t_length = str2double(bci_Parameters.SampleBlockSize); % analysis window samples
(...)
if ( isnan(sr) )
  error('Variable1 was not initialized') 
end

if ( isnan(t_length) )
  error(''Variable2 was not initialized')) 
end
s.ShellOutput now says 'Variable1 was not initialized', however in my parameters file that I feed into bci2000chain, there is:

Code: Select all

Source:Signal%20Properties:DataIOFilter int SampleBlockSize= 80 32 1 % // number of samples transmitted at a time
Source:Signal%20Properties:DataIOFilter int SamplingRate= 512 256Hz 1 % // sample rate
I have verified that the data I'm using has 512Hz sampling and 80samplesPerBlock with load_bcidat.
Seems like SampleBlockSize and SamplingRate are the same type of data, but only one of them is being initialized (I tested commenting the first error command to make sure only sr is being troublesome). And because I'm initializing variables used in bci_Process based on sr, I can't simply discard this warning.
What am I doing wrong?

Best,
Inês

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 27 May 2016, 11:36

Inês,

can you send me a link to a minimal working example, i.e., a zipped file with BCI2000, the MATLAB script and your data. I will debug this then to resolve the issue.

Regards, Peter

inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

Re: No Signal in bci2000chain

Post by inesplc » 27 May 2016, 11:59

Thank you. Sent you the files via email.

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 02 Jun 2016, 15:00

Inês,

thank you for uploading the minimum working example. I was able to reproduce the issue and we will provide a bug fix this within the next few days.

Regards, Peter

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 02 Jun 2016, 15:18

Inês,

the fix for the issues that you have experienced in accessing the parameter in bci_Initialize.m is actually easy. You have to understand that the parameters are strings in a cell and that some parameters have units attached to the string. For example, the SamplingRate is stored as {'1000 Hz'}, which when you use the str2double results in a NaN. To fix this, you convert it using the syntax sscanf(cell2mat(bci_Parameters.SamplingRate),'%d');

I did not look deeper into your scripts. Let me know if there is any other issue that you experience.

Regards, Peter

inesplc
Posts: 16
Joined: 02 Mar 2016, 06:32

Re: No Signal in bci2000chain

Post by inesplc » 03 Jun 2016, 04:17

Hi Peter,

That issue is resolved, thank you. I had a feeling it might have something to do with the parameter reading, but only got so far as to use cell2mat. One question though, why doesn't this error show on the Operator? When running my system I never had this problem, so perhaps the parameters are different when saved?
On another note, bci2000chain still doesn't finish processing the data since now I get in the output:

Code: Select all

Waiting for Matlab engine to start up ...
Connected to Matlab engine.
Waiting for Matlab engine to start up ...
Connected to Matlab engine.
Runtime Error: MatlabFilter::Process: Accessing non-existent state vector data, sample: 1.
which is odd to me since bci_Process doesn't call for any state vector.

Best,
Inês

pbrunner
Posts: 344
Joined: 17 Sep 2010, 12:43

Re: No Signal in bci2000chain

Post by pbrunner » 03 Jun 2016, 09:24

Inês,

can you please again send me a minimum working example to debug this issue?

Regards, Peter

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest