Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix metrics widgets for convert_dtypes #3417

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions src/spikeinterface/widgets/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def plot_sortingview(self, data_plot, **backend_kwargs):
values = check_json(metrics.loc[unit_id].to_dict())
values_skip_nans = {}
for k, v in values.items():
# convert_dypes returns NaN as None or np.nan (for float)
if v is None:
continue
if np.isnan(v):
continue
values_skip_nans[k] = v
Expand Down
2 changes: 1 addition & 1 deletion src/spikeinterface/widgets/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def setUpClass(cls):
spike_amplitudes=dict(),
unit_locations=dict(),
spike_locations=dict(),
quality_metrics=dict(metric_names=["snr", "isi_violation", "num_spikes"]),
quality_metrics=dict(metric_names=["snr", "isi_violation", "num_spikes", "amplitude_cutoff"]),
template_metrics=dict(),
correlograms=dict(),
template_similarity=dict(),
Expand Down
8 changes: 4 additions & 4 deletions src/spikeinterface/widgets/utils_sortingview.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def generate_unit_table_view(
if prop_name in sorting_props:
property_values = sorting.get_property(prop_name)
elif prop_name in qm_props:
property_values = qm_data[prop_name].values
property_values = qm_data[prop_name].to_numpy()
elif prop_name in tm_props:
property_values = tm_data[prop_name].values
property_values = tm_data[prop_name].to_numpy()
else:
warn(f"Property '{prop_name}' not found in sorting, quality_metrics, or template_metrics")
continue
Expand Down Expand Up @@ -137,9 +137,9 @@ def generate_unit_table_view(
if prop_name in sorting_props:
property_values = sorting.get_property(prop_name)
elif prop_name in qm_props:
property_values = qm_data[prop_name].values
property_values = qm_data[prop_name].to_numpy()
elif prop_name in tm_props:
property_values = tm_data[prop_name].values
property_values = tm_data[prop_name].to_numpy()

# Check for NaN values and round floats
val0 = np.array(property_values[0])
Expand Down