File tree Expand file tree Collapse file tree
element_array_ephys/spike_sorting Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,11 +275,17 @@ def make(self, key):
275275
276276 analyzer_output_dir = output_dir / sorter_name / "sorting_analyzer"
277277
278+ has_units = si_sorting .unit_ids .size > 0
279+
278280 @memoized_result (
279281 uniqueness_dict = postprocessing_params ,
280282 output_directory = analyzer_output_dir ,
281283 )
282284 def _sorting_analyzer_compute ():
285+ if not has_units :
286+ log .info ("No units found in sorting object. Skipping sorting analyzer." )
287+ return
288+
283289 # Sorting Analyzer
284290 sorting_analyzer = si .create_sorting_analyzer (
285291 sorting = si_sorting ,
@@ -303,6 +309,8 @@ def _sorting_analyzer_compute():
303309
304310 _sorting_analyzer_compute ()
305311
312+ do_si_export = postprocessing_params .get ("export_to_phy" , False ) or postprocessing_params .get ("export_report" , False )
313+
306314 self .insert1 (
307315 {
308316 ** key ,
@@ -311,8 +319,7 @@ def _sorting_analyzer_compute():
311319 datetime .utcnow () - execution_time
312320 ).total_seconds ()
313321 / 3600 ,
314- "do_si_export" : postprocessing_params .get ("export_to_phy" , False )
315- or postprocessing_params .get ("export_report" , False ),
322+ "do_si_export" : do_si_export and has_units ,
316323 }
317324 )
318325
You can’t perform that action at this time.
0 commit comments