holobench 1.13.0__py2.py3-none-any.whl → 1.16.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bencher/bench_cfg.py +7 -3
- bencher/example/example_image.py +27 -2
- bencher/example/example_video.py +19 -2
- bencher/results/bench_result.py +1 -1
- bencher/results/bench_result_base.py +2 -2
- bencher/results/holoview_result.py +191 -42
- bencher/utils.py +3 -0
- {holobench-1.13.0.dist-info → holobench-1.16.0.dist-info}/METADATA +4 -4
- {holobench-1.13.0.dist-info → holobench-1.16.0.dist-info}/RECORD +10 -10
- {holobench-1.13.0.dist-info → holobench-1.16.0.dist-info}/WHEEL +0 -0
bencher/bench_cfg.py
CHANGED
@@ -344,9 +344,13 @@ class BenchCfg(BenchRunCfg):
|
|
344
344
|
def inputs_as_str(self) -> List[str]:
|
345
345
|
return [i.name for i in self.input_vars]
|
346
346
|
|
347
|
-
def describe_sweep(self, width: int = 800) -> pn.pane.Markdown:
|
347
|
+
def describe_sweep(self, width: int = 800, accordion=True) -> pn.pane.Markdown:
|
348
348
|
"""Produce a markdown summary of the sweep settings"""
|
349
|
-
|
349
|
+
|
350
|
+
desc = pn.pane.Markdown(self.describe_benchmark(), width=width)
|
351
|
+
if accordion:
|
352
|
+
return pn.Accordion(("Data Collection Parameters", desc))
|
353
|
+
return desc
|
350
354
|
|
351
355
|
def describe_benchmark(self) -> str:
|
352
356
|
"""Generate a string summary of the inputs and results from a BenchCfg
|
@@ -427,7 +431,7 @@ class BenchCfg(BenchRunCfg):
|
|
427
431
|
if self.description is not None and description:
|
428
432
|
col.append(self.to_description())
|
429
433
|
if describe_sweep:
|
430
|
-
col.append(
|
434
|
+
col.append(self.describe_sweep())
|
431
435
|
if results_suffix:
|
432
436
|
col.append(pn.pane.Markdown("## Results:"))
|
433
437
|
return col
|
bencher/example/example_image.py
CHANGED
@@ -19,7 +19,7 @@ class BenchPolygons(bch.ParametrizedSweep):
|
|
19
19
|
color = bch.StringSweep(["red", "green", "blue"])
|
20
20
|
polygon = bch.ResultImage()
|
21
21
|
area = bch.ResultVar()
|
22
|
-
|
22
|
+
side_length = bch.ResultVar()
|
23
23
|
|
24
24
|
def __call__(self, **kwargs):
|
25
25
|
self.update_params_from_kwargs(**kwargs)
|
@@ -27,6 +27,9 @@ class BenchPolygons(bch.ParametrizedSweep):
|
|
27
27
|
# self.hmap = hv.Curve(points)
|
28
28
|
self.polygon = self.points_to_polygon_png(points, bch.gen_image_path("polygon"))
|
29
29
|
self.area = self.radius * self.sides
|
30
|
+
|
31
|
+
self.side_length = 2 * self.radius * math.sin(math.pi / self.sides)
|
32
|
+
self.area = (self.sides * self.side_length**2) / (4 * math.tan(math.pi / self.sides))
|
30
33
|
return super().__call__()
|
31
34
|
|
32
35
|
def points_to_polygon_png(self, points: list[float], filename: str):
|
@@ -74,6 +77,8 @@ def example_image(
|
|
74
77
|
f"Polygons Sweeping {len(s)} Parameters",
|
75
78
|
input_vars=s,
|
76
79
|
)
|
80
|
+
bench.report.append(bench.get_result().to_panes())
|
81
|
+
|
77
82
|
return bench
|
78
83
|
|
79
84
|
|
@@ -92,6 +97,24 @@ def example_image_vid(
|
|
92
97
|
|
93
98
|
if __name__ == "__main__":
|
94
99
|
|
100
|
+
def simple():
|
101
|
+
bench = BenchPolygons().to_bench(bch.BenchRunCfg(level=4))
|
102
|
+
|
103
|
+
# bench.plot_sweep(input_vars=["sides","color","radius"])
|
104
|
+
|
105
|
+
# res = bench.sweep(input_vars=["sides", "radius"])
|
106
|
+
|
107
|
+
# bench.report.append(res.to_heatmap(target_dimension=3))
|
108
|
+
|
109
|
+
bench.plot_sweep(input_vars=["sides"])
|
110
|
+
bench.plot_sweep(input_vars=["sides", "color"])
|
111
|
+
|
112
|
+
bench.plot_sweep(input_vars=["sides", "radius"])
|
113
|
+
|
114
|
+
# bench.report.append(res.to_line(target_dimension=1))
|
115
|
+
|
116
|
+
return bench
|
117
|
+
|
95
118
|
def example_image_vid_sequential(
|
96
119
|
run_cfg: bch.BenchRunCfg = bch.BenchRunCfg(), report: bch.BenchReport = bch.BenchReport()
|
97
120
|
) -> bch.Bench:
|
@@ -108,6 +131,8 @@ if __name__ == "__main__":
|
|
108
131
|
# ex_run_cfg.debug = True
|
109
132
|
# ex_run_cfg.repeats = 2
|
110
133
|
ex_run_cfg.level = 4
|
111
|
-
example_image_vid(ex_run_cfg).report.show()
|
134
|
+
# example_image_vid(ex_run_cfg).report.show()
|
135
|
+
simple().report.show()
|
136
|
+
|
112
137
|
# example_image_vid_sequential(ex_run_cfg).report.show()
|
113
138
|
# example_image(ex_run_cfg).report.show()
|
bencher/example/example_video.py
CHANGED
@@ -16,6 +16,7 @@ class TuringPattern(bch.ParametrizedSweep):
|
|
16
16
|
|
17
17
|
video = bch.ResultVideo()
|
18
18
|
score = bch.ResultVar()
|
19
|
+
img = bch.ResultImage()
|
19
20
|
|
20
21
|
def laplacian(self, Z, dx):
|
21
22
|
Ztop = Z[0:-2, 1:-1]
|
@@ -66,6 +67,8 @@ class TuringPattern(bch.ParametrizedSweep):
|
|
66
67
|
rgb = np.array(fig.canvas.renderer.buffer_rgba())
|
67
68
|
vid_writer.append(rgb)
|
68
69
|
|
70
|
+
self.img = bch.add_image(rgb)
|
71
|
+
|
69
72
|
self.video = vid_writer.write()
|
70
73
|
|
71
74
|
self.score = self.alpha + self.beta
|
@@ -92,12 +95,25 @@ def example_video(
|
|
92
95
|
def example_video_tap(
|
93
96
|
run_cfg: bch.BenchRunCfg = bch.BenchRunCfg(), report: bch.BenchReport = bch.BenchReport()
|
94
97
|
) -> bch.Bench: # pragma: no cover
|
95
|
-
|
96
|
-
|
98
|
+
tp = TuringPattern()
|
99
|
+
|
100
|
+
# run_cfg.use_sample_cache = False
|
101
|
+
# run_cfg.use_optuna = True
|
102
|
+
run_cfg.auto_plot = False
|
103
|
+
run_cfg.run_tag = "3"
|
104
|
+
bench = tp.to_bench(run_cfg=run_cfg, report=report)
|
105
|
+
|
106
|
+
res = bench.plot_sweep(
|
107
|
+
"phase",
|
97
108
|
input_vars=["alpha", "beta"],
|
98
109
|
# result_vars=["video","score"],
|
110
|
+
# result_vars=["score"],
|
111
|
+
run_cfg=run_cfg,
|
99
112
|
)
|
100
113
|
|
114
|
+
bench.report.append(res.describe_sweep())
|
115
|
+
bench.report.append(res.to_heatmap())
|
116
|
+
|
101
117
|
return bench
|
102
118
|
|
103
119
|
|
@@ -105,6 +121,7 @@ if __name__ == "__main__":
|
|
105
121
|
run_cfg_ex = bch.BenchRunCfg()
|
106
122
|
run_cfg_ex.level = 2
|
107
123
|
run_cfg_ex.use_sample_cache = True
|
124
|
+
run_cfg_ex.only_hash_tag = True
|
108
125
|
|
109
126
|
# example_video(run_cfg_ex).report.show()
|
110
127
|
example_video_tap(run_cfg_ex).report.show()
|
bencher/results/bench_result.py
CHANGED
@@ -20,7 +20,7 @@ class BenchResult(PlotlyResult, HoloviewResult, VideoSummaryResult):
|
|
20
20
|
@staticmethod
|
21
21
|
def default_plot_callbacks():
|
22
22
|
return [
|
23
|
-
VideoSummaryResult.to_video_summary,
|
23
|
+
# VideoSummaryResult.to_video_summary, #quite expensive so not turned on by default
|
24
24
|
HoloviewResult.to_bar,
|
25
25
|
HoloviewResult.to_scatter_jitter,
|
26
26
|
HoloviewResult.to_curve,
|
@@ -17,13 +17,13 @@ from copy import deepcopy
|
|
17
17
|
from bencher.results.optuna_result import OptunaResult
|
18
18
|
from bencher.variables.results import ResultVar
|
19
19
|
from bencher.plotting.plot_filter import VarRange, PlotFilter
|
20
|
+
from bencher.utils import listify
|
20
21
|
|
21
22
|
from bencher.variables.results import (
|
22
23
|
ResultReference,
|
23
24
|
)
|
24
25
|
|
25
26
|
from bencher.results.composable_container.composable_container_panel import ComposableContainerPanel
|
26
|
-
from bencher.utils import listify
|
27
27
|
|
28
28
|
# todo add plugins
|
29
29
|
# https://gist.github.com/dorneanu/cce1cd6711969d581873a88e0257e312
|
@@ -228,7 +228,7 @@ class BenchResultBase(OptunaResult):
|
|
228
228
|
return " vs ".join(tit)
|
229
229
|
|
230
230
|
def get_results_var_list(self, result_var: ParametrizedSweep = None) -> List[ResultVar]:
|
231
|
-
return self.bench_cfg.result_vars if result_var is None else
|
231
|
+
return self.bench_cfg.result_vars if result_var is None else listify(result_var)
|
232
232
|
|
233
233
|
def map_plots(
|
234
234
|
self,
|
@@ -8,12 +8,12 @@ from functools import partial
|
|
8
8
|
import hvplot.xarray # noqa pylint: disable=duplicate-code,unused-import
|
9
9
|
import xarray as xr
|
10
10
|
|
11
|
-
from bencher.utils import hmap_canonical_input, get_nearest_coords, get_nearest_coords1D
|
11
|
+
from bencher.utils import hmap_canonical_input, get_nearest_coords, get_nearest_coords1D, listify
|
12
12
|
from bencher.results.panel_result import PanelResult
|
13
13
|
from bencher.results.bench_result_base import ReduceType
|
14
14
|
|
15
15
|
from bencher.plotting.plot_filter import PlotFilter, VarRange
|
16
|
-
from bencher.variables.results import ResultVar
|
16
|
+
from bencher.variables.results import ResultVar, ResultImage, ResultVideo
|
17
17
|
|
18
18
|
|
19
19
|
hv.extension("bokeh", "plotly")
|
@@ -85,6 +85,7 @@ class HoloviewResult(PanelResult):
|
|
85
85
|
float_range=VarRange(0, 0),
|
86
86
|
cat_range=VarRange(0, None),
|
87
87
|
repeats_range=VarRange(1, 1),
|
88
|
+
panel_range=VarRange(0, None),
|
88
89
|
reduce=ReduceType.SQUEEZE,
|
89
90
|
target_dimension=2,
|
90
91
|
result_var=result_var,
|
@@ -124,15 +125,34 @@ class HoloviewResult(PanelResult):
|
|
124
125
|
**kwargs,
|
125
126
|
)
|
126
127
|
|
127
|
-
def to_line(
|
128
|
+
def to_line(
|
129
|
+
self,
|
130
|
+
result_var: Parameter = None,
|
131
|
+
tap_var=None,
|
132
|
+
tap_container: pn.pane.panel = None,
|
133
|
+
target_dimension=2,
|
134
|
+
**kwargs,
|
135
|
+
) -> Optional[pn.panel]:
|
136
|
+
if tap_var is None:
|
137
|
+
tap_var = self.plt_cnt_cfg.panel_vars
|
138
|
+
elif not isinstance(tap_var, list):
|
139
|
+
tap_var = [tap_var]
|
140
|
+
|
141
|
+
if len(tap_var) == 0 or self.plt_cnt_cfg.inputs_cnt > 1:
|
142
|
+
heatmap_cb = self.to_line_ds
|
143
|
+
else:
|
144
|
+
heatmap_cb = partial(
|
145
|
+
self.to_line_tap_ds, result_var_plots=tap_var, container=tap_container
|
146
|
+
)
|
147
|
+
|
128
148
|
return self.filter(
|
129
|
-
|
149
|
+
heatmap_cb,
|
130
150
|
float_range=VarRange(1, 1),
|
131
151
|
cat_range=VarRange(0, None),
|
132
152
|
repeats_range=VarRange(1, 1),
|
133
153
|
panel_range=VarRange(0, None),
|
134
154
|
reduce=ReduceType.SQUEEZE,
|
135
|
-
target_dimension=
|
155
|
+
target_dimension=target_dimension,
|
136
156
|
result_var=result_var,
|
137
157
|
result_types=(ResultVar),
|
138
158
|
**kwargs,
|
@@ -140,7 +160,6 @@ class HoloviewResult(PanelResult):
|
|
140
160
|
|
141
161
|
def to_line_ds(self, dataset: xr.Dataset, result_var: Parameter, **kwargs):
|
142
162
|
x = self.plt_cnt_cfg.float_vars[0].name
|
143
|
-
# y = self.plt_cnt_cfg.result_vars[0].name
|
144
163
|
by = None
|
145
164
|
if self.plt_cnt_cfg.cat_cnt >= 1:
|
146
165
|
by = self.plt_cnt_cfg.cat_vars[0].name
|
@@ -178,22 +197,28 @@ class HoloviewResult(PanelResult):
|
|
178
197
|
self,
|
179
198
|
result_var: Parameter = None,
|
180
199
|
tap_var=None,
|
181
|
-
tap_container=None,
|
200
|
+
tap_container: pn.pane.panel = None,
|
182
201
|
target_dimension=2,
|
183
202
|
**kwargs,
|
184
203
|
) -> Optional[pn.panel]:
|
185
204
|
if tap_var is None:
|
205
|
+
tap_var = self.plt_cnt_cfg.panel_vars
|
206
|
+
elif not isinstance(tap_var, list):
|
207
|
+
tap_var = [tap_var]
|
208
|
+
|
209
|
+
if len(tap_var) == 0:
|
186
210
|
heatmap_cb = self.to_heatmap_ds
|
187
211
|
else:
|
188
212
|
heatmap_cb = partial(
|
189
|
-
self.to_heatmap_container_tap_ds,
|
213
|
+
self.to_heatmap_container_tap_ds, result_var_plots=tap_var, container=tap_container
|
190
214
|
)
|
191
215
|
|
192
216
|
return self.filter(
|
193
217
|
heatmap_cb,
|
194
|
-
float_range=VarRange(
|
218
|
+
float_range=VarRange(0, None),
|
195
219
|
cat_range=VarRange(0, None),
|
196
|
-
input_range=VarRange(
|
220
|
+
input_range=VarRange(2, None),
|
221
|
+
panel_range=VarRange(0, None),
|
197
222
|
target_dimension=target_dimension,
|
198
223
|
result_var=result_var,
|
199
224
|
result_types=(ResultVar),
|
@@ -204,56 +229,180 @@ class HoloviewResult(PanelResult):
|
|
204
229
|
self, dataset: xr.Dataset, result_var: Parameter, **kwargs
|
205
230
|
) -> Optional[hv.HeatMap]:
|
206
231
|
if len(dataset.dims) >= 2:
|
207
|
-
x = self.
|
208
|
-
y = self.
|
232
|
+
x = self.bench_cfg.input_vars[0].name
|
233
|
+
y = self.bench_cfg.input_vars[1].name
|
209
234
|
C = result_var.name
|
210
235
|
title = f"Heatmap of {result_var.name}"
|
211
236
|
time_args = self.time_widget(title)
|
212
237
|
return dataset.hvplot.heatmap(x=x, y=y, C=C, cmap="plasma", **time_args, **kwargs)
|
213
238
|
return None
|
214
239
|
|
240
|
+
def result_var_to_container(self, result_var):
|
241
|
+
if isinstance(result_var, ResultImage):
|
242
|
+
return pn.pane.PNG
|
243
|
+
return pn.pane.Video if isinstance(result_var, ResultVideo) else pn.pane.panel
|
244
|
+
|
245
|
+
def setup_results_and_containers(self, result_var_plots, container, **kwargs):
|
246
|
+
result_var_plots = listify(result_var_plots)
|
247
|
+
if container is None:
|
248
|
+
containers = [self.result_var_to_container(rv) for rv in result_var_plots]
|
249
|
+
else:
|
250
|
+
containers = listify(container)
|
251
|
+
|
252
|
+
cont_instances = [c(**kwargs) for c in containers]
|
253
|
+
return result_var_plots, cont_instances
|
254
|
+
|
215
255
|
def to_heatmap_container_tap_ds(
|
216
256
|
self,
|
217
257
|
dataset: xr.Dataset,
|
218
258
|
result_var: Parameter,
|
219
|
-
|
220
|
-
container: pn.pane.panel =
|
259
|
+
result_var_plots: List[Parameter] = None,
|
260
|
+
container: pn.pane.panel = None,
|
221
261
|
**kwargs,
|
222
262
|
) -> pn.Row:
|
223
|
-
htmap = self.to_heatmap_ds(dataset, result_var).opts(tools=["hover"
|
224
|
-
|
225
|
-
|
226
|
-
|
263
|
+
htmap = self.to_heatmap_ds(dataset, result_var).opts(tools=["hover"], **kwargs)
|
264
|
+
result_var_plots, cont_instances = self.setup_results_and_containers(
|
265
|
+
result_var_plots, container
|
266
|
+
)
|
227
267
|
title = pn.pane.Markdown("Selected: None")
|
228
268
|
|
229
|
-
|
230
|
-
|
269
|
+
state = dict(x=None, y=None, update=False)
|
270
|
+
|
271
|
+
def tap_plot_heatmap(x, y): # pragma: no cover
|
272
|
+
# print(f"moved {x}{y}")
|
273
|
+
x_nearest_new = get_nearest_coords1D(
|
231
274
|
x, dataset.coords[self.bench_cfg.input_vars[0].name].data
|
232
275
|
)
|
233
|
-
|
276
|
+
y_nearest_new = get_nearest_coords1D(
|
234
277
|
y, dataset.coords[self.bench_cfg.input_vars[1].name].data
|
235
278
|
)
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
279
|
+
|
280
|
+
# xv = self.bench_cfg.input_vars[0].name
|
281
|
+
# yv = self.bench_cfg.input_vars[1].name
|
282
|
+
# nearest = get_nearest_coords(dataset, **{xv: x, yv: y})
|
283
|
+
# print(nearest)
|
284
|
+
# print(x_nearest_new,y_nearest_new)
|
285
|
+
|
286
|
+
if x_nearest_new != state["x"]:
|
287
|
+
state["x"] = x_nearest_new
|
288
|
+
state["update"] = True
|
289
|
+
if y_nearest_new != state["y"]:
|
290
|
+
state["y"] = y_nearest_new
|
291
|
+
state["update"] = True
|
292
|
+
|
293
|
+
if state["update"]:
|
294
|
+
kdims = {}
|
295
|
+
kdims[self.bench_cfg.input_vars[0].name] = state["x"]
|
296
|
+
kdims[self.bench_cfg.input_vars[1].name] = state["y"]
|
297
|
+
|
298
|
+
if hasattr(htmap, "current_key"):
|
299
|
+
for d, k in zip(htmap.kdims, htmap.current_key):
|
300
|
+
kdims[d.name] = k
|
301
|
+
for rv, cont in zip(result_var_plots, cont_instances):
|
302
|
+
ds = dataset[rv.name]
|
303
|
+
val = ds.sel(**kdims)
|
304
|
+
item = self.zero_dim_da_to_val(val)
|
305
|
+
title.object = "Selected: " + ", ".join([f"{k}:{v}" for k, v in kdims.items()])
|
306
|
+
cont.object = item
|
307
|
+
if hasattr(cont, "autoplay"): # container is a video, set to autoplay
|
308
|
+
cont.paused = False
|
309
|
+
cont.time = 0
|
310
|
+
cont.loop = True
|
311
|
+
cont.autoplay = True
|
312
|
+
state["update"] = False
|
313
|
+
|
314
|
+
def on_exit(x, y): # pragma: no cover # pylint: disable=unused-argument
|
315
|
+
state["update"] = True
|
316
|
+
|
317
|
+
htmap_posxy = hv.streams.PointerXY(source=htmap)
|
318
|
+
htmap_posxy.add_subscriber(tap_plot_heatmap)
|
319
|
+
ls = hv.streams.MouseLeave(source=htmap)
|
320
|
+
ls.add_subscriber(on_exit)
|
321
|
+
|
322
|
+
bound_plot = pn.Column(title, *cont_instances)
|
323
|
+
return pn.Row(htmap, bound_plot)
|
324
|
+
|
325
|
+
def to_line_tap_ds(
|
326
|
+
self,
|
327
|
+
dataset: xr.Dataset,
|
328
|
+
result_var: Parameter,
|
329
|
+
result_var_plots: List[Parameter] = None,
|
330
|
+
container: pn.pane.panel = pn.pane.panel,
|
331
|
+
**kwargs,
|
332
|
+
) -> pn.Row:
|
333
|
+
htmap = self.to_line_ds(dataset, result_var).opts(tools=["hover"], **kwargs)
|
334
|
+
result_var_plots, cont_instances = self.setup_results_and_containers(
|
335
|
+
result_var_plots, container
|
336
|
+
)
|
337
|
+
title = pn.pane.Markdown("Selected: None")
|
338
|
+
|
339
|
+
state = dict(x=None, y=None, update=False)
|
340
|
+
|
341
|
+
def tap_plot_line(x, y): # pragma: no cover
|
342
|
+
# print(f"{x},{y}")
|
343
|
+
# print(dataset)
|
344
|
+
|
345
|
+
# xv = self.bench_cfg.input_vars[0].name
|
346
|
+
# yv = self.bench_cfg.input_vars[1].name
|
347
|
+
|
348
|
+
# x_nearest_new = get_nearest_coords1D(
|
349
|
+
# x, dataset.coords[self.bench_cfg.input_vars[0].name].data
|
350
|
+
# )
|
351
|
+
# y_nearest_new = get_nearest_coords1D(
|
352
|
+
# y, dataset.coords[self.bench_cfg.input_vars[1].name].data
|
353
|
+
# )
|
354
|
+
|
355
|
+
# kwargs = {xv: x, yv: y}
|
356
|
+
|
357
|
+
# nearest = get_nearest_coords(dataset, **kwargs)
|
358
|
+
# print(nearest)
|
359
|
+
|
360
|
+
x_nearest_new = get_nearest_coords1D(
|
361
|
+
x, dataset.coords[self.bench_cfg.input_vars[0].name].data
|
362
|
+
)
|
363
|
+
|
364
|
+
if x_nearest_new != state["x"]:
|
365
|
+
state["x"] = x_nearest_new
|
366
|
+
state["update"] = True
|
367
|
+
|
368
|
+
if self.plt_cnt_cfg.inputs_cnt > 1:
|
369
|
+
y_nearest_new = get_nearest_coords1D(
|
370
|
+
y, dataset.coords[self.bench_cfg.input_vars[1].name].data
|
371
|
+
)
|
372
|
+
if y_nearest_new != state["y"]:
|
373
|
+
state["y"] = y_nearest_new
|
374
|
+
state["update"] = True
|
375
|
+
|
376
|
+
if state["update"]:
|
377
|
+
kdims = {}
|
378
|
+
kdims[self.bench_cfg.input_vars[0].name] = state["x"]
|
379
|
+
if self.plt_cnt_cfg.inputs_cnt > 1:
|
380
|
+
kdims[self.bench_cfg.input_vars[1].name] = state["y"]
|
381
|
+
|
382
|
+
if hasattr(htmap, "current_key"):
|
383
|
+
for d, k in zip(htmap.kdims, htmap.current_key):
|
384
|
+
kdims[d.name] = k
|
385
|
+
for rv, cont in zip(result_var_plots, cont_instances):
|
386
|
+
ds = dataset[rv.name]
|
387
|
+
val = ds.sel(**kdims)
|
388
|
+
item = self.zero_dim_da_to_val(val)
|
389
|
+
title.object = "Selected: " + ", ".join([f"{k}:{v}" for k, v in kdims.items()])
|
390
|
+
cont.object = item
|
391
|
+
if hasattr(cont, "autoplay"): # container is a video, set to autoplay
|
392
|
+
cont.paused = False
|
393
|
+
cont.time = 0
|
394
|
+
cont.loop = True
|
395
|
+
cont.autoplay = True
|
396
|
+
state["update"] = False
|
397
|
+
|
398
|
+
def on_exit(x, y): # pragma: no cover # pylint: disable=unused-argument
|
399
|
+
state["update"] = True
|
400
|
+
|
401
|
+
htmap_posxy = hv.streams.PointerXY(source=htmap)
|
402
|
+
htmap_posxy.add_subscriber(tap_plot_line)
|
403
|
+
ls = hv.streams.MouseLeave(source=htmap)
|
404
|
+
ls.add_subscriber(on_exit)
|
405
|
+
bound_plot = pn.Column(title, *cont_instances)
|
257
406
|
return pn.Row(htmap, bound_plot)
|
258
407
|
|
259
408
|
def to_error_bar(self) -> hv.Bars:
|
bencher/utils.py
CHANGED
@@ -61,6 +61,9 @@ def get_nearest_coords(dataset: xr.Dataset, collapse_list=False, **kwargs) -> di
|
|
61
61
|
def get_nearest_coords1D(val: Any, coords) -> Any:
|
62
62
|
if isinstance(val, (int, float)):
|
63
63
|
return min(coords, key=lambda x_: abs(x_ - val))
|
64
|
+
for i in coords:
|
65
|
+
if val == i:
|
66
|
+
return i
|
64
67
|
return val
|
65
68
|
|
66
69
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: holobench
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.16.0
|
4
4
|
Summary: A package for benchmarking the performance of arbitrary functions
|
5
5
|
Author-email: Austin Gregg-Smith <blooop@gmail.com>
|
6
6
|
Description-Content-Type: text/markdown
|
@@ -25,9 +25,9 @@ Requires-Dist: black>=23,<=24.4.2 ; extra == "test"
|
|
25
25
|
Requires-Dist: pylint>=2.16,<=3.1.0 ; extra == "test"
|
26
26
|
Requires-Dist: pytest-cov>=4.1,<=5.0.0 ; extra == "test"
|
27
27
|
Requires-Dist: pytest>=7.4,<=8.2.0 ; extra == "test"
|
28
|
-
Requires-Dist: hypothesis>=6.82,<=6.
|
29
|
-
Requires-Dist: ruff>=0.0.280,<=0.4.
|
30
|
-
Requires-Dist: coverage>=7.2.7,<=7.5.
|
28
|
+
Requires-Dist: hypothesis>=6.82,<=6.101.0 ; extra == "test"
|
29
|
+
Requires-Dist: ruff>=0.0.280,<=0.4.4 ; extra == "test"
|
30
|
+
Requires-Dist: coverage>=7.2.7,<=7.5.1 ; extra == "test"
|
31
31
|
Project-URL: Documentation, https://bencher.readthedocs.io/en/latest/
|
32
32
|
Project-URL: Home, https://github.com/dyson-ai/bencher
|
33
33
|
Project-URL: Repository, https://github.com/dyson-ai/bencher
|
@@ -1,5 +1,5 @@
|
|
1
1
|
bencher/__init__.py,sha256=tScVYfGMeh2G84wMdglc16lZy5MNtRS13Qqv-7Cf1O4,1283
|
2
|
-
bencher/bench_cfg.py,sha256=
|
2
|
+
bencher/bench_cfg.py,sha256=xbgycmg8v0vbt4AjGXBivs-7EcQuopLtm0R-DLiI-l8,18720
|
3
3
|
bencher/bench_plot_server.py,sha256=ZePbN9lKMQggONYMBW0CJm9saLjmxtdeAEs6eiei_8g,4088
|
4
4
|
bencher/bench_report.py,sha256=jh3T_q9KByZDeMPMf0KNJojZukxRzkfaYGeuWQU8MKM,10528
|
5
5
|
bencher/bench_runner.py,sha256=F4DN1YSFXnUAGO17tJ6DZDyEu7QBgvTyqn8G_iCd36c,6165
|
@@ -8,7 +8,7 @@ bencher/caching.py,sha256=AusaNrzGGlj5m6zcwcqnTn55Mam2mQdF--oqelO806M,1627
|
|
8
8
|
bencher/class_enum.py,sha256=kYHW9qKkKcNdwaXizZL-fTptS_DUEGv4c88yCehk3gc,1492
|
9
9
|
bencher/job.py,sha256=swa0VwrZf41v7qNjreVDIYUU6r_dfuLipPZbg_w5x7c,6089
|
10
10
|
bencher/optuna_conversions.py,sha256=DAa1DBXJ5EvTGiPyzuDTovQSjKVpMZ2sdwEXThlXJVU,5288
|
11
|
-
bencher/utils.py,sha256=
|
11
|
+
bencher/utils.py,sha256=sF7m8qLC-5gP8VdTa0yG8NVnpzkMVFOfKszV5IqQI2o,5658
|
12
12
|
bencher/video_writer.py,sha256=v0yXr7PV0rYWTWqVWBZkXFD3N_ExrZHHHkbEXcXK5bc,4512
|
13
13
|
bencher/worker_job.py,sha256=FREi0yWQACFmH86R1j-LH72tALEFkKhLDmmoGQY9Jh4,1571
|
14
14
|
bencher/example/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -24,7 +24,7 @@ bencher/example/example_floats2D.py,sha256=D0kljoUCinMKCEW-Zg-cQ8sYu_yPCZqzKJ9tR
|
|
24
24
|
bencher/example/example_holosweep.py,sha256=lxH0Z_waInGIH5AtGQi4zwPAZRI_uN0DbsJhI9iSF7Q,3017
|
25
25
|
bencher/example/example_holosweep_objects.py,sha256=vHuAtkM1VrJelHOazn_SJfzxNywKyaMzN-DE8W7Ricc,3228
|
26
26
|
bencher/example/example_holosweep_tap.py,sha256=NYXofWGV9GaBN72Q3kKPT5lKJ-slYZH5VzTAavUu23w,4527
|
27
|
-
bencher/example/example_image.py,sha256=
|
27
|
+
bencher/example/example_image.py,sha256=5Tb6iu_AhkqzF4j96KgjNvnznu_zgF3vORSu3sYUCUo,4669
|
28
28
|
bencher/example/example_levels.py,sha256=s-UfXXp8qj5U0Gx5KyMqj--nn1Ke0NtHVLSSJYIPaYY,6891
|
29
29
|
bencher/example/example_pareto.py,sha256=yyAg8Vb-5sgsS6LkYKT7T5Evcfg69FlCqCakUippSmU,2687
|
30
30
|
bencher/example/example_sample_cache.py,sha256=7gf1BJ63VAgdqNuNXkbL9-jeTeC3kXA_PY9yG3ulTz0,4200
|
@@ -35,7 +35,7 @@ bencher/example/example_simple_cat.py,sha256=XsV_75Jk3phVPI4om3q0vn1POfREb3CGRm9
|
|
35
35
|
bencher/example/example_simple_float.py,sha256=X4vsH0F4fZAoO0EKB1xIzFMY0f0Wyk8LV2plPlSEsbI,1323
|
36
36
|
bencher/example/example_strings.py,sha256=BdsEZgLT9mOxLkBKNHz2XpPwwe4SzNTdjnY1WVlOmNM,1570
|
37
37
|
bencher/example/example_time_event.py,sha256=e6R-a6ZPe-ePiWoNvN3YuSQK-Y2HOGntsjCm_SPon28,2159
|
38
|
-
bencher/example/example_video.py,sha256=
|
38
|
+
bencher/example/example_video.py,sha256=2d7GPjBXxGmNpHTMHVGqV4j8EVk7Yz---GM6WVxJpfo,4156
|
39
39
|
bencher/example/example_workflow.py,sha256=00QnUuViMfX_PqzqkXmg1wPX6yAq7IS7mCL_RFKwrMM,6806
|
40
40
|
bencher/example/experimental/example_bokeh_plotly.py,sha256=3jUKh8eKIAlpklKnp8UopIHhUDw1A0_5CwjeyTzbi7o,846
|
41
41
|
bencher/example/experimental/example_hover_ex.py,sha256=qszw4FkIfqQkVviPSpmUoFOoi6PGotGbsc7Ojyx8EtU,1052
|
@@ -58,10 +58,10 @@ bencher/plotting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
58
58
|
bencher/plotting/plot_filter.py,sha256=Zff02hEcRffiqDEoXUHVZQJK5kW4HbMxe2GYCrxI8jg,4688
|
59
59
|
bencher/plotting/plt_cnt_cfg.py,sha256=BkiAsgHm35Mqb5OsjULGVK0Q6pGZ0WSsJxxwSOrbaQs,3124
|
60
60
|
bencher/results/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
61
|
-
bencher/results/bench_result.py,sha256=
|
62
|
-
bencher/results/bench_result_base.py,sha256=
|
61
|
+
bencher/results/bench_result.py,sha256=JoXfAQ2dkoVt2mBM0Hp5V0843CWcSCuBfR817VhLVx0,3491
|
62
|
+
bencher/results/bench_result_base.py,sha256=qkH2hLgr6QAlCuQ3_FpqGXqBrurNwJocvoRwdQiI9Gs,18720
|
63
63
|
bencher/results/float_formatter.py,sha256=sX6HNCyaXdHDxC8ybVUHwCJ3qOKbPUkBOplVIHtKWjM,1746
|
64
|
-
bencher/results/holoview_result.py,sha256=
|
64
|
+
bencher/results/holoview_result.py,sha256=X-eSz2XzYGfr_vfX0ZgM7LCxszlyETC5TorHlRyQdHY,27993
|
65
65
|
bencher/results/optuna_result.py,sha256=jtsWJGdCS0L98EzxTxXU_AyarCL5CkXRLOVuSvs048M,13437
|
66
66
|
bencher/results/panel_result.py,sha256=vzZaXhGurbKex50hrSksdTh7tBIAGvcDN9l1OBulWDQ,1403
|
67
67
|
bencher/results/plotly_result.py,sha256=wkgfL38qJp6RviekXBYpNPeU4HCf0nbtKDAhu5QZhUg,2132
|
@@ -76,6 +76,6 @@ bencher/variables/parametrised_sweep.py,sha256=OSEVTYzsN2ayc0BQAN0lC441z5UDUy2kc
|
|
76
76
|
bencher/variables/results.py,sha256=8i5qYWZ4KILWL1qT07mLIssUQXDKEx6CnXPgFZJB8jw,6121
|
77
77
|
bencher/variables/sweep_base.py,sha256=cOybffErb3_QUsCfiZa0mlVy9tGDueqiElZmc363apE,6258
|
78
78
|
bencher/variables/time.py,sha256=Up1VOTwoOi-HchRlCh-K1PRR8FvhZyNqLDUODa0erHA,2659
|
79
|
-
holobench-1.
|
80
|
-
holobench-1.
|
81
|
-
holobench-1.
|
79
|
+
holobench-1.16.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
80
|
+
holobench-1.16.0.dist-info/METADATA,sha256=CPVcm2N_YjGRZ0FyYelMLWe28GQ9RhzqS7GaatvSo_w,5112
|
81
|
+
holobench-1.16.0.dist-info/RECORD,,
|
File without changes
|