From 9fb7f344b578e0bf2a9436608757fdffaa008e06 Mon Sep 17 00:00:00 2001 From: chrishalcrow <57948917+chrishalcrow@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:59:35 +0100 Subject: [PATCH] use sa unit ids and switch order of id indep test --- .../qualitymetrics/quality_metric_calculator.py | 2 +- .../qualitymetrics/tests/test_metrics_functions.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spikeinterface/qualitymetrics/quality_metric_calculator.py b/src/spikeinterface/qualitymetrics/quality_metric_calculator.py index 123293f313..8a754fc7da 100644 --- a/src/spikeinterface/qualitymetrics/quality_metric_calculator.py +++ b/src/spikeinterface/qualitymetrics/quality_metric_calculator.py @@ -165,7 +165,7 @@ def _compute_metrics(self, sorting_analyzer, unit_ids=None, verbose=False, metri import pandas as pd - metrics = pd.DataFrame(index=sorting_analyzer.sorting.unit_ids) + metrics = pd.DataFrame(index=sorting_analyzer.unit_ids) # simple metrics not based on PCs for metric_name in metric_names: diff --git a/src/spikeinterface/qualitymetrics/tests/test_metrics_functions.py b/src/spikeinterface/qualitymetrics/tests/test_metrics_functions.py index 77909798a3..ee5d5849b3 100644 --- a/src/spikeinterface/qualitymetrics/tests/test_metrics_functions.py +++ b/src/spikeinterface/qualitymetrics/tests/test_metrics_functions.py @@ -286,10 +286,10 @@ def test_unit_id_order_independence(small_sorting_analyzer): small_sorting_analyzer_2, metric_names=get_quality_metric_list(), qm_params=qm_params ) - for metric, metric_1_data in quality_metrics_1.items(): - assert quality_metrics_2[metric][2] == metric_1_data["#3"] - assert quality_metrics_2[metric][7] == metric_1_data["#9"] - assert quality_metrics_2[metric][1] == metric_1_data["#4"] + for metric, metric_2_data in quality_metrics_2.items(): + assert quality_metrics_1[metric]["#3"] == metric_2_data[2] + assert quality_metrics_1[metric]["#9"] == metric_2_data[7] + assert quality_metrics_1[metric]["#4"] == metric_2_data[1] def _sorting_analyzer_simple():