# Select trials to average (post-stimulus) by what	answer was given

**URL:** <https://mne.discourse.group/t/select-trials-to-average-post-stimulus-by-what-answer-was-given/544>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [February 18, 2013, 7:15pm UTC](https://mne.discourse.group/t/select-trials-to-average-post-stimulus-by-what-answer-was-given/544 "2013-02-18T19:15: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:** [February 18, 2013, 7:15pm UTC](https://mne.discourse.group/t/select-trials-to-average-post-stimulus-by-what-answer-was-given/544/1 "2013-02-18T19:15:32Z")

</div>

Hi all,

I am trying to average some meg data around the stimulus onset trigger, but  
want to exclude trials in which the subject later timed out (did not answer  
in allotted time). Correct, incorrect, and timeouts are all coded  
differently as 2,3,4 respectively. Does anyone know how I can write  
the averaging description file to do this, or know of another solution?  
Thanks for the help!

-Joseph Frantz  
University of New Mexico Health Sciences Center  
Research Tech 2  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20130218/8a664d98/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20130218/8a664d98/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:** [February 18, 2013, 7:40pm UTC](https://mne.discourse.group/t/select-trials-to-average-post-stimulus-by-what-answer-was-given/544/2 "2013-02-18T19:40:59Z")

</div>

Hi Joe,  
You can get the events list out by using the linux shell function  
"mne\_process raw --raw [inputfile] --eventsout [output filename for events  
file]". Then, after you have corrected the events as needed (i.e. by  
removing trials which are followed by event 4), you can read in the new  
events file using "mne\_process raw --raw [inputfile] --events [events file  
name]".

Hope that helps.

---

<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:** [February 18, 2013, 9:53pm UTC](https://mne.discourse.group/t/select-trials-to-average-post-stimulus-by-what-answer-was-given/544/3 "2013-02-18T21:53:19Z")

</div>

Hi joseph,

in mne-python (0.6 development version) there is a new function that might do what you're looking for.  
The following example demonstrates how to use it:

[https://github.com/mne-tools/mne-python/blob/master/examples/plot\_define\_target\_events.py](https://github.com/mne-tools/mne-python/blob/master/examples/plot_define_target_events.py)

I hope this helps,

Denis
