Skip to content

Fix spike holes with the default NT in Kilosort 2.5 and 3 - #4952

Open
grahamfindlay wants to merge 1 commit into
SpikeInterface:mainfrom
grahamfindlay:kilosort-batch-size-default
Open

grahamfindlay wants to merge 1 commit into
SpikeInterface:mainfrom
grahamfindlay:kilosort-batch-size-default

Conversation

@grahamfindlay

Copy link
Copy Markdown
Collaborator

Defaults Kilosort 2.5 / 3 batch size to 64 * 1024 - ntbuff to avoid spike holes. See #2562 .

Since the new value 64 * 1024 - ntbuff is actually worse than the old value of 64 * 1024 + ntbuff if you don't have a patched version of Kilosort, I added a check for the installed Kilosort version (bit of a hack, but I'm not sure how better to do it), and pick the best value of NT accordingly. And warn if the user has an unpatched version.

Kilosort 2.5.2 and 3.0.2 expect this value (or another multiple of 1024,
minus ntbuff). The old default left a
hole of missed spikes at the end of every batch. Kilosort installs from
before the fix keep the old value (because it is less harmful than the
new one if you don't have the fix) and get a warning.
@grahamfindlay grahamfindlay added bug Something isn't working sorters Related to sorters module labels Nov 18, 2026
@Alexandros-Christou

Copy link
Copy Markdown

What should happen for an older compiled installation? In _get_default_batch_size(), check_compiled() == True skips the source check and returns 64 * 1024 - ntbuff. get_sorter_version() also returns only "compiled" in that case. Given the warning here that this value is worse for an unpatched version, could that path warn when the patch status is unknown, or ask for an explicit NT? A test for the compiled path and one for a missing trackAndSort.m would make the intended fallback clearer.

This is from reading the wrapper and the new tests; I have not run either sorter.

@grahamfindlay

Copy link
Copy Markdown
Collaborator Author

I didn't even know it could be compiled... Looking into it, does that ever happen outside of SpikeInterface's own Docker images? The latest images have the fix, so they're fine. I'd be hesitant to add a warning, because most users would just get a warning with nothing for them to act on. I guess if someone had an older unpatched image pinned by hand they could get holes with the new defaults, but I don't see how to tell which Kilosort versions those older images use. I'm not even sure which Kilosort the 0.2.0 tags have. It seems like the proper fix is for images to record their Kilosort version for get_sorter_version(). Which is a change in spikeinterface-dockerfiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working sorters Related to sorters module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants