[Eeglablist] Copy ICA weights from 1Hz highpass to 0.1Hz highpass

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Mon Apr 18 11:54:50 PDT 2016


Dear Andreas,

Thank you very much again for detailed analysis.
I replicated the figure you suggested/intended by adding slight
modification to your code. I attached the modified code below. I thought
your point is really reasonable. I filed your suggestions and solutions to
Bugzilla 1880. You can also see the figure generated by your code with
modification.

https://sccn.ucsd.edu/bugzilla/process_bug.cgi

The EEGLAB developers will address the issue.
I deeply appreciate your careful investigation and kind contribution.

Makoto


EEG = eeg_emptyset;
EEG.srate = 500; EEG.pnts = 5000; EEG.trials = 1; EEG.nbchan = 3;
t = ( 0:EEG.pnts - 1 ) / EEG.srate;
EEG.data( 1, : ) = 2 * sin( 2 * pi * 50 * t );                     % 50 Hz
sine
EEG.data( 2, : ) = 2 * sin( 2 * pi * 50 * t ) + t;                 % with
drift
EEG.data( 3, : ) = 2 * sin( 2 * pi * 50 * t ) + sum(t) / EEG.pnts; % or
offset

pop_spectopo(EEG, 1, [ 0 0 ], 'EEG', 'freqrange', [ 0 100 ], 'electrodes',
'off' )
legend({'Sine' 'Sine with Drift' 'Sine with Offset'}) % Makoto added this
line

