1717
1818- Do some tests to check all KS4 parameters are tested against.
1919"""
20+
2021import pytest
2122import copy
2223from typing import Any
9192 "acg_threshold" ,
9293 "cluster_downsampling" ,
9394 "cluster_pcs" ,
94- "duplicate_spike_ms" # this is because gorund-truth spikes don't have violations
95+ "duplicate_spike_ms" , # this is because gorund-truth spikes don't have violations
9596]
9697
9798# THIS IS A PLACEHOLDER FOR FUTURE PARAMS TO TEST
@@ -145,7 +146,6 @@ def default_kilosort_sorting(self, recording_and_paths):
145146
146147 return si .read_kilosort (defaults_ks_output_dir )
147148
148-
149149 def _get_ground_truth_recording (self ):
150150 """
151151 A ground truth recording chosen to be as small as possible (for speed).
@@ -225,7 +225,9 @@ def test_spikeinterface_defaults_against_kilsort(self):
225225
226226 # Testing Arguments ###
227227 def test_set_files_arguments (self ):
228- self ._check_arguments (set_files , ["settings" , "filename" , "probe" , "probe_name" , "data_dir" , "results_dir" , "bad_channels" ])
228+ self ._check_arguments (
229+ set_files , ["settings" , "filename" , "probe" , "probe_name" , "data_dir" , "results_dir" , "bad_channels" ]
230+ )
229231
230232 def test_initialize_ops_arguments (self ):
231233 expected_arguments = [
@@ -247,13 +249,17 @@ def test_compute_preprocessing_arguments(self):
247249 self ._check_arguments (compute_preprocessing , ["ops" , "device" , "tic0" , "file_object" ])
248250
249251 def test_compute_drift_location_arguments (self ):
250- self ._check_arguments (compute_drift_correction , ["ops" , "device" , "tic0" , "progress_bar" , "file_object" , "clear_cache" ])
252+ self ._check_arguments (
253+ compute_drift_correction , ["ops" , "device" , "tic0" , "progress_bar" , "file_object" , "clear_cache" ]
254+ )
251255
252256 def test_detect_spikes_arguments (self ):
253257 self ._check_arguments (detect_spikes , ["ops" , "device" , "bfile" , "tic0" , "progress_bar" , "clear_cache" ])
254258
255259 def test_cluster_spikes_arguments (self ):
256- self ._check_arguments (cluster_spikes , ["st" , "tF" , "ops" , "device" , "bfile" , "tic0" , "progress_bar" , "clear_cache" ])
260+ self ._check_arguments (
261+ cluster_spikes , ["st" , "tF" , "ops" , "device" , "bfile" , "tic0" , "progress_bar" , "clear_cache" ]
262+ )
257263
258264 def test_save_sorting_arguments (self ):
259265 expected_arguments = ["ops" , "results_dir" , "st" , "clu" , "tF" , "Wall" , "imin" , "tic0" , "save_extra_vars" ]
@@ -397,7 +403,6 @@ def test_kilosort4_no_correction(self, recording_and_paths, tmp_path):
397403 )
398404 check_sortings_equal (sorting_ks , sorting_si )
399405
400-
401406 def test_use_binary_file (self , tmp_path ):
402407 """
403408 Test that the SpikeInterface wrapper can run KS4 using a binary file as input or directly
@@ -410,21 +415,21 @@ def test_use_binary_file(self, tmp_path):
410415 sorting_ks4 = si .run_sorter (
411416 "kilosort4" ,
412417 recording ,
413- folder = tmp_path / "spikeinterface_output_dir_wrapper" ,
418+ folder = tmp_path / "spikeinterface_output_dir_wrapper" ,
414419 use_binary_file = False ,
415420 remove_existing_folder = True ,
416421 )
417422 sorting_ks4_bin = si .run_sorter (
418423 "kilosort4" ,
419424 recording_bin ,
420- folder = tmp_path / "spikeinterface_output_dir_bin" ,
425+ folder = tmp_path / "spikeinterface_output_dir_bin" ,
421426 use_binary_file = False ,
422427 remove_existing_folder = True ,
423428 )
424429 sorting_ks4_non_bin = si .run_sorter (
425430 "kilosort4" ,
426431 recording ,
427- folder = tmp_path / "spikeinterface_output_dir_non_bin" ,
432+ folder = tmp_path / "spikeinterface_output_dir_non_bin" ,
428433 use_binary_file = True ,
429434 remove_existing_folder = True ,
430435 )
@@ -546,7 +551,6 @@ def monkeypatch_filter_function(self, X, ops=None, ibatch=None):
546551 results ["si" ]["clus" ] = np .load (spikeinterface_output_dir / "sorter_output" / "spike_clusters.npy" )
547552 assert np .allclose (results ["ks" ]["st" ], results ["si" ]["st" ], rtol = 0 , atol = 1 )
548553
549-
550554 ##### Helpers ######
551555 def _get_kilosort_native_settings (self , recording , paths , param_key , param_value ):
552556 """
@@ -571,8 +575,7 @@ def _get_kilosort_native_settings(self, recording, paths, param_key, param_value
571575 if param_key in RUN_KILOSORT_ARGS :
572576 run_kilosort_kwargs = {param_key : param_value }
573577 else :
574- if param_key != "change_nothing" :
575- settings .update ({param_key : param_value })
578+ settings .update ({param_key : param_value })
576579 run_kilosort_kwargs = {}
577580
578581 ks_format_probe = load_probe (paths ["probe_path" ])
0 commit comments