# Converting stimulus-locked epochs to response-locked

**URL:** <https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003>\
**Category:** Support & Discussions\
**Tags:** preprocessing, epochs\
**Created:** [June 6, 2022, 6:15am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003 "2022-06-06T06:15:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonia](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@antonia](https://mne.discourse.group/u/antonia)\
**Post date:** [June 6, 2022, 6:15am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003/1 "2022-06-06T06:15:38Z")

</div>

Hi all,

I have created a preprocessing pipeline for MEG data. One of the steps in this pipeline is creating stimulus-locked epochs. These are in following steps cleaned of noise ( using automated noise detections with Autoreject), undergone an Independent Component Analysis (ICA) and some other basic preprocessing steps. Is there a function that can convert these stimulus-locked epochs to response-locked after they have been through my preprocessing pipeline?

I am using MNE version 1.0.3 and my operating system is macOs12.

Thank you for your help.

Best,  
Antonia

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [June 7, 2022, 9:16am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003/2 "2022-06-07T09:16:43Z")

</div>

hi Antonia,

there is “reepoch” mechanism in MNE but if you have autoreject or ICA object you can “apply” these steps  
to a new set of epochs without refitting the autoreject or ICA model. That’s the easy way out for you I think.  
We could hack the epochs to get the events of responses but it’s a bit difficult if you don’t understand the  
internals of MNE Epochs, events etc.

would this help?

Alex

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [June 7, 2022, 11:07am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003/3 "2022-06-07T11:07:11Z")

</div>

Hello @antonia and welcome to the forum! I’d like to ask why you need to do this? So I can better understand your workflow / your analysis approach. Is it just because you eventually want to have both, stimulus- and response-locked epochs, and ensure they were preprocessed in the exact same way?

Richard

---

<div class="post-metadata">

**Author:** ![antonia](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@antonia](https://mne.discourse.group/u/antonia)\
**Post date:** [June 8, 2022, 11:07am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003/4 "2022-06-08T11:07:42Z")

</div>

Hi Richard and Alex,

Thank you very much for helping me. My approach is to later compute the same analysis on both response-locked and stimulus-locked epochs. My preprocessing pipeline is computationally intense and consequently time-consuming. This is why I am trieng to aviod having to completely rerun it for response-locked epochs.

Applieng the autoreject and ICA solutions on my response-locked epochs sound very interesting. Is there a disadvantage to this approach compared to hacking the epochs to get the events of response?

Thank you again for your help!

Antonia

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [June 8, 2022, 11:38am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003/5 "2022-06-08T11:38:27Z")

</div>

Hi,

> Applieng the autoreject and ICA solutions on my response-locked epochs sound very interesting. Is there a disadvantage to this approach compared to hacking the epochs to get the events of response?

if you can avoid the hacking it’s much better I think. Less risk of mistakes.

Alex

---

<div class="post-metadata">

**Author:** ![antonia](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@antonia](https://mne.discourse.group/u/antonia)\
**Post date:** [June 10, 2022, 9:05am UTC](https://mne.discourse.group/t/converting-stimulus-locked-epochs-to-response-locked/5003/6 "2022-06-10T09:05:52Z")

</div>

Hi Alex,

Okay, perfect. Thank you for your help.

Antonia
