events lost in epoching ?

Dear list,

When epoching data based on a given trigger, it seems that all other
events that were present in the epochs are lost.

Below an example: in the raw data, I have three type of events, coded
'1', '10', and '101'. I epoch on event '1'. Events '10' and '101' are
close enough from event '1' and should fall on the epoched data.
However, the event list of the epoch object only contains the events
that were used to epoch ('1').

Am I using mne.Epochs in a wrong way? Is it an intended feature? If so,
this is unfortunate since, for example, if even '101' is the response
(and '1' the stimulus), I completely loose the Reaction Time.

Is there a way to keep all events in the epoched data?

  Thanks in advance for your help,
    B.

In [67]: raw._events
Out[67]:
array([[ 1001, 1, 1],
        [ 1763, 1, 10],
        [ 1845, 1, 101],
        ...,
        [526001, 1, 1],
        [526401, 1, 10],
        [526485, 1, 101]])

In [68]: event_id
Out[68]:
{'EMG': 10,
  'Left_Resp': 1,
  'PC_CompLeft': 1,
  'PC_CompRight': 2,
  'PC_IncompLeft': 3,
  'PC_IncompRight': 4,
  'Right_Resp': 2}

In [69]: t0
Out[69]: {'PC_CompLeft': 1}

In [70]: epochs = mne.Epochs(raw,raw._events,t0,-.5,1.5)
211 matching events found
Adding average EEG reference projection.
Created an SSP operator (subspace dimension = 1)
1 projection items activated

In [71]: epochs.events
Out[71]:
array([[ 1001, 1, 1],
        [ 3501, 1, 1],
        [ 6001, 1, 1],
        [ 8501, 1, 1],
        [ 11001, 1, 1],
        [ 13501, 1, 1],
        [ 16001, 1, 1],
        [ 18501, 1, 1],
        [ 21001, 1, 1],
        [ 23501, 1, 1],
        [ 26001, 1, 1],
        [ 28501, 1, 1],
        [ 31001, 1, 1],
        [ 33501, 1, 1],
        [ 36001, 1, 1],
        [ 38501, 1, 1],
        [ 41001, 1, 1],
        [ 43501, 1, 1],
        [ 46001, 1, 1],
        [ 48501, 1, 1],
        [ 51001, 1, 1],
        [ 53501, 1, 1],
  ...

Hi,

I'm not sure I fully understand it, but I respond with a comment on the
semantics of epoching in MNE.
The Epochs are based on the events passed to the the events id parameter.
The idea is that the length of the first dimension of the data array and
the events is the same.
In other words, `epochs.events` is only regarding the events that you
epoched on in chronological order.
What you describe is thus consistent with the API design.
This being said, we have discussed for some time already adding an API for
annotations to support describing events that are inside the time window of
interest used for epoching.

I hope this helps.
Cheers,
Denis

Hi,

In other words, `epochs.events` is only regarding the events that you
epoched on in chronological order.
What you describe is thus consistent with the API design.

I understand, but that severely limits the manipulation one can do on
the epochs. As said in my previous mail, There is no way to get, for
example, the Reaction Times of those epochs: they need to be computed
and store somewhere else... But this is the kind of information one very
usually use to manipulate data.

This being said, we have discussed for some time already adding an API
for annotations to support describing events that are inside the time
window of interest used for epoching.

I would find such a feature extremely useful !! If I can
help/contribute, I would be happy to !

  All the best,
    B.

Note. You can compute all latencies solely based on the events array using the differences between the values in the first column, after transforming to time via sampling frequency.
Then there is 'epoch.selection' which gives you the indices of the epochs selected with respect to the original epochs. So you can easily map your eeg trials to external information. I am on my phone now, so I cannot give you a nice example unfortunately.

Hi,

In other words, `epochs.events` is only regarding the events that you
epoched on in chronological order.
What you describe is thus consistent with the API design.

I understand, but that severely limits the manipulation one can do on
the epochs. As said in my previous mail, There is no way to get, for
example, the Reaction Times of those epochs: they need to be computed
and store somewhere else... But this is the kind of information one very
usually use to manipulate data.

This being said, we have discussed for some time already adding an API
for annotations to support describing events that are inside the time
window of interest used for epoching.

I would find such a feature extremely useful !! If I can
help/contribute, I would be happy to !

Cool we already have an open issue for that on github.

Sure, but that less convenient, and somehow more fragile: if I drop an
epoch, and forget to delete the corresponding RT in the list, there is
mismatch. This cannot append if I extract the RT directly from the epoch.

Beside computing RT, there are many other occasion where one needs to
sort trials based on the presence of other events in the epoch.

  Thanks anyway for your help,
    B.

Disclaimer: I'm not arguing against annotations, I'm trying to share some
practices that were good enough for me over the last years, in the hope
that you can find a solution before we eventually have proper annotations.

> Note. You can compute all latencies solely based on the events array
using the differences between the values in the first column, after
transforming to time via sampling frequency.
> Then there is 'epoch.selection' which gives you the indices of the
epochs selected with respect to the original epochs. So you can easily map
your eeg trials to external information. I am on my phone now, so I cannot
give you a nice example unfortunately.
>

Sure, but that less convenient, and somehow more fragile: if I drop an
epoch, and forget to delete the corresponding RT in the list, there is
mismatch. This cannot append if I extract the RT directly from the epoch.

This actually not the case. Look at .selection, it will be insensitive to
what you drop, it gives you just the position in the array from where the
epoch was initially taken, if you re-order epochs, you can also re-order
.selection.

Beside computing RT, there are many other occasion where one needs to
sort trials based on the presence of other events in the epoch.

you can also do this in a few lines of code based on the initial events
array.
Or am I missing something?

        Thanks anyway for your help,

                B.

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
Mne_analysis Info Page

The information in this e-mail is intended only for the person to whom it
is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
MyComplianceReport.com: Compliance and Ethics Reporting . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160106/cf832e82/attachment.html

boris,

point taken. What do you suggest in terms of API to address your use case?
what would be convenient to manipulate?

Best,
A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160106/b6117180/attachment.html

Hi,

Thank you very much Denis and Jona for your suggestions, and I will
certainly have a close look at your propositions

point taken. What do you suggest in terms of API to address your use case?
what would be convenient to manipulate?

I have to think about it, and come back to you very soon !!!

  Best,
    B.