# Description files for epoching

**URL:** <https://mne.discourse.group/t/description-files-for-epoching/1649>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [October 29, 2018, 12:33pm UTC](https://mne.discourse.group/t/description-files-for-epoching/1649 "2018-10-29T12:33:19Z")\
**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:** [October 29, 2018, 12:33pm UTC](https://mne.discourse.group/t/description-files-for-epoching/1649/1 "2018-10-29T12:33:19Z")

</div>

External Email - Use Caution

Hi all

I'm attempting to create averaged epoch data off-line using a description file. My problem is I would like different epochs identified for the same event (presentation of a color cue) depending on if the subsequent target stimulus was presented in the left/right visual field. I have only been able to find a parameter (i.e. "event") that identifies the stimulus around which the epoch is built, but was wondering if there is another parameter that exists that would allow me to separate epochs for the same event based on subsequent event types. Thanks for your help.

Alfredo Sklar, MD, PhD  
PGY3 Psychiatry Resident  
Western Psychiatric Institute and Clinic  
University of Pittsburgh Medical Center  
Pager: 412-958-5770

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20181029/80d1a7a8/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20181029/80d1a7a8/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:** [October 29, 2018, 12:44pm UTC](https://mne.discourse.group/t/description-files-for-epoching/1649/2 "2018-10-29T12:44:14Z")

</div>

External Email - Use Caution

Dear Alfredo,

you'll need to modify the events array based on this knowledge.

It's just a numpy array so with basic numpy knowledge it is hopefully  
not too hard.

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:** [October 29, 2018, 12:45pm UTC](https://mne.discourse.group/t/description-files-for-epoching/1649/3 "2018-10-29T12:45:29Z")

</div>

External Email - Use Caution

Hi,

You can attach a rich pandas DataFrame top your epochs as 'metadata'.  
e.g.

from pandas import DataFrame  
# get your classi epochs  
epochs = mne.Epochs(raw, event\_id=event\_id)

# build a rich dataframe, e.g. to store what is going to happen next  
df = DataFrame(dict(value=epochs.events[:, 2]))  
df['next\_trial'] = df['value'].shift(1)

# add metadata to epochs  
epochs\_rich = mne.EpochArray(epochs, epochs.info, tmin=epochs.tmin,  
metadata=df)

# average  
epochs\_rich('next\_trial==1 & value==999').average()

See  
[https://martinos.org/mne/stable/auto\_tutorials/plot\_metadata\_epochs.html?highlight=metadata](https://martinos.org/mne/stable/auto_tutorials/plot_metadata_epochs.html?highlight=metadata)  
[https://martinos.org/mne/stable/generated/mne.BaseEpochs.html?highlight=metadata#mne.BaseEpochs.metadata](https://martinos.org/mne/stable/generated/mne.BaseEpochs.html?highlight=metadata#mne.BaseEpochs.metadata)

Hope that helps

JR
