Skip to content

Commit 8ab15b8

Browse files
authored
Merge pull request #4196 from chrishalcrow/fix-export-to-phy-unitrefine
Change `export_to_phy` args in auto-curation
2 parents 7f379f9 + 6ad3814 commit 8ab15b8

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/spikeinterface/curation/model_based_curation.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,9 @@ def _check_params_for_classification(self, enforce_metric_params=False, model_in
188188
else:
189189
warnings.warn(warning_message)
190190

191-
def _export_to_phy(self, classified_units):
191+
def _export_to_phy(self, classified_df):
192192
"""Export the classified units to Phy as cluster_prediction.tsv file"""
193193

194-
import pandas as pd
195-
196-
# Create a new DataFrame with unit_id, prediction, and probability columns from dict {unit_id: (prediction, probability)}
197-
classified_df = pd.DataFrame.from_dict(classified_units, orient="index", columns=["prediction", "probability"])
198-
199194
# Export to Phy format
200195
try:
201196
sorting_path = self.sorting_analyzer.sorting.get_annotation("phy_folder")

src/spikeinterface/curation/tests/test_model_based_curation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def test_model_based_classification_get_metrics_for_classification(
9999
def test_model_based_classification_export_to_phy(sorting_analyzer_for_curation, model):
100100
# Test the _export_to_phy() method of ModelBasedClassification
101101
model_based_classification = ModelBasedClassification(sorting_analyzer_for_curation, model[0])
102-
classified_units = {0: (1, 0.5), 1: (0, 0.5), 2: (1, 0.5), 3: (0, 0.5), 4: (1, 0.5)}
102+
import pandas as pd
103+
104+
classified_units = pd.DataFrame.from_dict({0: (1, 0.5), 1: (0, 0.5), 2: (1, 0.5), 3: (0, 0.5), 4: (1, 0.5)})
103105
# Function should fail here
104106
with pytest.raises(ValueError):
105107
model_based_classification._export_to_phy(classified_units)

0 commit comments

Comments
 (0)