holobench 1.18.0__tar.gz → 1.19.0__tar.gz
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.
- {holobench-1.18.0 → holobench-1.19.0}/PKG-INFO +1 -1
- {holobench-1.18.0 → holobench-1.19.0}/bencher/__init__.py +1 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/bench_cfg.py +1 -1
- {holobench-1.18.0 → holobench-1.19.0}/bencher/bencher.py +14 -5
- holobench-1.19.0/bencher/example/example_filepath.py +27 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_image.py +1 -1
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/bench_result_base.py +7 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/panel_result.py +0 -2
- {holobench-1.18.0 → holobench-1.19.0}/bencher/utils.py +1 -1
- {holobench-1.18.0 → holobench-1.19.0}/bencher/variables/parametrised_sweep.py +2 -20
- {holobench-1.18.0 → holobench-1.19.0}/bencher/variables/results.py +39 -9
- {holobench-1.18.0 → holobench-1.19.0}/pyproject.toml +1 -1
- {holobench-1.18.0 → holobench-1.19.0}/README.md +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/bench_plot_server.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/bench_report.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/bench_runner.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/caching.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/class_enum.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/__init__.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/benchmark_data.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_all.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_categorical.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_custom_sweep.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_docs.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_float3D.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_float_cat.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_floats.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_floats2D.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_holosweep.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_holosweep_objects.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_holosweep_tap.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_levels.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_pareto.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_sample_cache.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_sample_cache_context.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_simple.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_simple_bool.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_simple_cat.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_simple_float.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_strings.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_time_event.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_video.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/example_workflow.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_bokeh_plotly.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_hover_ex.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_hvplot_explorer.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_interactive.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_streamnd.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_streams.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_template.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_updates.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_vector.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/meta/example_meta.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/meta/example_meta_cat.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/meta/example_meta_float.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/meta/example_meta_levels.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/optuna/example_optuna.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/shelved/example_float2D_scatter.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/shelved/example_float3D_cone.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/example/shelved/example_kwargs.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/job.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/optuna_conversions.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/plotting/__init__.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/plotting/plot_filter.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/plotting/plt_cnt_cfg.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/__init__.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/bench_result.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/composable_container/__init__.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/composable_container/composable_container_base.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/composable_container/composable_container_panel.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/composable_container/composable_container_video.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/float_formatter.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/holoview_result.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/optuna_result.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/plotly_result.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/video_result.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/results/video_summary.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/variables/inputs.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/variables/sweep_base.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/variables/time.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/video_writer.py +0 -0
- {holobench-1.18.0 → holobench-1.19.0}/bencher/worker_job.py +0 -0
@@ -383,7 +383,7 @@ class BenchCfg(BenchRunCfg):
|
|
383
383
|
benchmark_sampling_str.append(f" use_cache: {self.use_cache}")
|
384
384
|
benchmark_sampling_str.append(f" use_sample_cache: {self.use_sample_cache}")
|
385
385
|
benchmark_sampling_str.append(f" only_hash_tag: {self.only_hash_tag}")
|
386
|
-
benchmark_sampling_str.append(f"
|
386
|
+
benchmark_sampling_str.append(f" executor: {self.executor}")
|
387
387
|
|
388
388
|
for mv in self.meta_vars:
|
389
389
|
benchmark_sampling_str.extend(describe_variable(mv, True))
|
@@ -24,6 +24,7 @@ from bencher.variables.results import (
|
|
24
24
|
ResultVar,
|
25
25
|
ResultVec,
|
26
26
|
ResultHmap,
|
27
|
+
ResultPath,
|
27
28
|
ResultVideo,
|
28
29
|
ResultImage,
|
29
30
|
ResultString,
|
@@ -557,7 +558,7 @@ class Bench(BenchPlotServer):
|
|
557
558
|
time_src (datetime | str): a representation of the sample time
|
558
559
|
|
559
560
|
Returns:
|
560
|
-
|
561
|
+
tuple[BenchResult, List, List]: bench_result, function intputs, dimension names
|
561
562
|
"""
|
562
563
|
|
563
564
|
if time_src is None:
|
@@ -565,9 +566,7 @@ class Bench(BenchPlotServer):
|
|
565
566
|
bench_cfg.meta_vars = self.define_extra_vars(bench_cfg, bench_cfg.repeats, time_src)
|
566
567
|
|
567
568
|
bench_cfg.all_vars = bench_cfg.input_vars + bench_cfg.meta_vars
|
568
|
-
|
569
569
|
# bench_cfg.all_vars = bench_cfg.iv_time + bench_cfg.input_vars +[ bench_cfg.iv_repeat]
|
570
|
-
|
571
570
|
# bench_cfg.all_vars = [ bench_cfg.iv_repeat] +bench_cfg.input_vars + bench_cfg.iv_time
|
572
571
|
|
573
572
|
for i in bench_cfg.all_vars:
|
@@ -587,7 +586,9 @@ class Bench(BenchPlotServer):
|
|
587
586
|
if isinstance(rv, ResultReference):
|
588
587
|
result_data = np.full(dims_cfg.dims_size, -1, dtype=int)
|
589
588
|
data_vars[rv.name] = (dims_cfg.dims_name, result_data)
|
590
|
-
if isinstance(
|
589
|
+
if isinstance(
|
590
|
+
rv, (ResultPath, ResultVideo, ResultImage, ResultString, ResultContainer)
|
591
|
+
):
|
591
592
|
result_data = np.full(dims_cfg.dims_size, "NAN", dtype=object)
|
592
593
|
data_vars[rv.name] = (dims_cfg.dims_name, result_data)
|
593
594
|
elif type(rv) == ResultVec:
|
@@ -724,7 +725,15 @@ class Bench(BenchPlotServer):
|
|
724
725
|
logging.info(f"{rv.name}: {result_value}")
|
725
726
|
|
726
727
|
if isinstance(
|
727
|
-
rv,
|
728
|
+
rv,
|
729
|
+
(
|
730
|
+
ResultVar,
|
731
|
+
ResultVideo,
|
732
|
+
ResultImage,
|
733
|
+
ResultString,
|
734
|
+
ResultContainer,
|
735
|
+
ResultPath,
|
736
|
+
),
|
728
737
|
):
|
729
738
|
set_xarray_multidim(bench_res.ds[rv.name], worker_job.index_tuple, result_value)
|
730
739
|
elif isinstance(rv, ResultReference):
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import bencher as bch
|
2
|
+
|
3
|
+
|
4
|
+
class ExampleFile(bch.ParametrizedSweep):
|
5
|
+
content = bch.StringSweep(["entry1", "entry2", "entry3"])
|
6
|
+
|
7
|
+
file_result = bch.ResultPath()
|
8
|
+
|
9
|
+
def __call__(self, **kwargs):
|
10
|
+
self.update_params_from_kwargs(**kwargs)
|
11
|
+
|
12
|
+
# this generates a unique filename and stores it in the cache directory
|
13
|
+
filename = bch.gen_path(self.content, suffix=".txt")
|
14
|
+
with open(filename, "w", encoding="utf-8") as text_file:
|
15
|
+
text_file.write(f"content:{self.content}")
|
16
|
+
self.file_result = filename
|
17
|
+
return super().__call__()
|
18
|
+
|
19
|
+
|
20
|
+
def example_filepath(run_cfg: bch.BenchRunCfg = None, report: bch.BenchReport = None):
|
21
|
+
bench = ExampleFile().to_bench(run_cfg, report)
|
22
|
+
bench.plot_sweep()
|
23
|
+
return bench
|
24
|
+
|
25
|
+
|
26
|
+
if __name__ == "__main__":
|
27
|
+
example_filepath().report.show()
|
@@ -131,7 +131,7 @@ if __name__ == "__main__":
|
|
131
131
|
# ex_run_cfg.debug = True
|
132
132
|
# ex_run_cfg.repeats = 2
|
133
133
|
ex_run_cfg.level = 4
|
134
|
-
|
134
|
+
example_image_vid(ex_run_cfg).report.show()
|
135
135
|
simple().report.show()
|
136
136
|
|
137
137
|
# example_image_vid_sequential(ex_run_cfg).report.show()
|
@@ -416,6 +416,13 @@ class BenchResultBase(OptunaResult):
|
|
416
416
|
return ref.container(val, **kwargs)
|
417
417
|
if container is not None:
|
418
418
|
return container(val, styles={"background": "white"}, **kwargs)
|
419
|
+
try:
|
420
|
+
container = result_var.to_container()
|
421
|
+
if container is not None:
|
422
|
+
return container(val)
|
423
|
+
except AttributeError as _:
|
424
|
+
# TODO make sure all vars have to_container method
|
425
|
+
pass
|
419
426
|
return val
|
420
427
|
|
421
428
|
@staticmethod
|
@@ -27,8 +27,6 @@ class PanelResult(BenchResultBase):
|
|
27
27
|
level: int = None,
|
28
28
|
**kwargs
|
29
29
|
) -> Optional[pn.pane.panel]:
|
30
|
-
if container is None:
|
31
|
-
container = pn.pane.panel
|
32
30
|
if hv_dataset is None:
|
33
31
|
hv_dataset = self.to_hv_dataset(ReduceType.SQUEEZE, level=level)
|
34
32
|
elif not isinstance(hv_dataset, hv.Dataset):
|
@@ -129,7 +129,7 @@ def color_tuple_to_css(color: tuple[float, float, float]) -> str:
|
|
129
129
|
return f"rgb{(color[0] * 255, color[1] * 255, color[2] * 255)}"
|
130
130
|
|
131
131
|
|
132
|
-
def gen_path(filename, folder, suffix):
|
132
|
+
def gen_path(filename, folder="generic", suffix=".dat"):
|
133
133
|
path = Path(f"cachedir/{folder}/{filename}/")
|
134
134
|
path.mkdir(parents=True, exist_ok=True)
|
135
135
|
return f"{path.absolute().as_posix()}/{filename}_{uuid4()}{suffix}"
|
@@ -6,16 +6,7 @@ import panel as pn
|
|
6
6
|
|
7
7
|
|
8
8
|
from bencher.utils import make_namedtuple, hash_sha1
|
9
|
-
from bencher.variables.results import
|
10
|
-
ResultVar,
|
11
|
-
ResultVec,
|
12
|
-
ResultHmap,
|
13
|
-
ResultVideo,
|
14
|
-
ResultImage,
|
15
|
-
ResultString,
|
16
|
-
ResultContainer,
|
17
|
-
ResultReference,
|
18
|
-
)
|
9
|
+
from bencher.variables.results import ALL_RESULT_TYPES, ResultHmap
|
19
10
|
|
20
11
|
|
21
12
|
class ParametrizedSweep(Parameterized):
|
@@ -78,16 +69,7 @@ class ParametrizedSweep(Parameterized):
|
|
78
69
|
for k, v in cls.param.objects().items():
|
79
70
|
if isinstance(
|
80
71
|
v,
|
81
|
-
|
82
|
-
ResultVar,
|
83
|
-
ResultVec,
|
84
|
-
ResultHmap,
|
85
|
-
ResultVideo,
|
86
|
-
ResultImage,
|
87
|
-
ResultString,
|
88
|
-
ResultContainer,
|
89
|
-
ResultReference,
|
90
|
-
),
|
72
|
+
ALL_RESULT_TYPES,
|
91
73
|
):
|
92
74
|
results[k] = v
|
93
75
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from enum import auto
|
2
2
|
from typing import List, Callable, Any, Optional
|
3
|
-
|
3
|
+
from functools import partial
|
4
4
|
import panel as pn
|
5
5
|
import param
|
6
6
|
from param import Number
|
@@ -99,7 +99,7 @@ def curve(
|
|
99
99
|
return hv.Curve(zip(x_vals, y_vals), kdims=[x_name], vdims=[y_name], label=label, **kwargs)
|
100
100
|
|
101
101
|
|
102
|
-
class
|
102
|
+
class ResultPath(param.Filename):
|
103
103
|
__slots__ = ["units"]
|
104
104
|
|
105
105
|
def __init__(self, default=None, units="path", **params):
|
@@ -110,15 +110,33 @@ class PathResult(param.Filename):
|
|
110
110
|
"""A hash function that avoids the PYTHONHASHSEED 'feature' which returns a different hash value each time the program is run"""
|
111
111
|
return hash_sha1(self)
|
112
112
|
|
113
|
+
def to_container(self):
|
114
|
+
"""Returns a partial function for creating a FileDownload widget with embedding enabled. This function is used to create a panel container to represent the ResultPath object"""
|
115
|
+
return partial(pn.widgets.FileDownload, embed=True)
|
113
116
|
|
114
|
-
class ResultVideo(PathResult):
|
115
|
-
def __init__(self, default=None, units="video", **params):
|
116
|
-
super().__init__(default=default, units=units, **params)
|
117
117
|
|
118
|
+
class ResultVideo(param.Filename):
|
119
|
+
__slots__ = ["units"]
|
118
120
|
|
119
|
-
|
120
|
-
|
121
|
-
|
121
|
+
def __init__(self, default=None, units="path", **params):
|
122
|
+
super().__init__(default=default, check_exists=False, **params)
|
123
|
+
self.units = units
|
124
|
+
|
125
|
+
def hash_persistent(self) -> str:
|
126
|
+
"""A hash function that avoids the PYTHONHASHSEED 'feature' which returns a different hash value each time the program is run"""
|
127
|
+
return hash_sha1(self)
|
128
|
+
|
129
|
+
|
130
|
+
class ResultImage(param.Filename):
|
131
|
+
__slots__ = ["units"]
|
132
|
+
|
133
|
+
def __init__(self, default=None, units="path", **params):
|
134
|
+
super().__init__(default=default, check_exists=False, **params)
|
135
|
+
self.units = units
|
136
|
+
|
137
|
+
def hash_persistent(self) -> str:
|
138
|
+
"""A hash function that avoids the PYTHONHASHSEED 'feature' which returns a different hash value each time the program is run"""
|
139
|
+
return hash_sha1(self)
|
122
140
|
|
123
141
|
|
124
142
|
class ResultString(param.String):
|
@@ -181,4 +199,16 @@ class ResultVolume(param.Parameter):
|
|
181
199
|
return hash_sha1(self)
|
182
200
|
|
183
201
|
|
184
|
-
PANEL_TYPES = (ResultImage, ResultVideo, ResultContainer, ResultString, ResultReference)
|
202
|
+
PANEL_TYPES = (ResultPath, ResultImage, ResultVideo, ResultContainer, ResultString, ResultReference)
|
203
|
+
|
204
|
+
ALL_RESULT_TYPES = (
|
205
|
+
ResultVar,
|
206
|
+
ResultVec,
|
207
|
+
ResultHmap,
|
208
|
+
ResultPath,
|
209
|
+
ResultVideo,
|
210
|
+
ResultImage,
|
211
|
+
ResultString,
|
212
|
+
ResultContainer,
|
213
|
+
ResultReference,
|
214
|
+
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{holobench-1.18.0 → holobench-1.19.0}/bencher/example/experimental/example_hvplot_explorer.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|