Hi, I’m trying to convert raw intensity to optical density following the " Preprocessing functional near-infrared spectroscopy (fNIRS) data" tutorial. The data was imported via MNE-BIDS but when I run the command mne.preprocessing.nirs.optical_density(raw) I get the following error:
RuntimeError: None must operate on continuous wave data, but none was found.
I would really appreciate if anyone can help me.
MNE Version: 1.6.1
Operating system: Windows 11
This is the code
import mne
from mne_bids import (
BIDSPath,
read_raw_bids,
print_dir_tree,
make_report,
find_matching_paths,
get_entity_vals,
)
import matplotlib.pyplot as plt
from itertools import compress
import numpy as np
from mne_bids.stats import count_events
bids_root = '... data...'
bids_path = BIDSPath(subject='06',root=bids_root,datatype='nirs',task='fingerauto')
raw = read_raw_bids(bids_path=bids_path, verbose=True)
raw_od = mne.preprocessing.nirs.optical_density(raw)
raw_od.plot(n_channels=len(raw_od.ch_names), duration=500, show_scrollbars=False)
Error:
Traceback (most recent call last):
File "root...\tutFNIRS.py", line 49, in <module>
raw_od = mne.preprocessing.nirs.optical_density(raw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<decorator-gen-428>", line 12, in optical_density
File "C:\Users\rodri\anaconda3\Lib\site-packages\mne\preprocessing\nirs\_optical_density.py", line 33, in optical_density
picks = _validate_nirs_info(raw.info, fnirs="cw_amplitude")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rodri\anaconda3\Lib\site-packages\mne\preprocessing\nirs\nirs.py", line 261, in _validate_nirs_info
raise RuntimeError(
RuntimeError: None must operate on continuous wave data, but none was found.
Thanks.