MatlabSignalProcessing

This forum deals with BCI2000 configuration issues.
Locked
Francesco
Posts: 17
Joined: 09 Jun 2011, 03:13

MatlabSignalProcessing

Post by Francesco » 22 Nov 2011, 14:53

Hi

I've observed that MatlabSignalProcessing module returns different signals from those saved by Operator module. I've saved a data window (SampleBlockSize=768) using bci.process.m file and I compared it with data loaded into matlab with the function [ signal, states, parameters ] = load_bcidat( files.name,'-calibrated' ) and I've noticed that data are different. Both are in double format. The difference seems not deterministic.

thanks in advance,
Francesco

jawilson
Posts: 109
Joined: 28 Feb 2005, 16:31

Re: MatlabSignalProcessing

Post by jawilson » 22 Nov 2011, 14:57

Francesco,
In what ways does the data differ? Are the number of channels the same? If you plot the signals in MATLAB, do they look like the signals plotted in BCI2000? Also, remember that the signals may be calibrated (it looks like you are using the -calibrated flag), and that there is a SpatialFilter before the signals get to the MatlabFilter. What does your spatial filter matrix look like?
If you can give us details on how the data is different, we can start to figure this out.
Thanks,
Adam

Francesco
Posts: 17
Joined: 09 Jun 2011, 03:13

Re: MatlabSignalProcessing

Post by Francesco » 22 Nov 2011, 16:27

The number of channels are the same. I plot both the signals in matlab and they are different: those saved in .dat file are different from those that I've saved in output from bci_process.
The function that I've used:

function bci_Initialize( in_signal_dims, out_signal_dims )
global bci_Parameters bci_States;

function [ out_signal_dim ] = bci_Preflight( in_signal_dim )
out_signal_dim = in_signal_dim;

function out_signal = bci_Process( in_signal )
global bci_Parameters bci_States;
out_signal = in_signal;
save datiout out_signal bci_Parameters bci_States;

First question: Is out_signal calibrated? In matlab the format is double.

I used

cd ..\prog
start operator.exe ^
--Title %~n0 ^
--OnConnect "-LOAD PARAMETERFILE ..\MatlabParam.prm"
start SignalGenerator.exe 127.0.0.1
start MatlabSignalProcessing.exe --MatlabWD="..\..\Mio_Matlab" --MatlabStayOpen=0 127.0.0.1
start StimulusPresentation.exe 127.0.0.1
cd ..

I set SpatialFilterType:none
Have I forgotten to disable some filters?

Francesco

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

Re: MatlabSignalProcessing

Post by mellinger » 23 Nov 2011, 07:46

Francesco,

except for the SpatialFilter, there are other options affecting the signal prior to the MatlabFilter. The TransmitChList option lets you specify a subset of channels. The AlignChannels option interpolates between samples to account for time delay between sampling of individual channels.

Make sure that TransmitChList lists all channels, either as a list of numbers from 1 to SourceCh, or with their names, in the same order as in the ChannelNames parameter.

Repeating Adam, I want to stress that we can help you better when you provide some information about how signals differ. Do they have the same number of channels? How many samples are present in the data block saved by Matlab? How do you identify the sample position of the last data block that has been written with the Matlab "save" command when you load the .dat file? How do you compare the signals?

Regards,
Juergen

Francesco
Posts: 17
Joined: 09 Jun 2011, 03:13

Re: MatlabSignalProcessing

Post by Francesco » 25 Nov 2011, 12:57

Hi

Sorry for the delay in the reply. The problem, as you suggested me, was the AlignChannels options. Setting AlignChannels = 0 the signals are the same. Thanks for your advice.

Best regards
Francesco

Francesco
Posts: 17
Joined: 09 Jun 2011, 03:13

Re: MatlabSignalProcessing

Post by Francesco » 02 Dec 2011, 11:41

Hi

I noticed that if I enable or disable the AlignFilter, the data, saved in .dat file, are never filtered. Instead the output of MatlabFilter or FieldtripBuffer is filtered or not, depending on the AlignFilter option. Hence are the data, saved in .dat file, always raw data?

Regards,
Francesco

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

Re: MatlabSignalProcessing

Post by mellinger » 09 Jan 2012, 13:44

Hi Francesco,

basically, data in .dat files are raw data.
The only exception to this is when the SourceFilter is present in a source module. This filter is meant to be a substitute when there is no hardware filter built in to EEG hardware, and it provides a low-pass, high-pass, and notch filter. When this SourceFilter is enabled, it will affect the data saved into the .dat file.

Also, filter settings in the source signal view do not affect anything outside the display itself, neither saved data, nor data processing in BCI2000.

Regards,
Juergen

Francesco
Posts: 17
Joined: 09 Jun 2011, 03:13

Re: MatlabSignalProcessing

Post by Francesco » 10 Jan 2012, 03:48

Ok, Thank you.

Best regards,
Francesco

Locked

Who is online

Users browsing this forum: No registered users and 1 guest