[Mne_analysis] Some question about Epochsobjects in mne-python

Denis-Alexander Engemann denis.engemann at gmail.com
Sun Dec 22 08:30:43 EST 2013
Search archives:

Steve,

that's great to hear.

As to ICA,  It's perfectly valid to run it on epochs for the reasons
you mentioned.
My pitch was that low and highpass filtering should be done before,
unless you know better.
The reason is that not doing so you might produce spike like peaks in
your signals which maybe 'misinterpreted' as e.g. ECG peaks by ICA,
since ICA is not run on single trials but on the concatenated channels
by (samples * epochs) time series.


On Sun, Dec 22, 2013 at 2:20 PM, Stephen Politzer-Ahles <spa268 at nyu.edu> wrote:
> Thanks, I think that solves all my problems!
>
> Regarding ICA and filtering, I just didn't do filtering because in the past
> I haven't (I have always left off filtering until as late as possible, just
> so I have the option of doing stats on unfiltered data if I want), but
> actually I haven't systematically compared whether ICA works better on
> filtered vs. unfiltered versions of my data, so it's definitely worth
> looking into. As for why I did ICA on epoched data rather than raw, it's
> just because I didn't want to pass in noisy data that's not from the actual
> task (e.g., parts of the recording where the participant was taking a break
> or talking to me, etc.), and the easiest way to do that was just to only use
> the [large] epochs around my critical events. But I took epochs that are
> each several seconds long, so that I can safely low-pass filter them and
> then chop out the actual epoch of interest from the middle later.
>
> Best,
> Steve
>
>
>
> Stephen Politzer-Ahles
> New York University, Abu Dhabi
> Neuroscience of Language Lab
> http://www.nyu.edu/projects/politzer-ahles/
>
>
> On Sun, Dec 22, 2013 at 5:13 PM, Denis-Alexander Engemann
> <denis.engemann at gmail.com> wrote:
>>
>> Dear Steven,
>>
>> # epochs IO
>>
>> for reading epochs use mne.read_epochs
>>
>>
>> http://martinos.org/mne/stable/generated/mne.read_epochs.html#mne.read_epochs
>>
>> # filtering epochs
>>
>> this is not supported by the API because you should know what  you do,
>> when you do it.
>> If you want to do it the way to do it is to access the epochs data (in
>> preload mode).
>>
>> data = epochs.get_date()
>> n_epochs, n_channels, n_samples = data.shape
>> data = data.reshape(n_channels, n_epochs * n_samples)
>> # for example
>> mne.filter.low_pass_filter(data, 1, 45, copy=False)
>> epochs._data = data.reshape(n_epochs, n_channels, n_samples)
>>
>> But this will only be valid if your data are sufficiently highpass
>> filtered (otherwise artifacts due to epochsing).
>>
>> # ICA
>>
>> is there a certain reason why you prefer to do ICA before filtering?
>> In my experience ICA will yield better results on filtered data
>> (removes e.g high-frequency noise and drifts).
>> Also you can speed up estimation time by not passing each sample using
>> the decim parameter having filtered the data. For separating signals
>> between 1 and 45 Hz you don't need 500 samples per second, which of
>> course depends on the total number of samples.
>> I often do the decim trick when working with raw data (it internally
>> decimates a copy of your data which is passed to ICA, not your
>> original data).
>>
>> also see:
>>
>> http://martinos.org/mne/stable/auto_examples/preprocessing/plot_ica_from_raw.html
>>
>> the line with `ica.decompose_raw`
>>
>> I hope this helps,
>> Denis
>>
>> On Sun, Dec 22, 2013 at 1:30 PM, Stephen Politzer-Ahles <spa268 at nyu.edu>
>> wrote:
>> > Hello,
>> >
>> > I have some epoched data that I created in python (using mne.Epochs) and
>> > then saved as a .fif file using the save() method of mne.Epochs. After
>> > saving it, I did some other processing, and now I'd like to load them
>> > again.
>> > But I'm actually not sure how to load these objects?
>> > mne.fiff.read_evoked
>> > doesn't seem to do it (I get an error 'Could not find evoked data'; the
>> > full
>> > traceback is below).
>> >
>> > Also, is it possible to filter an mne.Epochs object? I didn't filter my
>> > raw
>> > data because I wanted to do ICA on the epochs. But now, as far as I can
>> > tell
>> > there is not a built-in filter() method for Epochs like there is for
>> > Raw,
>> > and mne.filter.low_pass_filter() seems to be a low-level function so I'm
>> > not
>> > sure if I should be calling it directly or not.
>> >
>> > (My epochs are much larger than the time window I'm actually interested
>> > in,
>> > so I think it should be ok to filter; but if that's still not
>> > recommended,
>> > then another solution I could try is to run ICA on the epochs, apply
>> > those
>> > ICA weights back onto the raw data, filter the raw data, and then epoch
>> > again.)
>> >
>> > Thanks,
>> > Steve
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > Stephen Politzer-Ahles
>> > New York University, Abu Dhabi
>> > Neuroscience of Language Lab
>> > http://www.nyu.edu/projects/politzer-ahles/
>> >
>> > _______________________________________________
>> > Mne_analysis mailing list
>> > Mne_analysis at nmr.mgh.harvard.edu
>> > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>> >
>> >
>> > The information in this e-mail is intended only for the person to whom
>> > it is
>> > addressed. If you believe this e-mail was sent to you in error and the
>> > e-mail
>> > contains patient information, please contact the Partners Compliance
>> > HelpLine at
>> > http://www.partners.org/complianceline . If the e-mail was sent to you
>> > in
>> > error
>> > but does not contain patient information, please contact the sender and
>> > properly
>> > dispose of the e-mail.
>> >
>
>



More information about the Mne_analysis mailing list