# Trimming epochs in mne-python

**URL:** <https://mne.discourse.group/t/trimming-epochs-in-mne-python/645>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [December 22, 2013, 4:07pm UTC](https://mne.discourse.group/t/trimming-epochs-in-mne-python/645 "2013-12-22T16:07:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 22, 2013, 4:07pm UTC](https://mne.discourse.group/t/trimming-epochs-in-mne-python/645/1 "2013-12-22T16:07:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 22, 2013, 4:24pm UTC](https://mne.discourse.group/t/trimming-epochs-in-mne-python/645/2 "2013-12-22T16:24:45Z")

</div>

Hi Steve,

Epochs isn't designed to be created from epochs. You have to give it  
continuous raw data (an instance of mne.fiff.Raw). If you just want to  
change the time interval of the epochs, does Epochs.crop fit your need?

Best,

Martin

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 22, 2013, 4:48pm UTC](https://mne.discourse.group/t/trimming-epochs-in-mne-python/645/3 "2013-12-22T16:48:05Z")

</div>

Thanks Denis and Martin, epochs.crop is indeed it!

Best,  
Steve

Stephen Politzer-Ahles  
New York University, Abu Dhabi  
Neuroscience of Language Lab  
[http://www.nyu.edu/projects/politzer-ahles/](http://www.nyu.edu/projects/politzer-ahles/)
