-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
@larsoner suggested warning that the coordinate frame is unknown might be the best option but as in this example, an unknown coordinate frame is silently accepted as being in "head" coordinates:
import os.path as op
import numpy as np
import mne
data = np.random.normal(size=(16, 100))
ch_names = ['S1_D1 hbo', 'S1_D1 hbr', 'S2_D1 hbo', 'S2_D1 hbr',
'S3_D1 hbo', 'S3_D1 hbr', 'S4_D1 hbo', 'S4_D1 hbr',
'S5_D2 hbo', 'S5_D2 hbr', 'S6_D2 hbo', 'S6_D2 hbr',
'S7_D2 hbo', 'S7_D2 hbr', 'S8_D2 hbo', 'S8_D2 hbr']
ch_types = ['hbo', 'hbr', 'hbo', 'hbr',
'hbo', 'hbr', 'hbo', 'hbr',
'hbo', 'hbr', 'hbo', 'hbr',
'hbo', 'hbr', 'hbo', 'hbr']
sfreq = 10. # in Hz
info = mne.create_info(ch_names=ch_names, ch_types=ch_types, sfreq=sfreq)
raw = mne.io.RawArray(data, info, verbose=True)
subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_fsaverage(subjects_dir=subjects_dir)
montage = mne.channels.make_standard_montage('artinis-octamon')
raw.set_montage(montage)
trans = mne.channels.compute_native_head_t(montage)
fig = mne.viz.create_3d_figure(size=(800, 600), bgcolor='white')
fig = mne.viz.plot_alignment(
raw.info, trans=trans, subject='fsaverage', subjects_dir=subjects_dir,
surfaces=['brain', 'head'], coord_frame='mri', dig=True, show_axes=True,
fnirs=['channels', 'pairs', 'sources', 'detectors'], fig=fig)
print({ch: raw.info['chs'][i]['coord_frame'] for i, ch in enumerate(raw.ch_names)})
Adapted from https://mne.tools/stable/auto_tutorials/io/30_reading_fnirs_data.html