<div dir="ltr"><div><div><div>Hi Ghislaine, <br><br>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.<br><br>Below is a script that plot the evoked before and after average ref.<br><br></div>For future reference it&#39;s generally easier to express your problem with one of the available dataset.<br><br></div>Hope that helps,<br><br></div>JR<br><div><div><div><div><div><br>```<br>import mne<br>from mne.datasets import sample<br>data_path = sample.data_path()<br>raw_fname = data_path + &#39;/MEG/sample/sample_audvis_filt-0-40_raw.fif&#39;<br>events_fname = data_path + &#39;/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif&#39;<br>raw = mne.io.read_raw_fif(raw_fname, preload=True)<br>picks = mne.pick_types(<a href="http://raw.info">raw.info</a>, eeg=True, meg=False)<br>events = mne.read_events(events_fname)<br>event_id = {&#39;AudL&#39;: 1, &#39;AudR&#39;: 2, &#39;VisL&#39;: 3, &#39;VisR&#39;: 4}<br>epochs = mne.Epochs(raw, events, event_id, -0.050, 0.400,<br>                    picks=picks, verbose=False, proj=False)<br><br># Evoked potentials are linear so you can apply the projection late<br>evoked = epochs.average()<br>evoked.plot(show=False, titles=&#39;No Average Reference&#39;)<br>evoked.add_eeg_average_proj().apply_proj().plot(proj=True, titles=&#39;Average Reference&#39;)<br><br># PSD are non linear, so you may want to apply the projection early<br>raw = mne.io.read_raw_fif(raw_fname, preload=True, proj=False)  # proj True by default<br>raw.pick_types(meg=False, eeg=True)<br>raw.add_eeg_average_proj().apply_proj().notch_filter(60)<br>raw.plot_psd()<br>```<br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 July 2016 at 15:52, Stephen Politzer-Ahles <span dir="ltr">&lt;<a href="mailto:spa268@nyu.edu" target="_blank">spa268@nyu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Ghislain,<br><br></div>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&#39;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). <br><br></div><div>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.<br></div><div><br></div>Best,<br></div>Steve</div><div class="gmail_extra"><br clear="all"><div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br><br></div><span><div>---<br></div>Stephen Politzer-Ahles<br>University of Oxford<br>Language and Brain Lab<br>Faculty of Linguistics, Phonetics &amp; Philology<br><a href="http://users.ox.ac.uk/%7Ecpgl0080/" target="_blank">http://users.ox.ac.uk/~cpgl0080/</a></span><a href="http://www.nyu.edu/projects/politzer-ahles/" target="_blank"></a></div></div></div></div></div></div></div>
<br><div class="gmail_quote"><div><div class="h5">On Fri, Jul 8, 2016 at 8:38 PM, Ghislain d&#39;Entremont <span dir="ltr">&lt;<a href="mailto:ghislaindentremont@gmail.com" target="_blank">ghislaindentremont@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi all, </div><div><br></div><div>I just started using MNE to analyze some EEG data I collected for a study I am conducting. So far, I&#39;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:</div><div><br></div><div>I use a 64-electrode cap. </div><div><br></div><div>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. </div><div><br></div><div>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... </div><div><br></div><div>How do I get around this given that I want to both re-reference to the average of <i>all </i>electrodes and only do analysis on some subset of channels. </div><div><br></div><div>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. </div><div><br></div><div>I&#39;ve attached the script I have been using. The last line of that script is where I get stuck (as the comments will show). </div><div><br></div><div>Any help will be greatly appreciated.</div><div><br></div><div>Thank you, </div><span><font color="#888888"><br clear="all"><div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><b>Ghislain d&#39;Entremont</b><div>BSc, Neuroscience, Honors </div><div>Dalhousie University </div><div>tel: <a href="tel:902-802-5671" value="+19028025671" target="_blank">902-802-5671</a> (text) </div></div></div></div></div></div></div></div></div></div>
</font></span></div>
<br></div></div>_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br></blockquote></div><br></div>