# concatenate\_epochs and subset of them

**URL:** <https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [December 15, 2016, 1:03pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140 "2016-12-15T13:03:09Z")\
**Posts on this page:** 6\
**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 15, 2016, 1:03pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140/1 "2016-12-15T13:03:09Z")

</div>

Dear mne users,  
I?m dealing with a 3 blocks experiment and for each block I have a raw  
object.  
Then I?m epoching every raw object using the same event\_id = [A, B, C, D].

Later I concatenate the 3 epochs objects with:  
epochs\_merged = mne.concatenate\_epochs([epochs1, epochs2, epochs3])

First question, when concatenating, in the console I have the message:  
\*Applying baseline correction (mode: mean)\* , but in the documentation I  
can?t find any reference of it.  
Since I already used baseline correction when creating epochs1, epochs2,  
epochs3, could this additional correction generate any problem?

Later I?m doing some processing on epochs\_merged (AutoReject, ICA). Is it  
possible to access a subset of epochs\_merged, for example just the epochs  
with the event A, and average them?  
Otherwise I have to re-run the analysis on a newly created epochs object  
with event\_id = A, but I would prefer to avoid this, since from my  
understanding ICA performs better with more data.

Thank you in advance,

LA

MSc student, University of Padova  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161215/89fafb02/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161215/89fafb02/attachment.html)

---

<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 15, 2016, 1:58pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140/2 "2016-12-15T13:58:01Z")

</div>

Hi,

the first logging message is actually a bit misleading because it is only  
storing the baseline parameters. So the baselining actually only happens  
when the data is loaded (probably on concatenation in your case).

If you construct the epochs by passing a dict as the event\_id (see for  
example  
[http://mne-tools.github.io/stable/auto\_tutorials/plot\_object\_epochs.html](http://mne-tools.github.io/stable/auto_tutorials/plot_object_epochs.html)),  
you can get a copy of the 'A' category by doing ``epochs['A']``.

-Jaakko

---

<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 15, 2016, 2:19pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140/3 "2016-12-15T14:19:54Z")

</div>

Hi Jaakko,  
that was very clear thank you!  
I saw that you have already commited a fix on github, awesome!

Lorenzo

---

<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 15, 2016, 7:35pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140/4 "2016-12-15T19:35:01Z")

</div>

Hi all,

> Then I?m epoching every raw object using the same event\_id = [A, B, C, D].
> 
> Later I concatenate the 3 epochs objects with:  
> epochs\_merged = mne.concatenate\_epochs([epochs1, epochs2, epochs3])

[...]

> Later I?m doing some processing on epochs\_merged (AutoReject, ICA). Is it  
> possible to access a subset of epochs\_merged, for example just the epochs  
> with the event A, and average them?  
> Otherwise I have to re-run the analysis on a newly created epochs object  
> with event\_id = A, but I would prefer to avoid this, since from my  
> understanding ICA performs better with more data.

I would be interested in an easy solution for this issue, too. Of  
course one could extract these subsets of data manually, but is there  
maybe an easier way I have simply overlooked so far?

Thanks,

&nbsp;&nbsp;&nbsp;&nbsp;Richard

---

<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 15, 2016, 8:24pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140/5 "2016-12-15T20:24:54Z")

</div>

for a given epochs instance you have access to epochs.events and  
epochs.selection attributes.  
that should allow you to track what epoch correspond to what.

HTH  
Alex

---

<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 20, 2016, 12:37pm UTC](https://mne.discourse.group/t/concatenate-epochs-and-subset-of-them/1140/6 "2016-12-20T12:37:58Z")

</div>

> for a given epochs instance you have access to epochs.events and  
> epochs.selection attributes.  
> that should allow you to track what epoch correspond to what.

Thanks Alex! I realized my question had already been answered by Jaakko:
