Baselinecorrection for epoch without baseline period

Hi everyone,
I’m searching for some input in the following matter:

The study I’m working on is using a paradigm with spoken sentences wich have two signalwords (the triggers). I’m epoching and averaging each trigger seperately so I’m missing a timeperiod to use for baseline correction in front of the second trigger since it is in the middle of a spoken sentence.

I tried using baseline.rescale on the initial raw object with a timeperiod at the beginning of the measurement. It works but is kind of defeating the purpose of a baselinecorrection close to every epoch in a somewhat 30 min measurement with 180 of said sentences.

Is there a method or does someone has an idea for this?

Thank you,
Leoni

I would simply create epochs with a pre-stimulus period that reaches back to the baseline you want to use, then use this baseline period (not the entire pre-stimulus period!) for baseline correction, and then crop the epochs to the time period you actually want to analyze.

1 Like

Thank you very much!
I didn’t realise there is a crop method for epochs.

There is no fixed time between the first and the second trigger, but I think it’s manageable to find a way to set the baseline before the first trigger.

Best wishes,
Leoni

Oh, this is a non-trivial issue then, as MNE expects the baseline period to be the same across epochs, and all epochs must have the same duration.

I may have an idea on how to hack around this, though.

Do you always have both triggers in all of your epochs / trials?

Ah yes, I know. It would be a little bit of an ugly solution, but I just thought I will be able to find a baseline period that works for all trials.

Yes (at least in an ideal scenario). I tried to visualize it :sweat_smile: :


(The black boxes are the words.)

I’d love to hear your idea!

@richard , did you find a solution for this ?

I have a similar situation. I need to baseline correct each of my events from the “fixed” or inter-trial-interval (ITI ) epoch. All events need to be subtracted from the ITI occuring at EACH trial.

Apoorva.

I think this got answered during live office hours today. @apoorva6262 can you post the solution you came up with?

2 Likes
epochs = mne.Epochs(raw_tmp, events, tmin= -2.0, tmax=1.0, event_id=event_dict,baseline=None,
                preload=True)

start_stim_data=epochs.get_data()
start_stim_times=epochs.times

start_data_baseline=mne.baseline.rescale(start_stim_data, start_stim_times, baseline=(-2.0,0), mode='zscore')

epochs_baseline_corrected=epochs.copy()
epochs_baseline_corrected._data=start_data_baseline
1 Like

I didn’t test this, but I believe a cleaner solution that is also shorter would be to use Epochs.apply_function():

epochs = mne.Epochs(
    raw=raw_tmp, events=events, tmin=-2.0, tmax=1.0, event_id=event_dict,
    baseline=None, preload=True
)
epochs.apply_function(
    fun=mne.baseline.rescale,
    times=epochs.times,
    baseline=(-2.0, 0),
    mode='zscore'
)
2 Likes

A post was split to a new topic: Plotting a spectrogram for baseline-corrected data

Hi everyone,

It’s seem that the problem has been solved by using Epochs.apply_function. However, I didn’t get why apply_function provides baseline period data before the first trigger to epoch 2.

Can anyone explain this to me?

Thank you,
Sherry

I am stuck with the same issue. I need to correct epochs (post-stimulus) from offset to response, but the periods before the epochs of interest are the stimulus itself… I have difficulties understanding how I can do that. According to me it’s not possible to use the periods pre stimulus.

                           Pre-stimulus-----  I  STIMULUS I  ********************I
                                            Onset       Offset            Response Trigger

I have a similar question as @Sherry and @WilliamLabCea , could someone please explain how the apply_function provides the baseline period data for epoch 2 too? tagging @richard as you provided the answer. Thank you

Rosyl

For sake of completeness, the follow-up questions are in a new thread, here: Using a separate condition as baseline (e.g., a resting state)

Hi,
I have similar question.
So, I also have several triggers within my auditory stimuli, similar to figures that are depicted here. The difference is that the duration between trigger 1 and 2 is varied depending the duration of the sound stimuli. My main interest is trigger 2, I want to baselinecorrected to pre-stimulus which is prior to trigger 1. So, my question (trying to clarify) is :

  1. I suppose I need to create the epoch from trigger 1 , right?
  2. How do I remove epoch from trigger 1 so that the epoch only start from trigger 2? Thus the epoch has baseline prestimulu (which is prior to trigger 1) then followed by the onset of trigger 2.
    I have also seen the example here and also the solution, what I don’t really understand is, where the cropping is defined.
    Thanks

Just wannan update, I found the answer here applying baseline extracted from another epoched object

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.