AllenInstitute / ecephys_spike_sorting

Modules for processing extracellular electrophysiology data from Neuropixels probes
Other
109 stars 91 forks source link

Fix PC metrics in cases where spike_templates != spike_clusters #49

Closed jsiegle closed 4 years ago

jsiegle commented 4 years ago

Previously, the code assumed that no manual merging/splitting took place prior to calculating the sorting quality metrics. However, if post-hoc manual curation (e.g. in phy) has occurred, the PC features (calculated by Kilosort) will no longer be correctly indexed by the spike_clusters array.

These changes fix indexing issues related to this discrepancy, such that PC-based metrics are now correctly calculated when spike_clusters and spike_templates do not match.