FIX: correct spacing attribute in SourceMorph when src_to is provided#13687
FIX: correct spacing attribute in SourceMorph when src_to is provided#13687Famous077 wants to merge 14 commits intomne-tools:mainfrom
Conversation
doc/changes/dev/12101.bugfix.rst
Outdated
| @@ -0,0 +1 @@ | |||
| Fix :attr:`~mne.SourceMorph.spacing` attribute inconsistency in :func:`~mne.compute_source_morph` when ``src_to`` is provided, by `Famous077 <https://github.com/Famous077>`__. No newline at end of file | |||
There was a problem hiding this comment.
| Fix :attr:`~mne.SourceMorph.spacing` attribute inconsistency in :func:`~mne.compute_source_morph` when ``src_to`` is provided, by `Famous077 <https://github.com/Famous077>`__. | |
| Fix bug in :func:`~mne.compute_source_morph` where :attr:`mne.SourceMorph.spacing` was set incorrectly in some cases, by `Famous077 <https://github.com/Famous077>`__. |
Also don't use an anonymous link here. Add your name to doc/changes/names.inc (alphabetically) and link using single underscore.
There was a problem hiding this comment.
also: the filename should match the PR number, not the issue number that it resolves.
mne/morph.py
Outdated
| if src_to.kind in ("surface", "mixed"): | ||
| _ico_map = {10242: 5, 2562: 4, 642: 3, 162: 2} | ||
| _oct_map = {4098: 6, 1026: 5, 258: 4, 66: 3} | ||
| _nuse = src_to[0]["nuse"] | ||
| if _nuse in _ico_map: | ||
| spacing = _ico_map[_nuse] | ||
| elif _nuse in _oct_map: | ||
| spacing = _oct_map[_nuse] |
There was a problem hiding this comment.
this doesn't seem to do what was suggested by @larsoner in #12101 (comment)
|
Hi @drammock @agramfort , I really appreciate your feedback. Based on your feedback, Here what I've updated:
And Regarding raising an error when spacing=5 is used with non-fsaverage subjects, would it be better to handle that in a separate PR to keep this one focused? would love to take feedback on this. |
for more information, see https://pre-commit.ci
|
Hi @drammock , Can you please review this PR whenever you get time . Waiting for your feedback. |
Reference issue (if any)
#Fixed issue #12101
-->
What does this implement/fix?
--> When src_to is supplied to compute_source_morph(), the spacing
attribute of the resulting SourceMorph was always returning the
default value (5) regardless of the actual spacing of src_to.
The fix derives the correct spacing from src_to by mapping the
nuse value of the target source space to its corresponding
ico or oct grade.
Additional information
--> Tested with: