Skip to content

Commit

Permalink
FIX: Fix bug with coreg scalars (#12164)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Nov 3, 2023
1 parent f02e557 commit ec87fd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/changes/devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Bugs
- Fix bug where :class:`mne.Info` HTML representations listed all channel counts instead of good channel counts under the heading "Good channels" (:gh:`12145` by `Eric Larson`_)
- Fix rendering glitches when plotting Neuromag/TRIUX sensors in :func:`mne.viz.plot_alignment` and related functions (:gh:`12098` by `Eric Larson`_)
- Fix bug with delayed checking of :class:`info["bads"] <mne.Info>` (:gh:`12038` by `Eric Larson`_)
- Fix bug with :ref:`mne coreg` where points inside the head surface were not shown (:gh:`12147` by `Eric Larson`_)
- Fix bug with :ref:`mne coreg` where points inside the head surface were not shown (:gh:`12147`, :gh:`12164` by `Eric Larson`_)
- Fix bug with :func:`mne.viz.plot_alignment` where ``sensor_colors`` were not handled properly on a per-channel-type basis (:gh:`12067` by `Eric Larson`_)
- Fix handling of channel information in annotations when loading data from and exporting to EDF file (:gh:`11960` :gh:`12017` :gh:`12044` by `Paul Roujansky`_)
- Add missing ``overwrite`` and ``verbose`` parameters to :meth:`Transform.save() <mne.transforms.Transform.save>` (:gh:`12004` by `Marijn van Vliet`_)
Expand Down
15 changes: 12 additions & 3 deletions mne/viz/backends/_pyvista.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ def quiver3d(
clim=None,
):
_check_option("mode", mode, ALLOWED_QUIVER_MODES)
_validate_type(scale_mode, str, "scale_mode")
scale_map = dict(none=False, scalar="scalars", vector="vec")
_check_option("scale_mode", scale_mode, list(scale_map))
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=FutureWarning)
factor = scale
Expand All @@ -667,7 +670,10 @@ def quiver3d(
grid = UnstructuredGrid(*args)
if scalars is None:
scalars = np.ones((n_points,))
grid.point_data["scalars"] = np.array(scalars)
mesh_scalars = None
else:
mesh_scalars = "scalars"
grid.point_data["scalars"] = np.array(scalars, float)
grid.point_data["vec"] = vectors
if mode == "2darrow":
return _arrow_glyph(grid, factor), grid
Expand Down Expand Up @@ -715,14 +721,17 @@ def quiver3d(
glyph.Update()
geom = glyph.GetOutput()
mesh = grid.glyph(
orient="vec", scale=scale_mode == "vector", factor=factor, geom=geom
orient="vec",
scale=scale_map[scale_mode],
factor=factor,
geom=geom,
)
actor = _add_mesh(
self.plotter,
mesh=mesh,
color=color,
opacity=opacity,
scalars=None,
scalars=mesh_scalars,
colormap=colormap,
show_scalar_bar=False,
backface_culling=backface_culling,
Expand Down

0 comments on commit ec87fd8

Please sign in to comment.