getting an issue using mne_nirs.io.snirf.write_raw_snirf

  • MNE version: 1.2
  • operating system: Windows 10

Hi I did the following and get an issue with writing the raw snirf files

# read raw Hitachi files  and load data 
        raw = Preprocessing_individual.read_hitachi([pos_file_path_1, pos_file_path_2]).load_data()
       # set montage - DigMontage 
        montage = Preprocessing_individual.self_montage(file_path=montage_path_pos, csv_file=montage_path_csv) 
        raw.set_montage(montage)
        
        # read Events from Hitachi-Raw and create an annotation 
        events = mne.find_events(raw)
        event_dict  =  {'Sp':1,
             'Rot-TS':2 ,
             'Rot-Blesser':3,
             'NV':4,
             'NV-Rot':5}

        event_desc = {v: k for k, v in event_dict.items()}

        # write and set annotations 
        annotation = mne.annotations_from_events(events=events, sfreq=raw.info['sfreq'],
                                                 event_desc=event_desc, 
                                                 orig_time=raw.info['meas_date'])
        raw.set_annotations(annotation)
        raw.annotations.set_durations(20)
        print(raw.info)
        mne_nirs.io.snirf.write_raw_snirf(raw, snirf_path) # write snirf file 

I get the following issue:

  File ~\fNIRS-project\untitled7.py:52 in gen_file
    mne_nirs.io.snirf.write_raw_snirf(raw, snirf_path) # write snirf file

  File ~\Anaconda3\envs\old_mne\lib\site-packages\mne_nirs\io\snirf\_snirf.py:30 in write_raw_snirf
    assert len(picks) == len(raw.ch_names), 'Data must be fnirs_cw_amplitude'

AssertionError: Data must be fnirs_cw_amplitude

However, when I print raw.info, it is fnirs_cw_amplitude…

 ch_names: S1_D1 695, S1_D1 830, S2_D1 695, S2_D1 830, S2_D2 695, S2_D2 ...
 chs: 88 fNIRS (CW amplitude), 4 Stimulus
 custom_ref_applied: False
 description: Experiment data
 dig: 35 items (3 Cardinal, 30 EEG, 2 Extra)
 highpass: 0.0 Hz
 lowpass: 0.2 Hz
 meas_date: 2017-11-14 10:54:00 UTC
 nchan: 92
 projs: []
 sfreq: 10.0 Hz

Thank you for your help and support!
Best, Rebecka

Hi @rfahrn , Did you resolve this issue yet? I also have the same too.