Page 1 of 1
Command line processing and matlab
Posted: 07 Jun 2011, 11:06
by dyd1985
Hey everyone,
I have a new issue. I'm working offline using the command line processing and importing then the results in matlab. But when I compare my data imported in matlab using the load_bcidat() function to the data generated by the command line " bci_dat2stream < mydata.dat | TransmissionFilter | bci_stream2mat > mydata.mat " and then loaded into matlab using the function " [ signal, 'StimulusCode' ] = load_bcimat( 'mydata.mat', 2, 'StimulusCode' ); " I get a constant offset. In other words the signals imported using load_bcidat() function are constantly shifted down with respect to those imported using the load_bcimat() function.
Can you please help me understand what I'm doing wrong.
Thanks,
Alessandro
Re: Command line processing and matlab
Posted: 08 Jun 2011, 09:01
by mellinger
Hi Alessandro,
data can be read from file applying the "calibration" given by the SourceChOffsets and SourceChGains parameters, or in raw A/D units.
The default for load_bcidat() is to load data uncalibrated, i.e. in raw A/D units. To apply calibration to the data, specify the '-calibrated' option as an additional parameter to load_bcidat().
The default for bci_dat2stream, on the other hand, is to read data calibrated. To read data uncalibrated with bci_dat2stream, use the '--raw' option on the command line.
Now, when you have a nonzero value in SourceChOffsets, and a SourceChGain value of 1, and when you are using the default for both load_bcidat() and bci_dat2stream, you will have a constant offset between the data read by the two methods.
Best regards,
Juergen
Re: Command line processing and matlab
Posted: 08 Jun 2011, 09:59
by dyd1985
Dear Juergen,
thank you so much for your reply.
I imported in Matlab the signals as calibrated, in both cases. Default for load_bcimat() and '-calibrated' mode for load_bcidat(). Moreover I have made sure that SourceChOffset is set to zero and SourceChGain (that gives calibrated units) is non-zero. With these settings I'm getting the offset you can see in the figure I attached. I can't find yet where I'm wrong.
Thank you so much.
Alessandro
Re: Command line processing and matlab
Posted: 08 Jun 2011, 10:27
by mellinger
Dear Alessandro,
could you send me the data file in question, so I can try myself?
Best regards,
Juergen
Re: Command line processing and matlab
Posted: 08 Jun 2011, 10:45
by dyd1985
mellinger wrote:Dear Alessandro,
could you send me the data file in question, so I can try myself?
Best regards,
Juergen
Sure.
I have attached the acquisition run I have used.
Thank you so much for your help.
Alessandro
Re: Command line processing and matlab
Posted: 08 Jun 2011, 11:47
by mellinger
Hi Alessandro,
I cannot find a significant difference between files loaded by load_bcidat vs load_bcimat.
This is what I did: First I executed on the command line:
Code: Select all
bci_dat2stream < yuriS001R07.dat | TransmissionFilter | bci_stream2mat > yuriS001R07.mat
Then, in Matlab:
Code: Select all
>> m = load_bcimat( 'yuriS001R07.mat', 2 );
>> norm(m)
ans =
1.1217e+004
>> d = load_bcidat( 'yuriS001R07.dat', '-calibrated' );
>> norm(d)
ans =
1.1217e+004
>> delta=d-m;
>> norm(delta)
ans =
1.3201e-004
>> figure;plot(delta);
In the plot, only very small differences showed up, due to the different numeric types involved (load_bcimat returns data in single format, load_bcidat in double format).
Regards,
Juergen
Re: Command line processing and matlab
Posted: 08 Jun 2011, 12:11
by dyd1985
mellinger wrote:Hi Alessandro,
I cannot find a significant difference between files loaded by load_bcidat vs load_bcimat.
This is what I did: First I executed on the command line:
Code: Select all
bci_dat2stream < yuriS001R07.dat | TransmissionFilter | bci_stream2mat > yuriS001R07.mat
Then, in Matlab:
Code: Select all
>> m = load_bcimat( 'yuriS001R07.mat', 2 );
>> norm(m)
ans =
1.1217e+004
>> d = load_bcidat( 'yuriS001R07.dat', '-calibrated' );
>> norm(d)
ans =
1.1217e+004
>> delta=d-m;
>> norm(delta)
ans =
1.3201e-004
>> figure;plot(delta);
In the plot, only very small differences showed up, due to the different numeric types involved (load_bcimat returns data in single format, load_bcidat in double format).
Regards,
Juergen
Thanks Juergen.
This is really helpful. I really appreciated your help.
Alessandro