<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'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't tell what mne version I'm running. I
did attempt git pull master origin and I'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><ipython-input-2-aa9bd53b86f1> in <module>()<br>----> 1 <a href="http://mne.sys.info" target="_blank">mne.sys.info</a>()<br><br>AttributeError: module 'mne' has no attribute 'sys'<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 'EEG063' in raw.ch_names:<br> ....: raw_bits = raw.pick_channels(['EEG063'])<br> ....: print ('Found EEG063 ')<br> ....: elif 'ECG063' in raw.ch_names:<br> ....: raw_bits = raw.pick_channels(['ECG063'])<br> ....: print ('Found ECG063 ')<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><ipython-input-13-f5e5440dff87> in <module>()<br>----> 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>--> 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's be safe.<br> 933 if len(picks) < 1:<br>--> 934 raise RuntimeError('Could not find any valid channels for '<br> 935 'your Raw object. Please contact the '<br> 936 'MNE-Python developers.')<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 = {'ECG063': ‘eeg’})<br> File "<ipython-input-30-1c0e7f2a2c6d>", line 1<br> raw_bits.set_channel_types(mapping = {'ECG063': ‘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 'EEG063' in raw.ch_names:<br> raw_bits = raw.pick_channels(['EEG063'])<br> print ('Found EEG063 ')<br>elif 'ECG063' in raw.ch_names:<br> raw_bits = raw.pick_channels(['ECG063'])<br> print ('Found ECG063 ')<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>