Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added bad channels for kilosort >= 4.0.14 #3316

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/spikeinterface/sorters/external/kilosort4.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Kilosort4Sorter(BaseSorter):
"skip_kilosort_preprocessing": False,
"scaleproc": None,
"torch_device": "auto",
"bad_channels": None,
}

_params_description = {
Expand Down Expand Up @@ -99,6 +100,7 @@ class Kilosort4Sorter(BaseSorter):
"skip_kilosort_preprocessing": "Can optionally skip the internal kilosort preprocessing",
"scaleproc": "int16 scaling of whitened data, if None set to 200.",
"torch_device": "Select the torch device auto/cuda/cpu",
"bad_channels": "A list of channel indices (rows in the binary file) that should not be included in sorting. Listing channels here is equivalent to excluding them from the probe dictionary.",
}

sorter_description = """Kilosort4 is a Python package for spike sorting on GPUs with template matching.
Expand Down Expand Up @@ -205,7 +207,17 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):
# NOTE: Also modifies settings in-place
data_dir = ""
results_dir = sorter_output_folder
filename, data_dir, results_dir, probe = set_files(settings, filename, probe, probe_name, data_dir, results_dir)
bad_channels = params["bad_channels"]

if version.parse(cls.get_sorter_version()) >= version.parse("4.0.14"):
filename, data_dir, results_dir, probe = set_files(
settings, filename, probe, probe_name, data_dir, results_dir, bad_channels
)
else:
filename, data_dir, results_dir, probe = set_files(
settings, filename, probe, probe_name, data_dir, results_dir
)

if version.parse(cls.get_sorter_version()) >= version.parse("4.0.12"):
ops = initialize_ops(settings, probe, recording.get_dtype(), do_CAR, invert_sign, device, False)
n_chan_bin, fs, NT, nt, twav_min, chan_map, dtype, do_CAR, invert, _, _, tmin, tmax, artifact, _, _ = (
Expand Down