Skip to content

Commit 92e2d9e

Browse files
committed
FIX: Check
1 parent cfc9bc6 commit 92e2d9e

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

mne_nirs/io/snirf/_snirf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from mne.channels import make_standard_montage
1111
from mne.io.pick import _picks_to_idx
1212
from mne.transforms import _get_trans, apply_trans
13+
from mne.utils import check_version
1314

1415
# The currently-implemented spec can be found here:
1516
# https://raw.githubusercontent.com/fNIRS/snirf/v1.1/snirf_specification.md
@@ -283,7 +284,8 @@ def _store_probe_landmarks(raw, probe, add_montage):
283284

284285
if add_montage:
285286
# First, get the template positions in mni fsaverage space
286-
montage = make_standard_montage("standard_1020", head_size=0.09700884729534559)
287+
name = "colin27" if check_version("mne", "1.13") else "standard"
288+
montage = make_standard_montage(f"{name}_1020", head_size=0.09700884729534559)
287289
ch_names = montage.ch_names
288290
montage_locs = np.array(list(montage._get_ch_pos().values()))
289291

mne_nirs/visualisation/_plot_3d_montage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from mne.channels import make_standard_montage
1111
from mne.channels.montage import transform_to_head
1212
from mne.transforms import _get_trans, apply_trans
13-
from mne.utils import _check_option, _validate_type, logger, verbose
13+
from mne.utils import _check_option, _validate_type, check_version, logger, verbose
1414
from mne.viz import Brain
1515

1616

@@ -121,8 +121,9 @@ def plot_3d_montage(
121121
if isinstance(src_det_names, str):
122122
_check_option("src_det_names", src_det_names, ("auto",), extra="when str")
123123
# Decide if we can map to 10-20 locations
124+
name = "colin27" if check_version("mne", "1.13") else "standard"
124125
names, pos = zip(
125-
*transform_to_head(make_standard_montage("standard_1020"))
126+
*transform_to_head(make_standard_montage(f"{name}_1020"))
126127
.get_positions()["ch_pos"]
127128
.items()
128129
)

mne_nirs/visualisation/tests/test_visualisation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ def test_plot_3d_montage(requires_pyvista, fname_raw, to_1020, ch_names):
174174
need = set(
175175
sum((ch_name.split()[0].split("_") for ch_name in raw.ch_names), list())
176176
)
177-
mon = mne.channels.make_standard_montage("standard_1020")
177+
name = "colin27" if check_version("mne", "1.13") else "standard"
178+
mon = mne.channels.make_standard_montage(f"{name}_1020")
178179
mon.rename_channels({h: n for h, n in zip(mon.ch_names, need)})
179180
raw.set_montage(mon)
180181
n_labels = len(raw.ch_names) // 2

0 commit comments

Comments
 (0)