<div dir="ltr"><div>Hello all,<br>I have written a little script that pulls the ECG 
channel data out of the fif file and writes a text file to pass to 
QRSTool (free external software).<br><br>But I have some fif files 
with the ECG data on channel EEG063 and some on ECG063.  My script works
 on the channel labeled EEG063, but it fails for the ECG063.  Specifically,
 I use raw.pick to get the channel I want.  I can plot it fine, it 
returns type mne.io.fiff.raw.RawFIF, but when I try to filter using 
raw.notch_filter, I get a weird error.  See below for the relevant 
snippets of code and outputs.<br><br></div><div>I just discovered the raw.set_channel_types method and wonder if that could help, but I&#39;m having trouble getting the syntax right...<br></div><div><br>(also, btw, <a href="http://mne.sys.info" target="_blank">mne.sys.info</a>()
 gives me an error... so I can&#39;t tell what mne version I&#39;m running.  I 
did attempt git pull master origin and I&#39;m still having the problem with
 raw.filter.)<br><br></div><div>Thanks much in advance,<br></div><div>Megan<br></div><div><br>[mschendel@XXXX ~]$ ipython<br>Python 3.5.1 |Anaconda 2.5.0 (64-bit)| (default, Dec  7 2015, 11:16:01) <br>In [1]: import mne<br>In [2]: <a href="http://mne.sys.info" target="_blank">mne.sys.info</a>()<br>---------------------------------------------------------------------------<br>AttributeError                            Traceback (most recent call last)<br>&lt;ipython-input-2-aa9bd53b86f1&gt; in &lt;module&gt;()<br>----&gt; 1 <a href="http://mne.sys.info" target="_blank">mne.sys.info</a>()<br><br>AttributeError: module &#39;mne&#39; has no attribute &#39;sys&#39;<br><br>#<br></div><div># Here is my io.Raw command... no trouble there... <br>#<br></div><br>In [21]: raw = io.Raw(infile, preload=True, verbose=None)<br><div># Cut all the io reporting...<br></div><div><br>In [22]: if &#39;EEG063&#39; in raw.ch_names:<br>   ....:     raw_bits = raw.pick_channels([&#39;EEG063&#39;])<br>   ....:     print (&#39;Found EEG063 &#39;)<br>   ....: elif &#39;ECG063&#39; in raw.ch_names:<br>   ....:     raw_bits = raw.pick_channels([&#39;ECG063&#39;])<br>   ....:     print (&#39;Found ECG063 &#39;)<br>   ....:     <br>Found EEG063 <br><br>In [23]: raw.notch_filter(freqs = numpy.arange(60, 241, 60) )<br>---------------------------------------------------------------------------<br>RuntimeError                              Traceback (most recent call last)<br>&lt;ipython-input-13-f5e5440dff87&gt; in &lt;module&gt;()<br>----&gt; 1 raw.notch_filter(freqs = numpy.arange(60, 241, 60) )<br><br>/export/research/analysis/human/jstephen/shared/programs/python/anaconda3/lib/python3.5/site-packages/mne/io/base.py
 in notch_filter(self, freqs, picks, filter_length, notch_widths, 
trans_bandwidth, n_jobs, method, iir_params, mt_bandwidth, p_value, 
verbose)<br><br>/export/research/analysis/human/jstephen/shared/programs/python/anaconda3/lib/python3.5/site-packages/mne/utils.py in verbose(function, *args, **kwargs)<br>    549         finally:<br>    550             set_log_level(old_level)<br>--&gt; 551     return function(*args, **kwargs)<br>    552 <br>    553 <br><br>/export/research/analysis/human/jstephen/shared/programs/python/anaconda3/lib/python3.5/site-packages/mne/io/base.py
 in notch_filter(self, freqs, picks, filter_length, notch_widths, 
trans_bandwidth, n_jobs, method, iir_params, mt_bandwidth, p_value, 
verbose)<br>    932             # let&#39;s be safe.<br>    933             if len(picks) &lt; 1:<br>--&gt; 934                 raise RuntimeError(&#39;Could not find any valid channels for &#39;<br>    935                                    &#39;your Raw object. Please contact the &#39;<br>    936                                    &#39;MNE-Python developers.&#39;)<br><br>RuntimeError: Could not find any valid channels for your Raw object. Please contact the MNE-Python developers.<br><br>#<br></div><div># Try to remap channel to EEG type...<br></div><div>#<br>In [30]: raw_bits.set_channel_types(mapping = {&#39;ECG063&#39;: ‘eeg’})<br>  File &quot;&lt;ipython-input-30-1c0e7f2a2c6d&gt;&quot;, line 1<br>    raw_bits.set_channel_types(mapping = {&#39;ECG063&#39;: ‘eeg’})<br>                                                        ^<br>SyntaxError: invalid character in identifier<br><br><br><br>#<br>#   If I do the same with data that has channel labeled as EEG ... <br>#<br>In [5]: if &#39;EEG063&#39; in raw.ch_names:<br>    raw_bits = raw.pick_channels([&#39;EEG063&#39;])<br>    print (&#39;Found EEG063 &#39;)<br>elif &#39;ECG063&#39; in raw.ch_names:<br>    raw_bits = raw.pick_channels([&#39;ECG063&#39;])<br>    print (&#39;Found ECG063 &#39;)<br>   ...:     <br>Found EEG063 <br>In [6]: raw_bits.notch_filter(freqs = numpy.arange(60, 241, 60) )<br><br>In [7]: raw_bits.notch_filter(freqs = numpy.arange(60, 241, 60) )<br>#  no complaints... <br><br><br><br><div><div class="gmail_signature">MEG Technician<br>The Mind Research Network<br>1101 Yale Blvd. NE<br>Albuquerque, New Mexico 87106<br>505-272-3304<br><br></div></div>
</div></div>