File tree Expand file tree Collapse file tree
src/spikeinterface/widgets Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,6 +73,13 @@ def __init__(
7373 if unit_ids is None :
7474 unit_ids = sorting .unit_ids
7575
76+ if sorting .get_num_segments () > 1 :
77+ if segment_index is None :
78+ warn ("More than one segment available! Using `segment_index = 0`." )
79+ segment_index = 0
80+ else :
81+ segment_index = 0
82+
7683 amplitudes_segment = amplitudes [segment_index ]
7784 total_duration = sorting_analyzer .get_num_samples (segment_index ) / sorting_analyzer .sampling_frequency
7885
Original file line number Diff line number Diff line change @@ -305,15 +305,19 @@ def __init__(
305305 ):
306306 if sorting is None and sorting_analyzer is None :
307307 raise Exception ("Must supply either a sorting or a sorting_analyzer" )
308- if sorting is not None and sorting_analyzer is not None :
308+ elif sorting is not None and sorting_analyzer is not None :
309309 raise Exception ("Should supply either a sorting or a sorting_analyzer, not both" )
310- if sorting_analyzer is not None :
310+ elif sorting_analyzer is not None :
311311 sorting = sorting_analyzer .sorting
312312
313313 sorting = self .ensure_sorting (sorting )
314314
315- if segment_index is None and sorting .get_num_segments () != 1 :
316- raise ValueError ("You must provide segment_index=..." )
315+ if sorting .get_num_segments () > 1 :
316+ if segment_index is None :
317+ warn ("More than one segment available! Using `segment_index = 0`." )
318+ segment_index = 0
319+ else :
320+ segment_index = 0
317321
318322 if unit_ids is None :
319323 unit_ids = sorting .unit_ids
You can’t perform that action at this time.
0 commit comments