Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/spikeinterface/core/sorting_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,14 @@ def set_properties_after_merging(
keep_pre_inds = sorting_pre_merge.ids_to_indices(kept_unit_ids)
keep_post_inds = sorting_post_merge.ids_to_indices(kept_unit_ids)

default_missing_values = BaseExtractor.default_missing_property_values

for key in prop_keys:
parent_values = sorting_pre_merge.get_property(key)
if parent_values.dtype.kind not in default_missing_values:
# if the property is boolean or integer there is no missing values so we skip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my info since I don't set properties. You mean that in the case of float you can have a nan or what is a "missing value"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nan for float.
a "" for str
like we have in the base class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. Missing values are defined here: https://github.com/SpikeInterface/spikeinterface/blob/main/src/spikeinterface/core/base.py#L38

For ints and bool, we don't have missing values :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool thanks.

# for instance reccussive "is_merged" will not be propagated
continue

# propagate keep values
shape = (len(sorting_post_merge.unit_ids),) + parent_values.shape[1:]
Expand All @@ -377,7 +383,7 @@ def set_properties_after_merging(
# and new values only if they are all similar
new_values[new_index] = merge_values[0]
else:
default_missing_values = BaseExtractor.default_missing_property_values

new_values[new_index] = default_missing_values[parent_values.dtype.kind]
sorting_post_merge.set_property(key, new_values)

Expand Down
Loading