mne.preprocessing.nirs.optical_density():RuntimeError: None must operate on continuous wave data, but none was found.

Hi!
I used MNE to read my MAT data file and processed the data according to the demo in API. When converting the raw light intensity data into optical density images, there was a Error.

  • code:
    data_1 is loaded from mat folder,
    raw_intensity = mne.io.RawArray(data_1, info)
    raw_intensity.plot(n_channels=len(raw_intensity.ch_names), duration=200, show_scrollbars=False)
    raw_od = mne.preprocessing.nirs.optical_density(raw_intensity, verbose=None)
    raw_od.plot(n_channels=len(raw_od.ch_names),duration=10, show_scrollbars=False)
  1. results
    Raw_intensity:
    [[0.00028544 0.00032548 0.00030936 … 0.00032537 0.00031393 0.00033065]
    [0.00072295 0.00082638 0.00078547 … 0.00080126 0.0007763 0.00081666]
    [0.0007069 0.00080867 0.00076628 … 0.00080073 0.00077558 0.00081609]
    …
    [0.0003491 0.00039895 0.00038198 … 0.0003769 0.00036703 0.00038744]
    [0.00016065 0.00018397 0.00017627 … 0.00017517 0.00016937 0.00018028]
    [0.00028826 0.00032955 0.00031453 … 0.00031144 0.00030288 0.0003202 ]] (72, 7192)
    <Info | 7 non-empty values
    bads:
    ch_names: S1_D1 hbr, S2_D1 hbr, S3_D1 hbr, S2_D2 hbr, S3_D2 hbr, S4_D2 …
    chs: 36 Deoxyhemoglobin, 36 Oxyhemoglobin
    custom_ref_applied: False
    highpass: 0.0 Hz
    lowpass: 5.0 Hz
    meas_date: unspecified
    nchan: 72
    projs:
    sfreq: 10.0 Hz

Creating RawArray with float64 data, n_channels=72, n_times=7192
Range : 0 … 7191 = 0.000 … 719.100 secs
Ready.
[1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2]
[ 81.84 109.28 137.84 166.24 194.72 224.24 252.72 281.28 310.72 338.16
367.68 397.12 425.68 454.16 481.6 509.12 537.52 567.04 596.48 624. ]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
<Annotations | 20 segments: 1 (10), 2 (10)>
Channel types:: hbr: 36, hbo: 36
picks:
[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71]
2.Error

Traceback (most recent call last):
File "C:\525data", line 93, in
raw_od = mne.preprocessing.nirs.optical_density(raw_intensity, verbose=None)
File β€œβ€, line 12, in optical_density
File β€œC:\ProgramData\Miniconda3\lib\site-packages\mne\preprocessing\nirs_optical_density.py”, line 32, in optical_density
picks = _validate_nirs_info(raw.info, fnirs=β€˜cw_amplitude’)
File β€œC:\ProgramData\Miniconda3\lib\site-packages\mne\preprocessing\nirs\nirs.py”, line 234, in _validate_nirs_info
raise RuntimeError(
RuntimeError: None must operate on continuous wave data, but none was found.

Thanks for your help!
Jul.

How do you create the info structure? Could it be that some channel types are not set properly?

1 Like

HI @Jul
Have you solved this issue? I am facing the same problem, it would be great if you could help.

Thanks