Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added lowpass parameter, fixed verbose option #3262

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/spikeinterface/sorters/external/herdingspikes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class HerdingspikesSorter(BaseSorter):
"chunk_size": None,
"rescale": True,
"rescale_value": -1280.0,
"lowpass": True,
"common_reference": "median",
"spike_duration": 1.0,
"amp_avg_duration": 0.4,
Expand Down Expand Up @@ -53,6 +54,7 @@ class HerdingspikesSorter(BaseSorter):
"out_file": "Path and filename to store detection and clustering results. (`str`, `HS2_detected`)",
"verbose": "Print progress information. (`bool`, `True`)",
"chunk_size": " Number of samples per chunk during detection. If `None`, a suitable value will be estimated. (`int`, `None`)",
"lowpass": "Enable internal low-pass filtering (simple two-step average). (`bool`, `True`)",
"common_reference": "Method for common reference filtering, can be `average` or `median` (`str`, `median`)",
"rescale": "Automatically re-scale the data. (`bool`, `True`)",
"rescale_value": "Factor by which data is re-scaled. (`float`, `-1280.0`)",
Expand Down Expand Up @@ -122,20 +124,21 @@ def _run_from_folder(cls, sorter_output_folder, params, verbose):

hs_version = version.parse(hs.__version__)

if hs_version >= version.parse("0.4.001"):
if hs_version >= version.parse("0.4.1"):
lightning_api = True
else:
lightning_api = False

assert (
lightning_api
), "HerdingSpikes version <0.4.001 is no longer supported. run:\n>>> pip install --upgrade herdingspikes"
), "HerdingSpikes version <0.4.1 is no longer supported. To upgrade, run:\n>>> pip install --upgrade herdingspikes"

recording = cls.load_recording_from_folder(sorter_output_folder.parent, with_warnings=False)

sorted_file = str(sorter_output_folder / "HS2_sorted.hdf5")
params["out_file"] = str(sorter_output_folder / "HS2_detected")
p = params
p.update({"verbose": verbose})

det = hs.HSDetectionLightning(recording, p)
det.DetectFromRaw()
Expand Down