Skip to content

Commit

Permalink
Merge pull request #3409 from zm711/fix-argument
Browse files Browse the repository at this point in the history
Fix argument spelling in check for binary compatibility
  • Loading branch information
alejoe91 authored Sep 15, 2024
2 parents 72d072a + 0f59486 commit e83bbdf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
19 changes: 17 additions & 2 deletions src/spikeinterface/core/baserecording.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,13 @@ def get_binary_description(self):
raise NotImplementedError

def binary_compatible_with(
self, dtype=None, time_axis=None, file_paths_lenght=None, file_offset=None, file_suffix=None
self,
dtype=None,
time_axis=None,
file_paths_length=None,
file_offset=None,
file_suffix=None,
file_paths_lenght=None,
):
"""
Check is the recording is binary compatible with some constrain on
Expand All @@ -779,6 +785,15 @@ def binary_compatible_with(
* file_offset
* file_suffix
"""

# spelling typo need to fix
if file_paths_lenght is not None:
warnings.warn(
"`file_paths_lenght` is deprecated and will be removed in 0.103.0 please use `file_paths_length`"
)
if file_paths_length is None:
file_paths_length = file_paths_lenght

if not self.is_binary_compatible():
return False

Expand All @@ -790,7 +805,7 @@ def binary_compatible_with(
if time_axis is not None and time_axis != d["time_axis"]:
return False

if file_paths_lenght is not None and file_paths_lenght != len(d["file_paths"]):
if file_paths_length is not None and file_paths_length != len(d["file_paths"]):
return False

if file_offset is not None and file_offset != d["file_offset"]:
Expand Down
6 changes: 3 additions & 3 deletions src/spikeinterface/sorters/external/kilosort4.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _setup_recording(cls, recording, sorter_output_folder, params, verbose):
write_prb(probe_filename, pg)

if params["use_binary_file"]:
if not recording.binary_compatible_with(time_axis=0, file_paths_lenght=1):
if not recording.binary_compatible_with(time_axis=0, file_paths_length=1):
# local copy needed
binary_file_path = sorter_output_folder / "recording.dat"
write_binary_recording(
Expand Down Expand Up @@ -235,7 +235,7 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):
probe_name = ""

if params["use_binary_file"] is None:
if recording.binary_compatible_with(time_axis=0, file_paths_lenght=1):
if recording.binary_compatible_with(time_axis=0, file_paths_length=1):
# no copy
binary_description = recording.get_binary_description()
filename = str(binary_description["file_paths"][0])
Expand All @@ -247,7 +247,7 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):
file_object = RecordingExtractorAsArray(recording_extractor=recording)
elif params["use_binary_file"]:
# here we force the use of a binary file
if recording.binary_compatible_with(time_axis=0, file_paths_lenght=1):
if recording.binary_compatible_with(time_axis=0, file_paths_length=1):
# no copy
binary_description = recording.get_binary_description()
filename = str(binary_description["file_paths"][0])
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/sorters/external/kilosortbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _setup_recording(cls, recording, sorter_output_folder, params, verbose):
skip_kilosort_preprocessing = params.get("skip_kilosort_preprocessing", False)

if (
recording.binary_compatible_with(dtype="int16", time_axis=0, file_paths_lenght=1)
recording.binary_compatible_with(dtype="int16", time_axis=0, file_paths_length=1)
and not skip_kilosort_preprocessing
):
# no copy
Expand Down

0 comments on commit e83bbdf

Please sign in to comment.