Hey guys,
Iām wondering if there is a way to average epochs which is duplicate (the duplicated epochs have exactly the same event id) because, in my experiment, all the trials/pictures were repeated twice.
After epoching, I used the autoreject package to discard some epochs which are outliers. Is there a way or function to average epochs with the same event id? Or, is there a way to do this after applying apply_inverse_epochs()
Thank you very much for your reply. I have lots of duplicate trials, and I found some code in the tutorial to average them in a for loop:
evokeds = dict()
query = 'event_name == {}'
for eve_name in epos_pic_corr.metadata['event_name'].unique():
evokeds[str(eve_name)] = epos_pic_corr[query.format(eve_name)].average()
My question is the evokeds object created above already didnāt have the metadata like epochs have, right? I cannot query or select evoked data based on the metadata anymore, right?
Yes, the metadata gets lost when you average epochs. The problem here is that it would be difficult to decide which parts of the metadata to keep or how to merge metadata across trials. Do you have a specific use case that would require access to metadata on the Evoked level? What would you need, how would you imagine things to work?
Also, are you aware of Evoked.comment? There, we keep track of how epochs were combined to form the average.
I mainly have two goals, the first is to do the linear discriminant analysis at the sensor level. In my experiment, each picture was presented twice to increase the signal-to-noise ratio, so at first, I thought I should average the epochs with the same event name, and also, I modified the metadata obtained from the function that you write in the response to another MNE user, which is very handy by the way Here is the example of the metadata I create, which was reordered for illustration:
You can see that each picture was repeated twice despite some pictures only have one record because of the rejection by the package āautorejectā. So naturally, it came to me that I should average the epochs with the same event name to increase the signal-to-noise ratio, but in another hand, if I do this, I will lose the metadata information which I need to do the linear discriminant analysis (LDA). So maybe not doing the average can also work in the LDA?
but in my experiment, each picture had its own event id (trigger index), instead of each condition have its own event id (trigger index), so I prepared the metadata to mark the attributes and the conditions of the stimulus. In the metadata, you can see that the column of āfeature_judgeā is the task type, the columns of āfeature_colorā, āfeaute_animacyā and āfeature_sizeā are the attributes of the stimulus, what I want to do is to create 3 classifiers in this kind of the task to discriminate color (colorful vs. gray), animacy (animate vs. inanimate), size (small vs. big). Is there a way to create labels with metadata instead of the event_id/trigger index?