|
20 | 20 |
|
21 | 21 | import pytest |
22 | 22 | import copy |
23 | | -from typing import Any |
| 23 | +from packaging.version import parse |
24 | 24 | from inspect import signature |
25 | 25 |
|
26 | 26 | import numpy as np |
|
84 | 84 | "duplicate_spike_ms": 0.3, |
85 | 85 | } |
86 | 86 |
|
87 | | -PARAMS_TO_TEST = list(PARAMS_TO_TEST_DICT.keys()) |
88 | | - |
89 | 87 | PARAMETERS_NOT_AFFECTING_RESULTS = [ |
90 | 88 | "artifact_threshold", |
91 | 89 | "ccg_threshold", |
|
95 | 93 | "duplicate_spike_ms", # this is because ground-truth spikes don't have violations |
96 | 94 | ] |
97 | 95 |
|
98 | | -# THIS IS A PLACEHOLDER FOR FUTURE PARAMS TO TEST |
99 | | -# if parse(version("kilosort")) >= parse("4.0.X"): |
100 | | -# PARAMS_TO_TEST_DICT.update( |
101 | | -# [ |
102 | | -# {"new_param": new_value}, |
103 | | -# ] |
104 | | -# ) |
| 96 | + |
| 97 | +# Add/Remove version specific parameters |
| 98 | +if parse(kilosort.__version__) >= parse("4.0.22"): |
| 99 | + PARAMS_TO_TEST_DICT.update( |
| 100 | + {"position_limit": 50} |
| 101 | + ) |
| 102 | + # Position limit only affects computing spike locations after sorting |
| 103 | + PARAMETERS_NOT_AFFECTING_RESULTS.append("position_limit") |
| 104 | + |
| 105 | +if parse(kilosort.__version__) >= parse("4.0.24"): |
| 106 | + PARAMS_TO_TEST_DICT.update( |
| 107 | + {"max_peels": 200}, |
| 108 | + ) |
| 109 | + # max_peels is not affecting the results in this short dataset |
| 110 | + PARAMETERS_NOT_AFFECTING_RESULTS.append("max_peels") |
| 111 | + |
| 112 | + |
| 113 | +PARAMS_TO_TEST = list(PARAMS_TO_TEST_DICT.keys()) |
105 | 114 |
|
106 | 115 |
|
107 | 116 | class TestKilosort4Long: |
@@ -249,17 +258,22 @@ def test_compute_preprocessing_arguments(self): |
249 | 258 | self._check_arguments(compute_preprocessing, ["ops", "device", "tic0", "file_object"]) |
250 | 259 |
|
251 | 260 | def test_compute_drift_location_arguments(self): |
252 | | - self._check_arguments( |
253 | | - compute_drift_correction, ["ops", "device", "tic0", "progress_bar", "file_object", "clear_cache"] |
254 | | - ) |
| 261 | + expected_arguments = ["ops", "device", "tic0", "progress_bar", "file_object", "clear_cache"] |
| 262 | + if parse(kilosort.__version__) >= parse("4.0.28"): |
| 263 | + expected_arguments += ["verbose"] |
| 264 | + self._check_arguments(compute_drift_correction, expected_arguments) |
255 | 265 |
|
256 | 266 | def test_detect_spikes_arguments(self): |
257 | | - self._check_arguments(detect_spikes, ["ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"]) |
| 267 | + expected_arguments = ["ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"] |
| 268 | + if parse(kilosort.__version__) >= parse("4.0.28"): |
| 269 | + expected_arguments += ["verbose"] |
| 270 | + self._check_arguments(detect_spikes, expected_arguments) |
258 | 271 |
|
259 | 272 | def test_cluster_spikes_arguments(self): |
260 | | - self._check_arguments( |
261 | | - cluster_spikes, ["st", "tF", "ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"] |
262 | | - ) |
| 273 | + expected_arguments = ["st", "tF", "ops", "device", "bfile", "tic0", "progress_bar", "clear_cache"] |
| 274 | + if parse(kilosort.__version__) >= parse("4.0.28"): |
| 275 | + expected_arguments += ["verbose"] |
| 276 | + self._check_arguments(cluster_spikes, expected_arguments) |
263 | 277 |
|
264 | 278 | def test_save_sorting_arguments(self): |
265 | 279 | expected_arguments = ["ops", "results_dir", "st", "clu", "tF", "Wall", "imin", "tic0", "save_extra_vars"] |
|
0 commit comments