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

Fix use of keep during run_sorter benchmark #3556

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/spikeinterface/benchmark/benchmark_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,11 @@ def run(self, case_keys=None, keep=True, verbose=False, **job_kwargs):
for key in case_keys:

result_folder = self.folder / "results" / self.key_to_str(key)
sorter_folder = self.folder / "sorters" / self.key_to_str(key)

if keep and result_folder.exists():
continue
elif not keep and result_folder.exists():
elif not keep and (result_folder.exists() or sorter_folder.exists()):
self.remove_benchmark(key)
job_keys.append(key)

Expand Down
9 changes: 9 additions & 0 deletions src/spikeinterface/benchmark/benchmark_sorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ def create_benchmark(self, key):
benchmark = SorterBenchmark(recording, gt_sorting, params, sorter_folder)
return benchmark

def remove_benchmark(self, key):
BenchmarkStudy.remove_benchmark(self, key)

sorter_folder = self.folder / "sorters" / self.key_to_str(key)
import shutil

if sorter_folder.exists():
shutil.rmtree(sorter_folder)

def get_performance_by_unit(self, case_keys=None):
import pandas as pd

Expand Down
Loading