SpikeInterface / SpikeInterface/spikeinterface
Remove artifacts recording not used in Kilosort
@alejoe91 is already working on this.
Since Mar 16, 2026.
- Dominant language
- Python
- Stars
- 847
- Forks
- 280
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 29
Description
Hello! I have been using spikeinterface's run_sorter function in two ways:
sorting = si.run_sorter('kilosort4', blanked_rec, folder=outputFolder, docker_image=False, verbose=True, remove_existing_folder=False, raise_error=True, **params_kilosort4)
where (1), blanked_rec is a variable (a RemoveArtifactsRecording) that comes from running this:
blanked_rec = si.remove_artifacts(recording=recording_to_blank, list_triggers=mStim_sample_idx, ms_before=ms_before, ms_after=ms_after)
(we want to remove the artifact of microstimulation on the recording)
and where (2), blanked_rec is a loaded recording of (1) saved (a BinaryFolderRecording):
blanked_rec.save(folder=output_path)
...
blanked_rec=si.load(blanked_filename)
However, in both cases we found that despite the blanked recording looking good when manually scrolling through it, kilosort seems to use an incorrect recording. When doing manual curation in phy, some spikes are detected during the period that is blanked, which is visible when plotting the spiketimes relative to the TTLs that were blanked (picture attached). Many units also have suspiciously low spikecounts.
I think (1) didn't work because the RemoveArtifactsRecording is only a wrapper to the actual recording underneath. But I cannot explain why (2) didn't work either. Was there anything else wrong in my approach?
Any help is greatly appreciated!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.