Skip to content

Commit fbb5ad5

Browse files
authored
FIX: Update for newer PyVista and exec() (#698)
1 parent 0802bf6 commit fbb5ad5

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

mne_nirs/io/fold/_fold.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _generate_montage_locations():
5252
5353
Data is returned in the same format as the eeg_positions library.
5454
"""
55-
# standard_1020 and standard_1005 are in MNI (fsaverage) space already,
55+
# standard_1020 and colin27_1005 are in MNI (fsaverage) space already,
5656
# but we need to undo the scaling that head_scale will do
5757
name = "colin27" if check_version("mne", "1.13") else "standard"
5858
montage = mne.channels.make_standard_montage(

mne_nirs/io/fold/tests/test_fold.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from mne.channels.montage import transform_to_head
1414
from mne.datasets.testing import data_path, requires_testing_data
1515
from mne.io import read_fiducials, read_raw_nirx
16+
from mne.utils import check_version
1617
from numpy.testing import assert_allclose
1718

1819
from mne_nirs.io import fold_landmark_specificity
@@ -57,7 +58,8 @@ def test_channel_specificity(monkeypatch, tmp_path, fold_files):
5758
res = fold_channel_specificity(raw, **kwargs)
5859
assert len(res) == 2
5960
assert res[0].shape == (n_want, 14)
60-
montage = make_standard_montage("standard_1005", head_size=0.09700884729534559)
61+
name = "colin27" if check_version("mne", "1.13") else "standard"
62+
montage = make_standard_montage(f"{name}_1005", head_size=0.09700884729534559)
6163
fids = read_fiducials(
6264
Path(mne.__file__).parent / "data" / "fsaverage" / "fsaverage-fiducials.fif"
6365
)[0]

mne_nirs/tests/test_examples.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,7 @@ def test_examples(fname, requires_pyvista):
5757
test_file_path = examples_path() + fname
5858
with open(test_file_path) as fid:
5959
code = fid.read()
60-
exec(code, locals(), locals())
60+
# Use a single namespace dict (not separate globals/locals) so that names
61+
# defined at module level in the example (e.g. imports) are visible
62+
# inside functions the example itself defines.
63+
exec(code, {"__name__": "__main__"})

mne_nirs/visualisation/_plot_3d_montage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ def plot_3d_montage(
238238
vp.GetOrigin()
239239
)
240240
actor = brain.plotter.add_text(
241-
name,
242-
ch_pos,
241+
text=name,
242+
position=ch_pos,
243243
font_size=font_size,
244244
color=(0.0, 0.0, 0.0),
245245
**add_text_kwargs,

0 commit comments

Comments
 (0)