diff --git a/src/spikeinterface/sortingcomponents/clustering/position_and_features.py b/src/spikeinterface/sortingcomponents/clustering/position_and_features.py index 805a1572fd..3c58b5edb9 100644 --- a/src/spikeinterface/sortingcomponents/clustering/position_and_features.py +++ b/src/spikeinterface/sortingcomponents/clustering/position_and_features.py @@ -48,7 +48,7 @@ class PositionAndFeaturesClustering: @classmethod def main_function(cls, recording, peaks, params): from sklearn.preprocessing import QuantileTransformer - + assert HAVE_HDBSCAN, "twisted clustering needs hdbscan to be installed" if "n_jobs" in params["job_kwargs"]: @@ -70,7 +70,10 @@ def main_function(cls, recording, peaks, params): position_method = d["peak_localization_kwargs"]["method"] - features_list = [position_method, "ptp",] + features_list = [ + position_method, + "ptp", + ] features_params = { position_method: {"radius_um": params["radius_um"]}, "ptp": {"all_channels": False, "radius_um": params["radius_um"]}, @@ -85,8 +88,6 @@ def main_function(cls, recording, peaks, params): hdbscan_data[:, 1] = features_data[0]["y"] hdbscan_data[:, 2] = features_data[1] - - preprocessing = QuantileTransformer(output_distribution="uniform") hdbscan_data = preprocessing.fit_transform(hdbscan_data) diff --git a/src/spikeinterface/sortingcomponents/tests/test_features_from_peaks.py b/src/spikeinterface/sortingcomponents/tests/test_features_from_peaks.py index 160ba3cb36..9bc9fd9ab0 100644 --- a/src/spikeinterface/sortingcomponents/tests/test_features_from_peaks.py +++ b/src/spikeinterface/sortingcomponents/tests/test_features_from_peaks.py @@ -26,7 +26,11 @@ def test_features_from_peaks(): **job_kwargs, ) - feature_list = ["amplitude", "ptp", "center_of_mass",] + feature_list = [ + "amplitude", + "ptp", + "center_of_mass", + ] feature_params = { "amplitude": {"all_channels": False, "peak_sign": "neg"}, "ptp": {"all_channels": False}, @@ -44,9 +48,11 @@ def test_features_from_peaks(): # split feature variable job_kwargs["n_jobs"] = 2 - amplitude, ptp, com, = compute_features_from_peaks( - recording, peaks, feature_list, feature_params=feature_params, **job_kwargs - ) + ( + amplitude, + ptp, + com, + ) = compute_features_from_peaks(recording, peaks, feature_list, feature_params=feature_params, **job_kwargs) assert amplitude.ndim == 1 # because all_channels=False assert ptp.ndim == 1 # because all_channels=False assert com.ndim == 1