1.载入数据,我的数据是snirf格式的,使用
# preload=False不加载数据,preload=True加载数据
raw_od= mne.io.read_raw_snirf("数据路径", preload=True)
载入数据。若数据格式是NIRx记录的,可以用mne.io.read_raw_nirx()载入数据,该函数只在
NIRScout上测试过可行。
注:mne的0.20.7版本还无法使用
read_raw_snirf函数,conda install、update命令也无法升级,直接用pip install -U mne进行安装或升级到最新版本。
读取数据过程中出现TypeError: iteration over a 0-d array错误
原因是,sources和detectors的Labels没有成功读入,可能SNIRF格式的种类太多,我的数据中没有这部分数据。
sources = np.array(dat.get('nirs/probe/sourceLabels'))
detectors = np.array(dat.get('nirs/probe/detectorLabels'))
好在所有数据channel都是固定的,手动将Labels设置上
read_raw_snirf()
# sources = np.array(dat.get('nirs/probe/sourceLabels'))
# detectors = np.array(dat.get('nirs/probe/detectorLabels'))
# sources = [s.decode('UTF-8') for s in sources]
# detectors = [d.decode('UTF-8') for d in detectors]
# 根据探头数量设置
sources = ['S1','S2','S3','S4','S5','S6','S7','S8','S9','S10','S11','S12','S13','S14','S15','S16']
detectors = ['D1','D2',