figure; set(gcf, 'Color', [0.93 0.96 1]);
h( 1 )  = subplot( 2, 2, 1 );
[sine1, F]   = pwelch( EEG.data(1,:)', hamming( EEG.srate ), 0, 1024,
EEG.srate );
[drift1, F]  = pwelch( EEG.data(2,:)', hamming( EEG.srate ), 0, 1024,
EEG.srate );
[offset1, F] = pwelch( EEG.data(3,:)', hamming( EEG.srate ), 0, 1024,
EEG.srate );
semilogy(F, sine1',   'r'); hold on
semilogy(F, drift1',  'g');
semilogy(F, offset1', 'b');
title( 'Hamming win w/ zero-padding' )
legend( 'Sine', 'w/ drift', 'w/ offset' )

h( 2 )  = subplot( 2, 2, 2 );
[sine2, F]   = pwelch( EEG.data(1,:)', hamming( EEG.srate ), 0, EEG.srate,
EEG.srate );
[drift2, F]  = pwelch( EEG.data(2,:)', hamming( EEG.srate ), 0, EEG.srate,
EEG.srate );
[offset2, F] = pwelch( EEG.data(3,:)', hamming( EEG.srate ), 0, EEG.srate,
EEG.srate );
semilogy(F, sine2',   'r'); hold on
semilogy(F, drift2',  'g');
semilogy(F, offset2', 'b');
title( 'Hann win w/o zero-padding' )

h( 3 )  = subplot( 2, 2, 3 );
[sine3, F]   = pwelch( EEG.data(1,:)', hann( EEG.srate ), 0, EEG.srate,
EEG.srate );
[drift3, F]  = pwelch( EEG.data(2,:)', hann( EEG.srate ), 0, EEG.srate,
EEG.srate );
[offset3, F] = pwelch( EEG.data(3,:)', hann( EEG.srate ), 0, EEG.srate,
EEG.srate );
semilogy(F, sine3',   'r'); hold on
semilogy(F, drift3',  'g');
semilogy(F, offset3', 'b');
title( 'Hann win w/o zero-padding' )

h( 4 )  = subplot( 2, 2, 4 );
[sine4, F]   = pwelch( EEG.data(1,:)', blackmanharris( EEG.srate ), 0,
EEG.srate, EEG.srate );
[drift4, F]  = pwelch( EEG.data(2,:)', blackmanharris( EEG.srate ), 0,
EEG.srate, EEG.srate );
[offset4, F] = pwelch( EEG.data(3,:)', blackmanharris( EEG.srate ), 0,
EEG.srate, EEG.srate );
semilogy(F, sine4',   'r'); hold on
semilogy(F, drift4',  'g');
semilogy(F, offset4', 'b');
title( 'Blackman-Harris win w/o zero-padding' )

set( h, 'XLim', [ 0 100 ], 'YLim', [10^-15 10^1] )
set(findall(gcf, '-property', 'fontsize'), 'fontsize', 14)




On Fri, Apr 1, 2016 at 9:07 AM, Andreas Widmann <widmann at uni-leipzig.de>
wrote:

> Dear Isaiah and Makoto,
>
> the problem is presumably related to spectral leakage due to (a) the
> Hamming window used by default in pwelch combined with (b) larger offsets
> and/or drifts in the data and possibly (c) zero padding.
> (a) The Hamming window type does not end at zero amplitude at the edges,
> thus, it allows a certain amount of spectral leakage. Purpose is to improve
> spectral resolution by suppressing the first side lobes.
>
> I will add some demo code below demonstrating the problem. Depending on
> your EEGLAB version either the upper left or the upper right panel will
> resemble the corresponding EEGLAB spectopo plot. In the recent EEGLAB
> versions (at least the git developer version; not sure whether there is a
> public version yet) zero-padding is not applied unless necessary/requested.
> Hann or more elaborate window types as used in the two lower panels will
> efficiently suppress leakage at the cost of spectral resolution (obvious
> for Blackman-Harris).
>
> Makoto, this issue is reappearing on the quite regularly (monthly?). I
> would like to suggest some changes:
> * The issue should be mentioned in the help text of (pop_)spectopo,
> optimally with a reference to a FAQ or something similar (e.g.
> http://sccn.ucsd.edu/wiki/TIPS_and_FAQ) explaining the problem in more
> detail.
> * A window type parameter could be added to spectopo (at least allowing to
> check whether the observed effects disappear). I quickly scanned through
> the code and if I didn’t miss something major the necessary adjustments
> should be limited.
> * In theory it should be possible to automatically check whether offset
> and/or drift exceed a certain threshold and either issue a warning or even
> automatically adjust the applied window type. However, I would consider
> this as a major endeavor. Not really sure whether it’s worth (or even
> works).
>
> Best,
> Andreas
>
> %%
> EEG = eeg_emptyset;
> EEG.srate = 500; EEG.pnts = 5000; EEG.trials = 1; EEG.nbchan = 3;
> t = ( 0:EEG.pnts - 1 ) / EEG.srate;
> EEG.data( 1, : ) = 2 * sin( 2 * pi * 50 * t ); % 50 Hz sine
> EEG.data( 2, : ) = 2 * sin( 2 * pi * 50 * t ) + t; % with drift
> EEG.data( 3, : ) = 2 * sin( 2 * pi * 50 * t ) + sum(t) / EEG.pnts; % or
> offset
>
> pop_spectopo(EEG, 1, [ 0 0 ], 'EEG', 'freqrange', [ 0 100 ], 'electrodes',
> 'off' )
>
> figure
> h( 1 ) = subplot( 2, 2, 1 );
> pwelch( EEG.data', hamming( 512 ), 0, 1024, EEG.srate );
> title( 'Hamming win w/ zero-padding' )
> legend( 'Sine', 'w/ drift', 'w/ offset' )
>
> h( 2 ) = subplot( 2, 2, 2 );
> pwelch( EEG.data', hamming( EEG.srate ), 0, EEG.srate, EEG.srate );
> title( 'Hamming win w/o zero-padding' )
>
> h( 3 ) = subplot( 2, 2, 3 );
> pwelch( EEG.data', hann( EEG.srate ), 0, EEG.srate, EEG.srate );
> title( 'Hann win w/o zero-padding' )
>
> h( 4 ) = subplot( 2, 2, 4 );
> pwelch( EEG.data', blackmanharris( EEG.srate ), 0, EEG.srate, EEG.srate );
> title( 'Blackman-Harris win w/o zero-padding' )
>
> set( h, 'XLim', [ 0 100 ], 'YLim', [ -150 20 ] )
> %%
>
> > Am 25.03.2016 um 14:25 schrieb Isaiah Innis <isainnis at indiana.edu>:
> >
> > That is good to know, thank you. I'm relieved it's not a problem with
> copying the ICA weights.
> >
> > 2016-03-22 5:33 GMT-04:00 Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
> > Dear Isaiah,
> >
> > There is a known problem that if you have a big low frequency drift,
> EEGLAB's spectrum analysis fails. Once I understood how this happens when I
> discussed a related issue with Andreas, but now I don't remember it.
> Anyway, if you want to make the spectrum plot work, excessive low-frequency
> drift should be removed.
> >
> > Makoto
> >
> > On Fri, Feb 19, 2016 at 6:02 AM, Isaiah Innis <isainnis at umail.iu.edu>
> wrote:
> > Hello eeglablist:
> >
> >
> > Some of our datasets have displayed a large amount of slow frequency
> drifts. See here for an example:
> https://onedrive.live.com/redir?resid=A1398B0A4C8F85DE!2199&authkey=!AD6I0359QqJH5eA&v=3&ithint=photo%2cpng
> >
> > In order to address this, we have tried the suggestion mentioned on this
> list of:
> > 1 Filtering each dataset with a 1Hz highpass
> > 2 Run ICA on this dataset
> > 3 Copy the ICA weights from the 1Hz dataset and apply them to our normal
> 0.1Hz filtered dataset
> >
> > However when viewing the components in the 0.1Hz dataset (the one we
> copied weights onto), I have noticed jagged spectra in the properties of
> several components.
> > Here are a few examples (the 1Hz component is on the right in the image,
> and the 0.1Hz is on the left):
> >
> >
> https://onedrive.live.com/redir?resid=A1398B0A4C8F85DE!2191&authkey=!ALiODmU2Hqc5HZE&ithint=folder%2cpng
> >
> > Is there something wrong here? These steps were suggested in vol 130
> issue 5 of the eeglab digest for reference.
> >
> > Thank you in advance,
> >
> > --
> > Isaiah Innis
> > Indiana University '13
> > EEG Technician, IUB IRF
> >
> >
> > _______________________________________________
> > Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> > To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> > For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
> >
> >
> >
> > --
> > Makoto Miyakoshi
> > Swartz Center for Computational Neuroscience
> > Institute for Neural Computation, University of California San Diego
> >
> >
> >
> > --
> > Isaiah Innis
> > Indiana University '13
> > EEG Technician, IUB IRF
> >
> > _______________________________________________
> > Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> > To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> > For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
>


-- 
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20160418/640d442e/attachment.html>


More information about the eeglablist mailing list