unexpected outcome after applying baseline

  • MNE version: 1.0.3.
  • operating system: Windows 10

Hi all,

I have use the Epochs.apply_function() to create a baseline, but I get a very flat (negative) line after applying it. I am fairly new to neuroimaging, so please excuse me if this is a naive question.

The relevant code is:


loading session and resting state data

raw_intensity = mne.io.read_raw_nirx(subj_data_dir, verbose = False)
raw_rest = mne.io.read_raw_nirx(subj_rest, verbose = False)
raw_rest.load_data()

creating and applying the baseline (to epoched data)

baseline = raw_rest.get_data().mean(axis=-1, keepdims=True) # get avg value in each channel;
epochs.apply_function(lambda x: x - baseline, channel_wise=False)


Outcome:

(before, my graphs did show the data).
currently my epochs are -60 to 10 and I only have a 60 sec resting state (I made them an equal duration but got something very similar.

Any advice on what I should check would be greatly appreciated!
(tagging @drammock as as this is the follow up question, thanks!)

Rosyl

Given that you use read_raw_nirx I guess this is fNIRS data (which I don’t know much about, so I may not give the best answers). Tagging @rob-luke to correct my mistakes :slightly_smiling_face:

My first question would be: are the resting-state data and the experimental data expected to be on the same scale? Are they measuring the same thing? (I know fNIRS has various measurement types / modes / ?) Was there any preprocessing done to one file that was not done to the other one?

Next question is why do the epochs have such a long pre-stimulus period (tmin -60 vs tmax +10)? It’s not necessarily a problem but it’s unexpected (to me) since you aren’t using the pre-stimulus period for baselining – you’re using a separate recording for that. If your baseline values (the amount to subtract from each channel) are coming from the resting-state recording, you can (if you want) eliminate the epochs pre-stimulus period entirely (i.e., set tmin=0 when epoching).

Next question is: are you positive that the channels (or source-detector pairs or whatever) are in the same order in the two recordings?

One thing you could try is to first make sure both signals are zero-mean, before doing the baseline subtraction. This is sort of like baselining twice but there’s not necessarily anything wrong with that approach I don’t think? hopefully @rob-luke will chime in with better ideas though.

1 Like

It is fNIRS data indeed! sorry, I should have made that clear, thanks for spotting that anyway.

For the first question: yes, we expect it to be on the same scale, and it should be similar enough to serve as a baseline. I did check the preprocessing, but that also does not appear the issue.

My epochs are an odd length and I am using a resting state because it’s (super) exploratory research in which the aim is to predict certain events (so we only need pre-stimulus, post is only included as sanity check). I have looked at different baselines, but the resting state as a baseline fits better with the future goals of the industry partner we have on this project.

The channels should be in the same order, yes.

I have tried doing this, but I am making a mistake somewhere in either calculating the mean of the subtraction. I will have another try at this and otherwise post a topic with a mwe.

I will wait and see if @rob-luke has more suggestions, and in the meantime will just try and code review to see if I made a silly mistake somewhere. In any case, thank you so much for the questions, that was very helpful already!

Hi Rosyl,

Thanks for sharing your analysis with us. The plot doesn’t look as I’d expect. Can you share with us what the raw data looks like by sharing the output of raw_intensity.plot() and raw_rest.plot()

Thanks

Hi Rob, thank you for your reply. The raw data looks as follows:
raw_intensity (raw_intensity.plot(duration=60, start=100, proj=False, remove_dc=True)):

raw_rest (raw_rest.plot(duration=60, start=0, proj=False, remove_dc=True)):

Thanks again for helping, really appreciated since I am not that familiar with neuroimaging data!