[Mne_analysis] Beginner Question: epoching with subset of channels after average re-reference

JR KING jeanremi.king at gmail.com
Fri Jul 8 16:15:52 EDT 2016
Search archives:

Hi Ghislaine,

As long as you stick to linear operations, you can apply the average
reference until the very end. If you want to look at PSDs, you may want to
apply the grand average projection first.

Below is a script that plot the evoked before and after average ref.

For future reference it's generally easier to express your problem with one
of the available dataset.

Hope that helps,

JR

```
import mne
from mne.datasets import sample
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
events_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True)
picks = mne.pick_types(raw.info, eeg=True, meg=False)
events = mne.read_events(events_fname)
event_id = {'AudL': 1, 'AudR': 2, 'VisL': 3, 'VisR': 4}
epochs = mne.Epochs(raw, events, event_id, -0.050, 0.400,
                    picks=picks, verbose=False, proj=False)

# Evoked potentials are linear so you can apply the projection late
evoked = epochs.average()
evoked.plot(show=False, titles='No Average Reference')
evoked.add_eeg_average_proj().apply_proj().plot(proj=True, titles='Average
Reference')

# PSD are non linear, so you may want to apply the projection early
raw = mne.io.read_raw_fif(raw_fname, preload=True, proj=False)  # proj True
by default
raw.pick_types(meg=False, eeg=True)
raw.add_eeg_average_proj().apply_proj().notch_filter(60)
raw.plot_psd()
```

On 8 July 2016 at 15:52, Stephen Politzer-Ahles <spa268 at nyu.edu> wrote:

> Hi Ghislain,
>
> Do you actually need to epoch just a subset of channels? What I usually do
> is apply my pre-processing (including epoching) to the whole montage, and I
> don't worry about pulling out specific channels until I get to data
> analysis (e.g. when I want to plot just the channel that I care about, or
> run statistics just on a couple channels, or whatever).
>
> An additional benefit of keeping all the data for as long as I can is that
> if I later decide to do some post-hoc, exploratory analysis on some other
> channels, I already have that data, instead of having to re-run my
> preprocessing on those other channels.
>
> Best,
> Steve
>
>
>
> ---
> Stephen Politzer-Ahles
> University of Oxford
> Language and Brain Lab
> Faculty of Linguistics, Phonetics & Philology
> http://users.ox.ac.uk/~cpgl0080/
> <http://www.nyu.edu/projects/politzer-ahles/>
>
> On Fri, Jul 8, 2016 at 8:38 PM, Ghislain d'Entremont <
> ghislaindentremont at gmail.com> wrote:
>
>> Hi all,
>>
>> I just started using MNE to analyze some EEG data I collected for a study
>> I am conducting. So far, I've been enjoying learning about the package. The
>> tutorials online are great. However, I seem to be stuck on something I can
>> only imagine is straightforward. First, an overview of what I am trying to
>> accomplish:
>>
>> I use a 64-electrode cap.
>>
>> Ultimately, I want to (1) re-reference to the average of all electrodes,
>> (2) apply some basic filters (3) look ERPs of 4 channels for various target
>> types.
>>
>> I get stuck getting epochs (3). When trying to select one channel to
>> epoch, I get the warning message telling me that I should not apply a
>> projector to 1/64 of channels...
>>
>> How do I get around this given that I want to both re-reference to the
>> average of *all *electrodes and only do analysis on some subset of
>> channels.
>>
>> I imagine that it is clear that I am confused, so any conceptual tips
>> with respect to the implementation of this package will be helpful.
>>
>> I've attached the script I have been using. The last line of that script
>> is where I get stuck (as the comments will show).
>>
>> Any help will be greatly appreciated.
>>
>> Thank you,
>>
>> *Ghislain d'Entremont*
>> BSc, Neuroscience, Honors
>> Dalhousie University
>> tel: 902-802-5671 (text)
>>
>> _______________________________________________
>> 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.
>>
>>
>
> _______________________________________________
> 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.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160708/54c43dcc/attachment-0001.html 


More information about the Mne_analysis mailing list