MouseLand / Kilosort

Fast spike sorting with drift correction
https://kilosort.readthedocs.io/en/latest/
GNU General Public License v3.0
477 stars 248 forks source link

Run spike sorting on multiple files from the same session #811

Open PiezaKake opened 1 week ago

PiezaKake commented 1 week ago

Feature you'd like to see:

Run Spike sorting on multiple files with the same configuration from the same session

Additional Context

Hi, I was wondering if it is possible to run spike sorting on multiple files with the same configuration. I will soon start recording with open ephys, and my plan was to record multiple files in each session. Is it possible to 'feed' all files from a single session into kilosort for a single spike sorting output, insead of running spike sorting for each file individually?

jacobpennington commented 1 week ago

There isn't currently a way to do this through Kilosort, but it will be available in the future. The utility I was adding for it still needs some work.

jacobpennington commented 1 week ago

Actually, not as much work as I thought. There's a working version in the latest commit, but like I said I haven't done much testing with it yet. If you want to try it, you can install using the developer instructions at the bottom of the read me and pull the latest changes. This is the minimal code needed:

from kilosort import run_kilosort
from kilosort.io import BinaryFileGroup, load_probe

# Also add whatever else you need to set for your data, like sampling rate
settings = {'n_chan_bin': 385}
probe = load_probe(probe_path)
# Recommended: set filename to the directory containing the data files.
# It can be any path that exists, but you do need to provide a filename still.
filename = data_dir
# Use the file_object argument
file_obj = BinaryFileGroup.from_filenames(list_of_filenames, n_chan_bin)
_ = run_kilosort(settings=settings, filename=data_dir, probe=probe, file_object=file_obj)
PiezaKake commented 1 week ago

Thanks, I will give this try, but do you have any idea when the final add-on will be available? I just wanted to check whether it will be available by the time I start the data analysis

jacobpennington commented 1 week ago

I don't know, we have other priorities for development right now.