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
2 changes: 1 addition & 1 deletion examples/inverse/plot_time_frequency_mixed_norm_inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
subjects_dir=subjects_dir, mode='orthoview',
idx='amplitude')

# # Plot dipole locations of all dipoles with MRI slices
# # Plot dipole locations of all dipoles with MRI slices:
# for dip in dipoles:
# plot_dipole_locations(dip, forward['mri_head_t'], 'sample',
# subjects_dir=subjects_dir, mode='orthoview',
Expand Down
6 changes: 3 additions & 3 deletions mne/viz/_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -1904,11 +1904,11 @@ def _plot_stc(stc, subject, surface, hemi, colormap, time_label,
"volume_options": volume_options,
"verbose": False,
}
for hi, hemi in enumerate(hemis):
for hemi in hemis:
if isinstance(stc, _BaseVolSourceEstimate): # no surf data
break
vertices = stc.vertices[hi]
if len(stc.vertices[hi]) == 0: # no surf data for the given hemi
vertices = stc.vertices[0 if hemi == 'lh' else 1]
if len(vertices) == 0: # no surf data for the given hemi
continue # no data
use_kwargs = kwargs.copy()
use_kwargs.update(hemi=hemi)
Expand Down
6 changes: 6 additions & 0 deletions mne/viz/_brain/tests/test_brain.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ def test_single_hemi(hemi, renderer_interactive, brain_gc):
subjects_dir=subjects_dir, hemi='both', size=300)
brain.close()

# test skipping when len(vertices) == 0
stc.vertices[1 - idx] = np.array([])
brain = stc.plot(
subjects_dir=subjects_dir, hemi=hemi, size=300)
brain.close()


@testing.requires_testing_data
@pytest.mark.slowtest
Expand Down