# Cannot convert from raw intensity to optical density

**URL:** <https://mne.discourse.group/t/cannot-convert-from-raw-intensity-to-optical-density/8554>\
**Category:** Support & Discussions\
**Tags:** preprocessing, fnirs, mne-bids\
**Created:** [March 25, 2024, 4:00pm UTC](https://mne.discourse.group/t/cannot-convert-from-raw-intensity-to-optical-density/8554 "2024-03-25T16:00:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MPCHe18](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mpche18/32/3132_2.png) [@MPCHe18](https://mne.discourse.group/u/MPCHe18)\
**Post date:** [March 25, 2024, 4:00pm UTC](https://mne.discourse.group/t/cannot-convert-from-raw-intensity-to-optical-density/8554/1 "2024-03-25T16:00:31Z")

</div>

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

```python
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:

```python
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.
