FNIRS Custom Data fNIRS CW amplitude Issue

I’ve been having problems with manually or auto setting light frequency for my channels.

I followed the MNE custom data import tutorial for uploading my FNIRS data. My data is a .csv with 16 rows for 8 sensors and 8 detectors x the data that was recorded. I ran into a problem following the tutorial when I called the optical density function. I traced back the error and I believe its because the function is creating an array with values from “(_channel_frequencies(raw.info, nominal=True))”, but there are no values being created from that statement (I.e. I created a variable equal to “(_channel_frequencies(raw.info, nominal=True))” and it was an empty array when I printed it).

The help tool said that the function “_channel_frequencies” returns the light frequencies of each channel, but I couldn’t find much documentation on this. Are light frequencies something I have to manually set? I set the sfreq = 10 Hz at the beginning of my code as per the tutorial for importing custom fNIRS data, but there weren’t any additional steps for frequencies of each channel.


I traced a bit further back and saw that _channel_frequencies had the line picks = _picks_to_idx(info, ['fnirs_cw_amplitude', 'fnirs_od'], exclude=[], allow_empty=True), so it is searching for fnirs_cw_amplitude and fnirs_od types in my info. The problem is the tutorial only sets me up with default ch_names and ch_types for _channel_chromophore as I set my ch_types to alternating ‘hbo’ and ‘hbr’ values. This means my info has 8 hbo and 8 hbr channels instead of 16 fNIRS (cw) channels. I don’t know what I’m supposed to add or change from here to get the optical density to work because I’m inexperienced. I tried hardcoding default values for the _channel_frequencies fnirs_cw_amplitude and fnirs_od values, but I got an error that said “MNE does not support a combination of amplitude, optical density, and haemoglobin data in the same raw structure.” Any advice? I’m sorry if any of this was unclear.

pinging @rob-luke, our fnirs guru

Hi @kittson, thanks for taking the time to report this issue.

You need to set the frequency of the light for each channel so that we can run the beer lambert law. If you can provide the following information we might be able to find a solution here.

What fNIRS device are you using? and what are the frequencies of light that it uses?
Can you provide some data in a .csv file that is in the same format as your data (you can fake the data if you want to preserve privacy)?
And please provide a minimum working example of the code you are trying to run, complete bits of code rather than individual snippets.


1 Like