From 3042e3edf1373053da680143328940af73db6db9 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Wed, 22 Nov 2023 17:14:30 +0100 Subject: [PATCH 1/2] Fix sortingview checks for NaN if strings --- src/spikeinterface/widgets/utils_sortingview.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/spikeinterface/widgets/utils_sortingview.py b/src/spikeinterface/widgets/utils_sortingview.py index 50bbab99df..c4a85c9332 100644 --- a/src/spikeinterface/widgets/utils_sortingview.py +++ b/src/spikeinterface/widgets/utils_sortingview.py @@ -75,9 +75,10 @@ def generate_unit_table_view(sorting, unit_properties=None, similarity_scores=No for ui, unit in enumerate(sorting.unit_ids): for prop_name in valid_unit_properties: property_values = sorting.get_property(prop_name) - val0 = property_values[0] - if np.isnan(property_values[ui]): - continue + val0 = np.array(property_values[0]) + if val0.dtype.kind in "iufb": + if np.isnan(property_values[ui]): + continue values[prop_name] = property_values[ui] ut_rows.append(vv.UnitsTableRow(unit_id=unit, values=check_json(values))) From a49394a061448929f061cbf29ea6d63e217690b2 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Thu, 23 Nov 2023 11:03:40 +0100 Subject: [PATCH 2/2] Update src/spikeinterface/widgets/utils_sortingview.py --- src/spikeinterface/widgets/utils_sortingview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spikeinterface/widgets/utils_sortingview.py b/src/spikeinterface/widgets/utils_sortingview.py index c4a85c9332..2d20e28e6d 100644 --- a/src/spikeinterface/widgets/utils_sortingview.py +++ b/src/spikeinterface/widgets/utils_sortingview.py @@ -76,7 +76,7 @@ def generate_unit_table_view(sorting, unit_properties=None, similarity_scores=No for prop_name in valid_unit_properties: property_values = sorting.get_property(prop_name) val0 = np.array(property_values[0]) - if val0.dtype.kind in "iufb": + if val0.dtype.kind == "f": if np.isnan(property_values[ui]): continue values[prop_name] = property_values[ui]