Skip to content

Commit

Permalink
Add unit test and towncrier
Browse files Browse the repository at this point in the history
  • Loading branch information
wmvanvliet committed Feb 4, 2025
1 parent 15519eb commit 5108607
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/changes/devel/13101.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Take units (m or mm) into account when drawing :func:`~mne.viz.plot_evoked_field` on top of :class:`~mne.viz.Brain`, by `Marijn van Vliet`_.
15 changes: 12 additions & 3 deletions mne/viz/tests/test_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,18 @@ def test_plot_evoked_field(renderer):
)
evoked.plot_field(maps, time=0.1, n_contours=n_contours)

# Test plotting inside an existing Brain figure.
brain = Brain("fsaverage", "lh", "inflated", subjects_dir=subjects_dir)
fig = evoked.plot_field(maps, time=0.1, fig=brain)
# Test plotting inside an existing Brain figure. Check that units are taken into
# account.
for units in ["mm", "m"]:
brain = Brain(
"fsaverage", "lh", "inflated", units=units, subjects_dir=subjects_dir
)
fig = evoked.plot_field(maps, time=0.1, fig=brain)
assert brain._units == fig._units
scale = 1000 if units == "mm" else 1
assert (
fig._surf_maps[0]["surf"]["rr"][0, 0] == scale * maps[0]["surf"]["rr"][0, 0]
)

# Test some methods
fig = evoked.plot_field(maps, time_viewer=True)
Expand Down

0 comments on commit 5108607

Please sign in to comment.