Skip to content

Commit

Permalink
Don't support 4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Jun 27, 2024
1 parent c8779fc commit 8677291
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/scripts/check_kilosort4_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@


def get_pypi_versions(package_name):
"""
Make an API call to pypi to retrieve all
available versions of the kilosort package.
"""
url = f"https://pypi.org/pypi/{package_name}/json"
response = requests.get(url)
response.raise_for_status()
data = response.json()
versions = list(sorted(data["releases"].keys()))
versions.pop(versions.index("4.0.4"))
return list(sorted(data["releases"].keys()))


if __name__ == "__main__":
# Get all KS4 versions from pipi and write to file.
package_name = "kilosort"
versions = get_pypi_versions(package_name)
with open(Path(os.path.realpath(__file__)).parent / "kilosort4-latest-version.json", "w") as f:
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/test_kilosort4_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _check_arguments(self, object_, expected_arguments):

# Full Test ####
@pytest.mark.parametrize("parameter", PARAMS_TO_TEST)
def test_kilosort4(self, recording_and_paths, default_results, tmp_path, parameter):
def test_kilosort4_main(self, recording_and_paths, default_results, tmp_path, parameter):
"""
Given a recording, paths to raw data, and a parameter to change,
run KS4 natively and within the SpikeInterface wrapper with the
Expand Down Expand Up @@ -398,6 +398,7 @@ def test_kilosort4(self, recording_and_paths, default_results, tmp_path, paramet
if parse(version("kilosort")) > parse("4.0.4"):
self._check_test_parameters_are_changing_the_output(results, default_results, param_key)

@pytest.mark.skipif(parse(version("kilosort")) == parse("4.0.9"), reason="nblock=0 fails on KS4=4.0.9")
def test_kilosort4_no_correction(self, recording_and_paths, tmp_path):
"""
Test the SpikeInterface wrappers `do_correction` argument. We set
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_kilosort4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10"] # TODO: just checking python version is not cause of failing test.
python-version: ["3.12"] # TODO: just checking python version is not cause of failing test.
os: [ubuntu-latest]
ks_version: ${{ fromJson(needs.versions.outputs.matrix) }}
steps:
Expand Down
5 changes: 5 additions & 0 deletions src/spikeinterface/sorters/external/kilosort4.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):

logging.basicConfig(level=logging.INFO)

if cls.get_sorter_version() == version.parse("4.0.4"):
raise RuntimeError(
"Kilosort version 4.0.4 is not supported" "in SpikeInterface. Please change Kilosort version."
)

sorter_output_folder = sorter_output_folder.absolute()

probe_filename = sorter_output_folder / "probe.prb"
Expand Down

0 comments on commit 8677291

Please sign in to comment.