Skip to content

Commit fd2e813

Browse files
authored
Update _pg_figure.py
BUGFIX: Handle empty ypos in SingleChannelAnnot to avoid broadcasting error (#316)
1 parent 3d9cffd commit fd2e813

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mne_qt_browser/_pg_figure.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2589,7 +2589,10 @@ def __init__(self, mne, weakmain, annot, ch_name):
25892589
self.ch_name = ch_name
25902590

25912591
ypos = np.where(self.mne.ch_names[self.mne.ch_order] == self.ch_name)[0] + 1
2592-
self.ypos = ypos + np.array([-0.5, 0.5])
2592+
if ypos is not None and len(ypos) > 0:
2593+
self.ypos = ypos + np.array([-0.5, 0.5])
2594+
else:
2595+
self.ypos = np.array([]) # Prevent broadcasting error
25932596

25942597
# self.lower = PlotCurveItem()
25952598
# self.upper = PlotCurveItem()

0 commit comments

Comments
 (0)