Add more options to sphere argument in topomap plots.#13400
Add more options to sphere argument in topomap plots.#13400drammock merged 9 commits intomne-tools:mainfrom
sphere argument in topomap plots.#13400Conversation
drammock
left a comment
There was a problem hiding this comment.
changes look good. Can you touch tutorials/intro/40_sensor_locations.py so we can make sure none of the figures have changed? I don't think the tutorial needs a new section, as the docstring is pretty clear and thorough already. Maybe just an extra sentence in the sidebar box here: https://mne.tools/dev/auto_tutorials/intro/40_sensor_locations.html#plotting-2d-sensor-locations-like-eeglab saying "see the docstring of plot_sensors for more info about the sphere parameter"
|
I changed the line wrapping in the tutorial to our new line length. Docs look good to me! |
|
Thanks @wmvanvliet! |
| if dig_kinds == "auto": | ||
| logger.info(msg) | ||
| logger.info("Trying again with all digitization points.") | ||
| return _fit_sphere_to_headshape( | ||
| info, dig_kinds=("extra", "eeg", "hpi", "cardinal"), verbose=verbose | ||
| ) | ||
| warn(msg) |
There was a problem hiding this comment.
Technically this is a backward incompatible change, so needs to be considered a bugfix with an entry in the bug section. For that, we'd want to be fairly certain it's better in 95%+ of cases. For example, anyone using the default origin="auto" in maxwell_filter who formerly got a warning will now have their origin change in 1.11 (assuming they have extra dig points). I am not sure we want to do this... but maybe it's okay?
@wmvanvliet WDYT?
There was a problem hiding this comment.
I hadn't considered non-visualization cases like maxwell_filter. No, we don't want to change default behavior like that, even though I believe it will be better in almost all cases. Let's revert for now.
Fixes #13399
This PR adds some more options to the
sphereargument ofplot_sensors. With this you can control what digitized points the sphere is fitted to. Specifically, it now passes thespherestring on tomne.bem.fit_sphere_to_headshapeasdig_kinds, so supports all the options for that function. For example, to fix #13399, one could do:raw.plot_sensors(ch_type="eeg", sphere="eeg")to fit the sphere to just the EEG digitization points.In addition, the
"auto"setting has been made a bit more clever. By default, it tries to fit the sphere with just the"extra"digitization points just like before. The new thing is that if it produces a weird fit that generates a warning about an unlikely head position, it will now try again with all digitization points. This also fixes #13399.