Skip to content

Commit 56fff23

Browse files
committed
Merge branch 'refactor_GTStudy' of github.com:samuelgarcia/spikeinterface into refactor_GTStudy
2 parents 7cbbdef + 4016136 commit 56fff23

14 files changed

Lines changed: 51 additions & 39 deletions

doc/modules/benchmark.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The all mechanism is based on an intrinsic organization into a "study_folder" wi
103103
# some plots
104104
m = comp.get_confusion_matrix()
105105
w_comp = sw.plot_agreement_matrix(sorting_comparison=comp)
106-
106+
107107
# Collect synthetic dataframes and display
108108
# As shown previously, the performance is returned as a pandas dataframe.
109109
# The spikeinterface.comparison.get_performance_by_unit() function,

doc/modules/comparison.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,3 @@ sorting analyzers from day 1 (:code:`analyzer_day1`) to day 5 (:code:`analyzer_d
412412
# match all
413413
m_tcmp = sc.compare_multiple_templates(waveform_list=analyzer_list,
414414
name_list=["D1", "D2", "D3", "D4", "D5"])
415-
416-
417-
418-

src/spikeinterface/benchmark/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
* some sorting components (clustering, motion, template matching)
55
"""
66

7-
from .benchmark_sorter import SorterStudy
7+
from .benchmark_sorter import SorterStudy

src/spikeinterface/benchmark/benchmark_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ def get_run_times(self, case_keys=None):
259259

260260
def plot_run_times(self, case_keys=None):
261261
from .benchmark_plot_tools import plot_run_times
262+
262263
return plot_run_times(self, case_keys=case_keys)
263264

264265
def compute_results(self, case_keys=None, verbose=False, **result_params):
@@ -445,4 +446,3 @@ def run(self):
445446
def compute_result(self):
446447
# run becnhmark result
447448
raise NotImplementedError
448-

src/spikeinterface/benchmark/benchmark_clustering.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,18 @@ def get_count_units(self, case_keys=None, well_detected_score=None, redundant_sc
163163
# plotting by methods
164164
def plot_unit_counts(self, **kwargs):
165165
from .benchmark_plot_tools import plot_unit_counts
166+
166167
return plot_unit_counts(self, **kwargs)
167168

168169
def plot_agreement_matrix(self, **kwargs):
169170
from .benchmark_plot_tools import plot_agreement_matrix
171+
170172
return plot_agreement_matrix(self, **kwargs)
171173

172174
def plot_performances_vs_snr(self, **kwargs):
173175
from .benchmark_plot_tools import plot_performances_vs_snr
174-
return plot_performances_vs_snr(self, **kwargs)
175176

177+
return plot_performances_vs_snr(self, **kwargs)
176178

177179
def plot_error_metrics(self, metric="cosine", case_keys=None, figsize=(15, 5)):
178180

src/spikeinterface/benchmark/benchmark_matching.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ def create_benchmark(self, key):
6363

6464
def plot_agreement_matrix(self, **kwargs):
6565
from .benchmark_plot_tools import plot_agreement_matrix
66+
6667
return plot_agreement_matrix(self, **kwargs)
6768

6869
def plot_performances_vs_snr(self, **kwargs):
6970
from .benchmark_plot_tools import plot_performances_vs_snr
70-
return plot_performances_vs_snr(self, **kwargs)
7171

72+
return plot_performances_vs_snr(self, **kwargs)
7273

7374
def plot_collisions(self, case_keys=None, figsize=None):
7475
if case_keys is None:

src/spikeinterface/benchmark/benchmark_peak_selection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from .benchmark_base import Benchmark, BenchmarkStudy
1212

13+
1314
class PeakSelectionBenchmark(Benchmark):
1415

1516
def __init__(self, recording, gt_sorting, params, indices, exhaustive_gt=True):

src/spikeinterface/benchmark/benchmark_plot_tools.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import numpy as np
22

33

4-
54
def _simpleaxis(ax):
65
ax.spines["top"].set_visible(False)
76
ax.spines["right"].set_visible(False)
@@ -28,7 +27,6 @@ def plot_run_times(study, case_keys=None):
2827
run_times = study.get_run_times(case_keys=case_keys)
2928

3029
colors = study.get_colors()
31-
3230

3331
fig, ax = plt.subplots()
3432
labels = []
@@ -58,7 +56,6 @@ def plot_unit_counts(study, case_keys=None):
5856
if case_keys is None:
5957
case_keys = list(study.cases.keys())
6058

61-
6259
count_units = study.get_count_units(case_keys=case_keys)
6360

6461
fig, ax = plt.subplots()
@@ -95,6 +92,7 @@ def plot_unit_counts(study, case_keys=None):
9592

9693
return fig
9794

95+
9896
def plot_performances(study, mode="ordered", performance_names=("accuracy", "precision", "recall"), case_keys=None):
9997
"""
10098
Plot performances over case for a study.
@@ -121,10 +119,9 @@ def plot_performances(study, mode="ordered", performance_names=("accuracy", "pre
121119
if case_keys is None:
122120
case_keys = list(study.cases.keys())
123121

124-
perfs=study.get_performance_by_unit(case_keys=case_keys)
122+
perfs = study.get_performance_by_unit(case_keys=case_keys)
125123
colors = study.get_colors()
126124

127-
128125
if mode in ("ordered", "snr"):
129126
num_axes = len(performance_names)
130127
fig, axs = plt.subplots(ncols=num_axes)
@@ -195,7 +192,6 @@ def plot_agreement_matrix(study, ordered=True, case_keys=None):
195192
if case_keys is None:
196193
case_keys = list(study.cases.keys())
197194

198-
199195
num_axes = len(case_keys)
200196
fig, axs = plt.subplots(ncols=num_axes)
201197

@@ -238,9 +234,9 @@ def plot_performances_vs_snr(study, case_keys=None, figsize=None, metrics=["accu
238234
y = study.get_result(key)["gt_comparison"].get_performance()[k].values
239235
ax.scatter(x, y, marker=".", label=label)
240236
ax.set_title(k)
241-
237+
242238
ax.set_ylim(0, 1.05)
243-
239+
244240
if count == 2:
245241
ax.legend()
246242

src/spikeinterface/benchmark/benchmark_sorter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
This replace the previous `GroundTruthStudy`
33
"""
44

5-
65
import numpy as np
76
from ..core import NumpySorting
87
from .benchmark_base import Benchmark, BenchmarkStudy
@@ -40,6 +39,7 @@ def compute_result(self):
4039
("gt_comparison", "pickle"),
4140
]
4241

42+
4343
class SorterStudy(BenchmarkStudy):
4444
"""
4545
This class is used to tests several sorter in several situtation.
@@ -121,15 +121,15 @@ def get_count_units(self, case_keys=None, well_detected_score=None, redundant_sc
121121
# plotting as methods
122122
def plot_unit_counts(self, **kwargs):
123123
from .benchmark_plot_tools import plot_unit_counts
124+
124125
return plot_unit_counts(self, **kwargs)
125126

126127
def plot_performances(self, **kwargs):
127128
from .benchmark_plot_tools import plot_performances
129+
128130
return plot_performances(self, **kwargs)
129131

130132
def plot_agreement_matrix(self, **kwargs):
131133
from .benchmark_plot_tools import plot_agreement_matrix
132-
return plot_agreement_matrix(self, **kwargs)
133-
134-
135134

135+
return plot_agreement_matrix(self, **kwargs)

src/spikeinterface/benchmark/tests/test_benchmark_peak_selection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pathlib import Path
44

5+
56
@pytest.mark.skip()
67
def test_benchmark_peak_selection(create_cache_folder):
78
cache_folder = create_cache_folder

0 commit comments

Comments
 (0)