[BUG] `mne.viz.plot_alignment` silently assumes unknown coordinate frame is in head
See original GitHub issue@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
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
mne.viz.plot_alignment — MNE 1.2.2 documentation
Plot head, sensor, and source space alignment in 3D. ... If True (default False), coordinate frame axis indicators will be shown: head in ......
Read more >VIZ: bug in plot_sensors(kind='3d') #7136 - GitHub
Describe the bug When plotting MEG and EEG sensors at the same time, ... Presumably this is an issue of which coordinate frame...
Read more >Problems running mne.viz.plot_alignment() from within Spyder
I'm trying to use mne. viz. plot_alignment (which doesn't have “block=” argument). The only way I've found to keep the plot window open...
Read more >Francisco Martins Treasures Lost - De Gruyter
Vorlage (*Kings) and, unless we assume that the Chronicler had at his disposal some unknown source of information about Asa's, Hezekiah's, ...
Read more >Final Environment and Social Impact Assessment ... - DFCCIL
email or hand delivery at DFCCIL Head office and CPM offices. - The second stage of information dissemination is conducted at final ESIA...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I suspect this is a widespread, non-fNIRS-specific issue as I ran into it for the stereoEEG tutorial as well
Huh,
artinis-octamon
has fiducial points so there might also be an issue with the coordinate frame not being set to “head” properly…