Skip to content

Commit

Permalink
fix synchrony
Browse files Browse the repository at this point in the history
  • Loading branch information
zm711 committed Nov 22, 2024
1 parent e175bdc commit bf96fe1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,13 @@ def _compute_metrics(self, sorting_analyzer, unit_ids=None, verbose=False, metri
# we do this because the convert_dtypes infers the wrong types sometimes.
# the actual types for columns can be found in column_name_to_column_dtype dictionary.
for column in metrics.columns:
metrics[column] = metrics[column].astype(column_name_to_column_dtype[column])
# we have one issue where the name of the columns for synchrony are named based on
# what the user has input as arguments so we need a way to handle this separately
# everything else should be handled with the column name.
if "sync" in column:
metrics[column] = metrics[column].astype(column_name_to_column_dtype["sync"])
else:
metrics[column] = metrics[column].astype(column_name_to_column_dtype[column])

return metrics

Expand Down
3 changes: 2 additions & 1 deletion src/spikeinterface/qualitymetrics/quality_metric_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"silhouette_full": ["silhouette_full"],
}

# this dict allows us to ensure the appropriate dtype of metrics rather than allow Pandas to infer them
column_name_to_column_dtype = {
"num_spikes": int,
"firing_rate": float,
Expand All @@ -98,7 +99,7 @@
"amplitude_median": float,
"amplitude_cv_median": float,
"amplitude_cv_range": float,
"synch": float,
"sync": float,
"firing_range": float,
"drift_ptp": float,
"drift_std": float,
Expand Down

0 comments on commit bf96fe1

Please sign in to comment.