Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/devel/12436.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :ref:`tut-working-with-seeg` use of :func:`mne.stc_near_sensors` to use the :class:`mne.VolSourceEstimate` positions and not the pial surface, by `Alex Rockhill`_
9 changes: 6 additions & 3 deletions mne/source_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3879,8 +3879,11 @@ def stc_near_sensors(
if surface == "auto":
if src is not None:
pial_fname = op.join(subjects_dir, subject, "surf", "lh.pial")
src_surf_is_pial = op.isfile(pial_fname) and np.allclose(
src[0]["rr"], read_surface(pial_fname)[0]
pial_rr = read_surface(pial_fname)[0]
src_surf_is_pial = (
op.isfile(pial_fname)
and src[0]["rr"].shape == pial_rr.shape
and np.allclose(src[0]["rr"], pial_rr)
)
if not src_surf_is_pial:
warn(
Expand All @@ -3890,7 +3893,7 @@ def stc_near_sensors(
"or ``surface=None`` to suppress this warning",
DeprecationWarning,
)
surface = "pial"
surface = "pial" if src is None or src.kind == "surface" else None

# create a copy of Evoked using ecog, seeg and dbs
if picks is None:
Expand Down
10 changes: 8 additions & 2 deletions tutorials/clinical/20_seeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,14 @@

evoked = epochs.average()
stc = mne.stc_near_sensors(
evoked, trans, "fsaverage", subjects_dir=subjects_dir, src=vol_src, verbose="error"
) # ignore missing electrode warnings
evoked,
trans,
"fsaverage",
subjects_dir=subjects_dir,
src=vol_src,
surface=None,
verbose="error",
)
stc = abs(stc) # just look at magnitude
clim = dict(kind="value", lims=np.percentile(abs(evoked.data), [10, 50, 75]))

Expand Down