# Kilosort2 Bug Fix

**URL:** <https://community.brain-map.org/t/kilosort2-bug-fix/3667>\
**Category:** General\
**Tags:** brain-observatory-visual-coding\
**Created:** [September 12, 2024, 2:29pm UTC](https://community.brain-map.org/t/kilosort2-bug-fix/3667 "2024-09-12T14:29:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangyiifann](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/yangyiifann/32/1839_2.png) [@yangyiifann](https://community.brain-map.org/u/yangyiifann)\
**Post date:** [September 12, 2024, 2:29pm UTC](https://community.brain-map.org/t/kilosort2-bug-fix/3667/1 "2024-09-12T14:29:14Z")

</div>

Hi everyone,

I recently came across a report regarding a bug in Kilosort2, which was used for spike sorting in the Neuropixel dataset.

The bug, as detailed in the Kilosort Bug Report (see [Spike holes: Spikes within the batching edges are not detected · Issue #594 · MouseLand/Kilosort · GitHub](https://github.com/MouseLand/Kilosort/issues/594)), can cause “spike holes,” leading to missed spike detections at regular time intervals. This issue has been fixed in the latest Kilosort2.

Does anyone know if this fix has been applied to the latest release of the Allen visual coding dataset?

Thanks in advance for any insights!

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [September 12, 2024, 7:33pm UTC](https://community.brain-map.org/t/kilosort2-bug-fix/3667/2 "2024-09-12T19:33:09Z")

</div>

The Visual Coding Neuropixels dataset has not changed since it was initially released in 2019, so it doesn’t have this fix applied. It is unlikely we will resort everything with the patched version of Kilosort – given that the bug results in at most 0.3% of spikes being missed, we do not think it will impact scientific conclusions drawn from this dataset.

---

<div class="post-metadata">

**Author:** ![yangyiifann](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/yangyiifann/32/1839_2.png) [@yangyiifann](https://community.brain-map.org/u/yangyiifann)\
**Post date:** [September 12, 2024, 10:41pm UTC](https://community.brain-map.org/t/kilosort2-bug-fix/3667/3 "2024-09-12T22:41:10Z")

</div>

Hi Josh,  
Thank you for your prompt response.

I have a couple of follow-up questions if you don’t mind.  
1. For the Neuropixels dataset, was the default batch size of Kilosort2 used for the spike sorting?  
2. Could you clarify how the estimate that at most 0.3% of spikes are missed was derived?

Thanks again and looking forward to your reply.

---

<div class="post-metadata">

**Author:** ![joshs](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/joshs/32/8_2.png) [@joshs](https://community.brain-map.org/u/joshs)\
**Post date:** [September 13, 2024, 12:27am UTC](https://community.brain-map.org/t/kilosort2-bug-fix/3667/4 "2024-09-13T00:27:41Z")

</div>

Yes, we used the default batch size.

If there are 7 ms gaps every 2.18 seconds, that represents 7/2180 \* 100 = 0.3% of the data.

---

<div class="post-metadata">

**Author:** ![yangyiifann](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/yangyiifann/32/1839_2.png) [@yangyiifann](https://community.brain-map.org/u/yangyiifann)\
**Post date:** [September 13, 2024, 2:07am UTC](https://community.brain-map.org/t/kilosort2-bug-fix/3667/5 "2024-09-13T02:07:21Z")

</div>

I see. Thank you for the clarifications!
