[Eeglablist] Fwd: How to high-pass filter eeg data containing NaNs?

leo budinich leo.budinich at edu.unito.it
Fri May 13 05:33:36 PDT 2016


Thank you Carolina, the method you suggest is really simple (and that's
super for a matlab neophyte as me), I am going to try it!
Ciao,
Leo

2016-05-12 18:17 GMT+02:00 Carolina Migliorelli <
carolina.migliorelli at upc.edu>:

> Hi Leo, You are right, filters doesn't work with NaN signals. You can try
> to replace NaNs by zeros. The easiest way to do this is to use the matlab
> function "isnan". If you do something like:
>
> signal(isnan(signal))=0;
>
> This will replace all the Nans by zeros. If you don't want the nans be
> part of the signal you can try
>
> signal(isnan(signal))=[];
>
> This will delete the NaNs of the whole signal.
>
> Hope this works!
>
> Best,
>
> Carolina
>
> 2016-05-11 15:38 GMT+02:00 leo budinich <leo.budinich at edu.unito.it>:
>
>> Hi Eeglablist,
>>
>> I'm writing here because I'm a new user of EEGLAB and I am facing a
>> problem with high-pass filtering some data.
>>
>> I am trying to apply on a freely downloadable dataset some of the same
>> processing steps that have been used by the researchers that provided the
>> data (see http://www.stefanfrank.info/pubs/BL2015.pdf).
>> The set I want to filter has 32 channels and has already been been
>> band-pass filtered at 0.05Hz - 25Hz, recalibrated and re-referenced to the
>> mastoids.
>>
>> An important detail is that the EEG recordings concern the reading of two
>> hundred english sentences; the data recorded between the presentations of
>> two sentences have been "set to NaN" by the researchers who provided the
>> dataset, so the channel data of, e.g. subject01, presents this aspect when
>> you inspect it:
>>
>>
>> <-------------sentence_1-------------><---------wait----------><---------sentence_2--------->
>>
>> signal-signal-signal-signal-signal-NaN-NaN-NaN-NaN-signal-signal-signal-signal
>>
>>
>>
>> What I would like to do is high-pass filter the entire set to 0.50Hz, as
>> a way to "mitigate the baseline problem by reducing the correlation between
>> the baselines and amplitudes by applying an additional high-pass filter
>> with a sufficiently high cut-off frequency" (see the reference, pp.4).
>>
>> Unfortunately, when I apply a FIR filter with a 0.50Hz lower-edge I
>> obtain a lot of NaNs on the areas that previously were 'signal', but not
>> everywhere (and, curiously, the processing is really fast), so that it gets
>> this kind of aspect:
>>
>>
>>
>> <-------------sentence_1-------------><---------wait----------><---------sentence_2--------->
>>
>> NaN-NaN-NaN-NaN-NaN-NaN-NaN-NaN-NaN-NaN-NaN-NaN-NaN-signal-NaN-NaN
>>
>>
>> Here's the eeglab output:
>>
>> pop_eegfiltnew() - performing 1651 point highpass filtering.
>> pop_eegfiltnew() - transition band width: 0.5 Hz
>> pop_eegfiltnew() - passband edge(s): 0.5 Hz
>> pop_eegfiltnew() - cutoff frequency(ies) (-6 dB): 0.25 Hz
>> pop_eegfiltnew() - filtering the data (zero-phase)
>> firfilt(): |====================| 100%, ETE 00:00
>> Done.
>>
>>
>> I imagined that the filter function doesn't produce the right output
>> because of the NaNs present between the sentences, but as my
>> comprehension of the functioning of filters and of eeglab in general is
>> extremely limited at the moment, it turns out to be just a speculation.
>>
>> Could you help me understanding what's wrong with my filtering?
>>
>> And, if my hypothesis is correct, i.e. the filter cannot be applied to
>> data containing NaNs, how would you apply a high-pass filter to data
>> structured as I indicated above (i.e., containing NaNs in some parts)?
>>
>> Thank you!
>> Leo
>>
>> ------------------------
>>
>> Indirizzo istituzionale di posta elettronica degli studenti e dei
>> laureati dell'Università degli Studi di Torino
>> Official University of Turin email address for students and graduates
>>
>> _______________________________________________
>> 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
>>
>
>

-- 
------------------------

Indirizzo istituzionale di posta elettronica degli studenti e dei laureati 
dell'Università degli Studi di Torino
Official University of Turin email address for students and graduates 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20160513/329f2081/attachment.html>


More information about the eeglablist mailing list