In my task there’s two conditions: let’s call them con1 and con2.
In every trial, the conditions are presented in a pseudo-random order (e.g., sometimes con1 is played first, and sometimes con2 is played first).
The way I have the task set up is whenever the FIRST stimuli is played (regardless of whether it’s con1 or con2) I have a trigger at channel 001. And whenever the SECOND stimuli is played I have a trigger at channel 002.
That is, the triggers correspond to the ORDER, not the condition (001 for the first and 002 for the second).
I would, however, like to epoch based on the condition. That is, I’d like to have a epoch containing all of the events with con1, and another with all of the events of con2 (regardless of which was played first and which was second).
Is that something that I can do with MNE or do I have to restructure my task codes to trigger differently?
If you have a record of actual stimulus presentation order on each trial, you can re-code the events. For example:
new_events = events.copy()
# which rows of event array have stim onsets?
stim_event_rows = np.nonzero(events[:, -1] in (first_stim, second_stim))
# loop through those rows and replace the event codes
for row, stim_type in zip(stim_event_rows, actual_stim_presentation_order):
new_events[row, -1] = stim_type
This assumes stim_type is an integer code already. If it’s a string, add a new line inside the for-loop to convert to integer first (like this maybe: stim_int = (1, 2)[stim_type == 'con2']).
Caveat: code not tested, but hopefully that gives you a head start on solving this.