Skip to content

Commit 7aca913

Browse files
committed
add split_by_property to basesorter load
1 parent 3b0bf56 commit 7aca913

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/spikeinterface/sorters/basesorter.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,17 @@ def get_result_from_folder(cls, output_folder, register_recording=True, sorting_
344344
if recording is not None:
345345
sorting.register_recording(recording)
346346

347+
if recording.get_annotation("split_by_property") is not None:
348+
split_by_property = recording.get_annotation("split_by_property")
349+
property_values = set(recording.get_property(split_by_property))
350+
if len(property_values) > 1:
351+
warnings.warn(
352+
f"Registered Recording has non-unique {split_by_property} keys. They are {property_values}."
353+
)
354+
elif len(property_values) == 1:
355+
property_value = next(iter(property_values))
356+
sorting.set_property("split_by_property", values=[property_value] * sorting.get_num_units())
357+
347358
if sorting_info:
348359
# set sorting info to Sorting object
349360
if (output_folder / "spikeinterface_recording.json").exists():

0 commit comments

Comments
 (0)