Scale changes after reading .dat using EEGLAB Import
-
Ryan
- Posts: 29
- Joined: 27 Aug 2010, 15:03
Scale changes after reading .dat using EEGLAB Import
Hi All,
I observed an interesting phenomenon, that when using EEGLABImport to import .dat from into Matlab, the data is rescaled, usually much larger than what you can observe with BCI2000 viewer.
I did some testing and found that the scale difference is exactly 1/SourceChannelGain.
I wonder if EEGImport forgets to take SourceChannelGain into account.
Well, another thing I noticed is about Source filter. I configured the Source filter with 0.3~70Hz bandpass and 60 Hz notch filter. Later on I loaded the data with EEGLABImport into EEGLab, and took a look at the power spectrum, and found that notch filter was clearly there, however 70 Hz lowpass was not obvious. Can someone let me know if it's because the lowpass in source filter is very mild? or bandpass is applied after saving the data? According to the manual, it seems source filters work similar as hardware filter, which should have been applied before storing data.
Thanks,
Ran
I observed an interesting phenomenon, that when using EEGLABImport to import .dat from into Matlab, the data is rescaled, usually much larger than what you can observe with BCI2000 viewer.
I did some testing and found that the scale difference is exactly 1/SourceChannelGain.
I wonder if EEGImport forgets to take SourceChannelGain into account.
Well, another thing I noticed is about Source filter. I configured the Source filter with 0.3~70Hz bandpass and 60 Hz notch filter. Later on I loaded the data with EEGLABImport into EEGLab, and took a look at the power spectrum, and found that notch filter was clearly there, however 70 Hz lowpass was not obvious. Can someone let me know if it's because the lowpass in source filter is very mild? or bandpass is applied after saving the data? According to the manual, it seems source filters work similar as hardware filter, which should have been applied before storing data.
Thanks,
Ran
-
boulay
- Posts: 382
- Joined: 25 Dec 2011, 21:14
Re: Scale changes after reading .dat using EEGLAB Import
Hi, did you use EEGLAB import from the BCI2000 distribution or from the EEGLAB plugins installation utility?
-
Ryan
- Posts: 29
- Joined: 27 Aug 2010, 15:03
Re: Scale changes after reading .dat using EEGLAB Import
Hi Boulay,
I used the one from BCI2000 distribution, by copying it into EEGLAB plugins folder.
Ran
I used the one from BCI2000 distribution, by copying it into EEGLAB plugins folder.
Ran
-
boulay
- Posts: 382
- Joined: 25 Dec 2011, 21:14
Re: Scale changes after reading .dat using EEGLAB Import
I maintain the one used in EEGLAB's plugin manager. Please use that instead and try again. The one from BCI2000 should work if you downloaded the trunk source within the last 2 years. However, if you are using a BCI2000 'release' version then the load_bcidat command does not use -calibrated, and no gains are applied.
-
pbrunner
- Posts: 344
- Joined: 17 Sep 2010, 12:43
Re: Scale changes after reading .dat using EEGLAB Import
Ryan,
For you first question: As Chad already hinted the observed behavior is because in load_bcidat, by default, signal data will be in raw A/D units. To obtain signal data calibrated into physical units (microvolts), specify '-calibrated' as an option anywhere in the argument list [1].
For your second question: This depends on which source module you are using. Please note that the signals will always be stored just as they came from the amplifier system. Thus, if the filtering happens on the acquisition hardware (i.e., the amplifier system) then the stored signals should be filtered. This for example is the case with g.tec hardware. If the filtering is happening in a signal processing filter within BCI2000 then the data will be stored unfiltered just like it came from the amplifier.
Regards, Peter
[1] http://www.bci2000.org/wiki/index.php/U ... oad_bcidat
For you first question: As Chad already hinted the observed behavior is because in load_bcidat, by default, signal data will be in raw A/D units. To obtain signal data calibrated into physical units (microvolts), specify '-calibrated' as an option anywhere in the argument list [1].
For your second question: This depends on which source module you are using. Please note that the signals will always be stored just as they came from the amplifier system. Thus, if the filtering happens on the acquisition hardware (i.e., the amplifier system) then the stored signals should be filtered. This for example is the case with g.tec hardware. If the filtering is happening in a signal processing filter within BCI2000 then the data will be stored unfiltered just like it came from the amplifier.
Regards, Peter
[1] http://www.bci2000.org/wiki/index.php/U ... oad_bcidat
-
boulay
- Posts: 382
- Joined: 25 Dec 2011, 21:14
Re: Scale changes after reading .dat using EEGLAB Import
Peter, my impression is that he is using the SourceFilter[1] as part of the SignalSource module, not in the SignalProcessing chain. This registers in position 1.01 by default. Hardware registers in position 1.0, so I assume that the SourceFilter happens immediately after hardware acquisition but before writing to disk. Is that incorrect?
[1] http://www.bci2000.org/tracproj/browser ... Filter.cpp
[1] http://www.bci2000.org/tracproj/browser ... Filter.cpp
-
Ryan
- Posts: 29
- Joined: 27 Aug 2010, 15:03
Re: Scale changes after reading .dat using EEGLAB Import
Hi Chad and Peter,
Thank you for the informative replies. That totally solved my problem regarding the first question. Really appreciate it.
For the second question, I have the same question as Chad.
I am using EGI's GES300 amplifier to stream EEG data to BCI2000.
I have configured the "SourceFilter" in the "Source" tab, rather than "Signal Processing" module.
It says in the Wiki that "the SourceFilter filter will be applied immediately after data acquisition, and it will modify the data which will be saved to disk, i.e., it will behave just as if it were a hardware filter built into the amplifier" [1].
I'd like to double check that this is the case.
Thanks,
Ran
1. "http://www.bci2000.org/wiki/index.php/U ... r#Function"
Thank you for the informative replies. That totally solved my problem regarding the first question. Really appreciate it.
For the second question, I have the same question as Chad.
I am using EGI's GES300 amplifier to stream EEG data to BCI2000.
I have configured the "SourceFilter" in the "Source" tab, rather than "Signal Processing" module.
It says in the Wiki that "the SourceFilter filter will be applied immediately after data acquisition, and it will modify the data which will be saved to disk, i.e., it will behave just as if it were a hardware filter built into the amplifier" [1].
I'd like to double check that this is the case.
Thanks,
Ran
1. "http://www.bci2000.org/wiki/index.php/U ... r#Function"
-
pbrunner
- Posts: 344
- Joined: 17 Sep 2010, 12:43
Re: Scale changes after reading .dat using EEGLAB Import
Ryan,
Chad's statement is absolutely correct. If you are using the SourceFilter then the "filtered" data should be stored. That being said, the filter order of the Butterworth filter is 2, which given the 1/f characteristics of the EEG signal may not be extremely visually apparent [1]. If this is necessary for your application, you could modify the filter order in the SourceFilter.cpp, however I would rather recommend to store the data "unfiltered" and use the filter settings in the visualization. You can also if needed for your processing use the IIRFilter in the SignalProcessing pipeline with higher filter orders. Both alternatives will preserve the original signal for post-hoc analysis.
Regards, Peter
[1] http://www.electronics-tutorials.ws/filter/fil57.gif
[2] http://www.bci2000.org/wiki/index.php/P ... Base_Class
Chad's statement is absolutely correct. If you are using the SourceFilter then the "filtered" data should be stored. That being said, the filter order of the Butterworth filter is 2, which given the 1/f characteristics of the EEG signal may not be extremely visually apparent [1]. If this is necessary for your application, you could modify the filter order in the SourceFilter.cpp, however I would rather recommend to store the data "unfiltered" and use the filter settings in the visualization. You can also if needed for your processing use the IIRFilter in the SignalProcessing pipeline with higher filter orders. Both alternatives will preserve the original signal for post-hoc analysis.
Regards, Peter
[1] http://www.electronics-tutorials.ws/filter/fil57.gif
[2] http://www.bci2000.org/wiki/index.php/P ... Base_Class
-
Ryan
- Posts: 29
- Joined: 27 Aug 2010, 15:03
Re: Scale changes after reading .dat using EEGLAB Import
Thank you Peter.
That's very well explained.
Just one more question related to the filter, the source filter is applied to EEG in sample-block basis, is that right?
Thanks,
Ran
That's very well explained.
Just one more question related to the filter, the source filter is applied to EEG in sample-block basis, is that right?
Thanks,
Ran
-
boulay
- Posts: 382
- Joined: 25 Dec 2011, 21:14
Re: Scale changes after reading .dat using EEGLAB Import
The signal gets passed to the filter one block at a time, but the filter implementation processes one sample at a time. See from line 130 at ref [1]. It's an IIRFilter. It is not necessary to retain a buffer of past data; the filter state is updated on each sample. Whether you run 1000 samples through the filter and end up in a given state, or if you initialize a filter with 0 samples and set it to that specific state, the result is identical.
[1] http://www.bci2000.org/tracproj/browser ... IRFilter.h
[1] http://www.bci2000.org/tracproj/browser ... IRFilter.h
-
Ryan
- Posts: 29
- Joined: 27 Aug 2010, 15:03
Re: Scale changes after reading .dat using EEGLAB Import
Thank you, Chad!
Ran
Ran
-
sarwanov
- Posts: 1
- Joined: 03 May 2015, 04:34
Re: Scale changes after reading .dat using EEGLAB Import
That's good post you have shared.Great Job
Who is online
Users browsing this forum: No registered users and 0 guests
