Description files for epoching

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

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

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/generated/mne.BaseEpochs.html?highlight=metadata#mne.BaseEpochs.metadata

Hope that helps

JR