@@ -89,6 +89,21 @@ def __init__(self, parent):
8989 else :
9090 self .bad_channels = []
9191
92+ self .shank_idx_text = QtWidgets .QLabel ("Shank Index:" )
93+ self .shank_idx_input = QtWidgets .QLineEdit ()
94+ if self .gui .qt_settings .contains ('shank_idx' ):
95+ idx = self .gui .qt_settings .value ('shank_idx' )
96+ if isinstance (idx , str ):
97+ self .shank_idx = float (idx )
98+ elif isinstance (idx , list ):
99+ self .shank_idx = [float (s ) for s in idx ]
100+ else :
101+ self .shank_idx = idx
102+ else :
103+ self .shank_idx = None
104+ self .shank_idx_input .setText (str (self .shank_idx ))
105+
106+
92107 self .dtype_selector_text = QtWidgets .QLabel ("Data dtype:" )
93108 self .dtype_selector = QtWidgets .QComboBox ()
94109 self .populate_dtype_selector ()
@@ -227,6 +242,18 @@ def setup(self):
227242 "excluding them from the probe dictionary."
228243 )
229244
245+ row_count += rspan
246+ layout .addWidget (self .shank_idx_text , row_count , col1 , rspan , cspan1 )
247+ layout .addWidget (self .shank_idx_input , row_count , col2 , rspan , cspan2 )
248+ self .shank_idx_input .editingFinished .connect (self .update_shank_idx )
249+ self .shank_idx_text .setToolTip (
250+ "If not None, only channels from the specified shank index will be used. "
251+ "If a list is provided, each shank will be sorted sequentially and results "
252+ "will be saved in separate subfolders. Note that the shank_idx value(s) "
253+ "must match the actual value specified in `probe['kcoords']`. For example, "
254+ "`probe_idx=0` will not work if `probe['kcoords']` uses 1,2,3,4."
255+ )
256+
230257
231258 # Add small vertical space for visual grouping
232259 row_count += rspan
@@ -755,13 +782,23 @@ def update_bad_channels(self):
755782 # Remove brackets and white space if present, convert to list of ints.
756783 self .bad_channels = self .get_bad_channels ()
757784 self .gui .qt_settings .setValue ('bad_channels' , self .bad_channels )
758-
759785 if not self .pause_checks :
760- # Trigger update so that probe layout in main gets updated, then
761- # refresh probe view.
762- self .update_settings ()
763786 self .previewProbe .emit ()
764787
788+ @QtCore .Slot ()
789+ def update_shank_idx (self ):
790+ # Remove brackets and white space if present, convert to list of floats.
791+ text = self .shank_idx_input .text ()
792+ text = text .replace (']' ,'' ).replace ('[' ,'' ).replace (' ' ,'' )
793+ if len (text ) > 0 and text .lower () != 'none' :
794+ idx = float (text )
795+ else :
796+ idx = None
797+ self .shank_idx = idx
798+ self .gui .qt_settings .setValue ('shank_idx' , self .shank_idx )
799+
800+ if not self .pause_checks :
801+ self .previewProbe .emit ()
765802
766803 def on_data_dtype_selected (self , data_dtype ):
767804 self .data_dtype = data_dtype
0 commit comments