Skip to content

Commit

Permalink
Fixed bug in make_pc_features for templates w no spikes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobpennington committed Sep 5, 2024
1 parent b2f5ded commit a2d745f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kilosort/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def make_pc_features(ops, spike_templates, spike_clusters, tF):

# xy: template centers, iC: channels associated with each template
xy, iC = xy_templates(ops)
n_templates = iC.shape[1]
n_clusters = np.unique(spike_clusters).size
n_chans = ops['nearest_chans']
feature_ind = np.zeros((n_clusters, n_chans), dtype=np.uint32)
Expand All @@ -89,7 +90,7 @@ def make_pc_features(ops, spike_templates, spike_clusters, tF):
# Get templates associated with cluster (often just 1)
iunq = np.unique(spike_templates[spike_clusters==i]).astype(int)
# Get boolean mask with size (n_templates,), True if they match cluster
ix = torch.from_numpy(np.zeros(int(spike_templates.max())+1, bool))
ix = torch.from_numpy(np.zeros(n_templates, bool))
ix[iunq] = True
# Get PC features for all spikes detected with those templates (Xd),
# and the indices in tF where those spikes occur (igood).
Expand Down

0 comments on commit a2d745f

Please sign in to comment.