[Mne_analysis] Trimming epochs in mne-python

Stephen Politzer-Ahles spa268 at nyu.edu
Sun Dec 22 11:07:32 EST 2013
Search archives:

Hello,

I have an Epochs object with pretty large epochs (tmin==-2 and tmax==3),
and I'd like to pull out shorter epochs (just a subset of the times in the
epoch). I tried using mne.Epochs to do so:

epochs2 = mne.Epochs( epochs, epochs.events, event_id, tmin=-.1, tmax=1,
baseline=(0,.1) )

but this caused problems later on; when I tried averaging with
epochs2.average(), I got an error (traceback below) that I do not get if I
average my original epochs.

Does this error have something to do with the way I created those epochs?
And is there a better way to trim epochs?

Thanks,
Steve


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-90-a492271ceff2> in <module>()
----> 1 epochs2.average()

/Users/meglab/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.8.git-py2.7.egg/mne/epochs.pyc
in average(self, picks)
    339         """
    340
--> 341         return self._compute_mean_or_stderr(picks, 'ave')
    342
    343     def standard_error(self, picks=None):

/Users/meglab/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.8.git-py2.7.egg/mne/epochs.pyc
in _compute_mean_or_stderr(self, picks, mode)
    377             data = np.zeros((n_channels, n_times))
    378             n_events = 0
--> 379             for e in self:
    380                 data += e
    381                 n_events += 1

/Users/meglab/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.8.git-py2.7.egg/mne/epochs.pyc
in next(self, return_event_id)
    976                     raise StopIteration
    977                 epoch, epoch_raw =
self._get_epoch_from_disk(self._current,
--> 978
 proj=proj)
    979                 self._current += 1
    980                 is_good, _ = self._is_good_epoch(epoch)

/Users/meglab/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.8.git-py2.7.egg/mne/utils.pyc
in dec(*args, **kwargs)
    378             return ret
    379         else:
--> 380             return function(*args, **kwargs)
    381
    382     # set __wrapped__ attribute so ?? in IPython gets the right
source

/Users/meglab/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.8.git-py2.7.egg/mne/epochs.pyc
in _get_epoch_from_disk(self, idx, proj, verbose)
    748
    749         # Read a data segment
--> 750         first_samp = self.raw.first_samp
    751         start = int(round(event_samp + self.tmin * sfreq)) -
first_samp
    752         stop = start + self._epoch_stop

AttributeError: 'Epochs' object has no attribute 'first_samp'




Stephen Politzer-Ahles
New York University, Abu Dhabi
Neuroscience of Language Lab
http://www.nyu.edu/projects/politzer-ahles/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20131222/fe2b5063/attachment.html 


More information about the Mne_analysis mailing list