Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:SpikeInterface/spikeinterface into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgarcia committed Mar 4, 2024
2 parents e9418e9 + 6bcadd8 commit 4379fe3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand All @@ -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"]},
Expand All @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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
Expand Down

0 comments on commit 4379fe3

Please sign in to comment.