-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ENH: Add hpi_colors and hpi_labels for clear visualization #13533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ENH: Add hpi_colors and hpi_labels for clear visualization #13533
Conversation
Signed-off-by: Dorna Raj Gyawali <[email protected]>
|
Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴 |
mne/viz/_3d.py
Outdated
| .. versionchanged:: 1.6 | ||
| Support for passing a ``dict`` was added. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing here is incorrect, see other examples in codebase to get it right
| Colors for HPI coils when ``dig=True``. | ||
| ``'auto'`` (default): use standard MEGIN cable colors for Elekta/MEGIN data | ||
| (1=red, 2=blue, 3=green, 4=yellow, 5=magenta, 6=cyan). | ||
| Can also be a list of colors or ``{ident: color}`` dict. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need .. versionadded
| interaction="terrain", | ||
| sensor_colors=None, | ||
| hpi_colors="auto", | ||
| hpi_labels=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should come after *
mne/viz/tests/test_3d.py
Outdated
| @testing.requires_testing_data | ||
| def test_plot_alignment_hpi_colors_and_labels(renderer): | ||
| """Test hpi_colors and hpi_labels parameters.""" | ||
| import mne |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be nested or needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encounter the error which says the file sample_audvis_raw.fif does not exist at the specified path, which likely means the dataset is not available in the current environment or the path is incorrect.
However, I’m a bit confused about which dataset I should be using here and how it’s expected to be selected or loaded.
Could you please guide me on the correct dataset selection and the recommended way to load it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to base this new test on the existing tests in the same file, most of the standard MEG datasets have HPI coils in them
mne/viz/_3d.py
Outdated
| nearest=nearest, | ||
| ) | ||
|
|
||
| if result is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would result be None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was being over-protective here, You’re totally right _plot_glyphs never returns None, and with surf=None for HPI coils we always get a single actor. The whole guard was dead code.
going to remove it soon...
mne/viz/_3d.py
Outdated
| ) | ||
|
|
||
| if result is not None: | ||
| actor = result[0] if isinstance(result, tuple) else result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would it be each possible type here?
|
|
||
| if hpi_colors == "auto": | ||
| megin_colors = { | ||
| 1: "red", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future ref can you add a code comment about where you got this color mapping?
Reference issue (if any)
Fixes #13485.
What does this implement/fix?