Skip to content

Commit

Permalink
catch more entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahpearl committed Aug 28, 2024
1 parent 5f98660 commit c992ca6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/spikeinterface/core/sortinganalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,8 @@ def save_as(self, format="memory", folder=None) -> "SortingAnalyzer":
format : "memory" | "binary_folder" | "zarr", default: "memory"
The new backend format to use
"""
if format == "zarr":
folder = clean_zarr_folder_name(folder)
return self._save_or_select_or_merge(format=format, folder=folder)

def select_units(self, unit_ids, format="memory", folder=None) -> "SortingAnalyzer":
Expand All @@ -855,6 +857,8 @@ def select_units(self, unit_ids, format="memory", folder=None) -> "SortingAnalyz
The newly create sorting_analyzer with the selected units
"""
# TODO check that unit_ids are in same order otherwise many extension do handle it properly!!!!
if format == "zarr":
folder = clean_zarr_folder_name(folder)
return self._save_or_select_or_merge(format=format, folder=folder, unit_ids=unit_ids)

def remove_units(self, remove_unit_ids, format="memory", folder=None) -> "SortingAnalyzer":
Expand All @@ -881,6 +885,8 @@ def remove_units(self, remove_unit_ids, format="memory", folder=None) -> "Sortin
"""
# TODO check that unit_ids are in same order otherwise many extension do handle it properly!!!!
unit_ids = self.unit_ids[~np.isin(self.unit_ids, remove_unit_ids)]
if format == "zarr":
folder = clean_zarr_folder_name(folder)
return self._save_or_select_or_merge(format=format, folder=folder, unit_ids=unit_ids)

def merge_units(
Expand Down Expand Up @@ -939,6 +945,9 @@ def merge_units(
The newly create `SortingAnalyzer` with the selected units
"""

if format == "zarr":
folder = clean_zarr_folder_name(folder)

assert merging_mode in ["soft", "hard"], "Merging mode should be either soft or hard"

if len(merge_unit_groups) == 0:
Expand Down

0 comments on commit c992ca6

Please sign in to comment.