Skip to content

Pull from main#21

Merged
ttngu207 merged 2 commits into
main_external-storagefrom
main
Feb 9, 2026
Merged

Pull from main#21
ttngu207 merged 2 commits into
main_external-storagefrom
main

Conversation

@ttngu207
Copy link
Copy Markdown

@ttngu207 ttngu207 commented Feb 9, 2026

Pull all latest changes from main

ttngu207 and others added 2 commits January 20, 2026 14:46
SpikeInterface's export_to_phy exports sparse templates by default (since
v0.101.0), with templates.npy shape (n_templates, n_samples, max_sparse_channels)
instead of the full (n_templates, n_samples, n_channels) format from native
Kilosort.

The companion file templates_ind.npy maps (template_idx, sparse_channel_idx)
to actual channel indices, with -1 indicating padding.

This fix updates get_best_channel() and extract_spike_depths() to:
- Check if templates_ind exists (indicates SI-exported sparse format)
- Use templates_ind to map sparse indices to actual channel indices
- Fall back to original behavior for native Kilosort (dense) format

Without this fix, spike_sites and best_channel values are incorrect when
reading SI-exported Phy curations, as argmax returns indices into the
sparse representation rather than actual channel indices.

Related: dj-sciops/nei_nienborg#111 (Issue #2)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix sparse template handling in kilosort reader for SI-exported Phy data
@ttngu207 ttngu207 merged commit 9904b6e into main_external-storage Feb 9, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants