@@ -359,12 +359,12 @@ def run_for_all_spikes(self, file_path=None, verbose=False, **job_kwargs):
359359
360360 job_kwargs = fix_job_kwargs (job_kwargs )
361361 p = self .params
362- we = self .sorting_analyzer
363- sorting = we .sorting
362+ sorting_analyzer = self .sorting_analyzer
363+ sorting = sorting_analyzer .sorting
364364 assert (
365- we .has_recording ()
366- ), "To compute PCA projections for all spikes, the waveform extractor needs the recording"
367- recording = we .recording
365+ sorting_analyzer .has_recording () or sorting_analyzer . has_temporary_recording ()
366+ ), "To compute PCA projections for all spikes, the sorting analyzer needs the recording"
367+ recording = sorting_analyzer .recording
368368
369369 # assert sorting.get_num_segments() == 1
370370 assert p ["mode" ] in ("by_channel_local" , "by_channel_global" )
@@ -374,8 +374,9 @@ def run_for_all_spikes(self, file_path=None, verbose=False, **job_kwargs):
374374
375375 sparsity = self .sorting_analyzer .sparsity
376376 if sparsity is None :
377- sparse_channels_indices = {unit_id : np .arange (we .get_num_channels ()) for unit_id in we .unit_ids }
378- max_channels_per_template = we .get_num_channels ()
377+ num_channels = recording .get_num_channels ()
378+ sparse_channels_indices = {unit_id : np .arange (num_channels ) for unit_id in sorting_analyzer .unit_ids }
379+ max_channels_per_template = num_channels
379380 else :
380381 sparse_channels_indices = sparsity .unit_id_to_channel_indices
381382 max_channels_per_template = max ([chan_inds .size for chan_inds in sparse_channels_indices .values ()])
@@ -449,9 +450,7 @@ def _fit_by_channel_local(self, n_jobs, progress_bar):
449450 return pca_models
450451
451452 def _fit_by_channel_global (self , progress_bar ):
452- # we = self.sorting_analyzer
453453 p = self .params
454- # unit_ids = we.unit_ids
455454 unit_ids = self .sorting_analyzer .unit_ids
456455
457456 # there is one unique PCA accross channels
0 commit comments