craceplot 0.1.0__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.
- craceplot/__init__.py +60 -0
- craceplot/_containers/__init__.py +0 -0
- craceplot/_containers/_core.py +1602 -0
- craceplot/_containers/_draw.py +104 -0
- craceplot/_inst/examples/acotsp/crace-3240078.stdout +838 -0
- craceplot/_inst/examples/acotsp/crace.stderr +8 -0
- craceplot/_inst/examples/acotsp/crace.test +216 -0
- craceplot/_inst/examples/acotsp/crace.train +622 -0
- craceplot/_inst/examples/cats200/crace-2814581.stdout +1665 -0
- craceplot/_inst/examples/cats200/crace.stderr +10 -0
- craceplot/_inst/examples/cats200/crace.test +1010 -0
- craceplot/_inst/examples/cats200/crace.train +655 -0
- craceplot/_plots/__init__.py +8 -0
- craceplot/_plots/_core.py +80 -0
- craceplot/_plots/parameters.py +1805 -0
- craceplot/_plots/quality.py +1406 -0
- craceplot/_scripts/__init__.py +4 -0
- craceplot/_scripts/_main.py +132 -0
- craceplot/_scripts/_utils.py +66 -0
- craceplot/_scripts/main +3 -0
- craceplot/_scripts/open_guide +12 -0
- craceplot/_settings/_description.py +168 -0
- craceplot/_settings/_options.json +299 -0
- craceplot/_utils/__init__.py +0 -0
- craceplot/_utils/_base.py +196 -0
- craceplot/_utils/_const.py +8 -0
- craceplot/_utils/_crace.py +42 -0
- craceplot/_utils/_format.py +191 -0
- craceplot/_vergit.py +2 -0
- craceplot/_version.py +24 -0
- craceplot/_vignettes/guide.ipynb +18943 -0
- craceplot-0.1.0.dist-info/METADATA +369 -0
- craceplot-0.1.0.dist-info/RECORD +61 -0
- craceplot-0.1.0.dist-info/WHEEL +5 -0
- craceplot-0.1.0.dist-info/entry_points.txt +2 -0
- craceplot-0.1.0.dist-info/licenses/LICENSE.md +21 -0
- craceplot-0.1.0.dist-info/top_level.txt +2 -0
- docs/_config.yml +51 -0
- docs/_static/css/custom.css +168 -0
- docs/_static/js/navbar.js +40 -0
- docs/_toc.yml +5 -0
- docs/index.md +4 -0
- docs/references/404.md +14 -0
- docs/references/authors.md +46 -0
- docs/references/citiation.bib +17 -0
- docs/references/functions/index.md +5 -0
- docs/references/functions/param_boxplot.ipynb +19 -0
- docs/references/index.md +44 -0
- docs/references/license.md +21 -0
- docs/references/others/favicon.ico +0 -0
- docs/references/others/favicon_io/about.txt +6 -0
- docs/references/others/favicon_io/android-chrome-192x192.png +0 -0
- docs/references/others/favicon_io/android-chrome-512x512.png +0 -0
- docs/references/others/favicon_io/apple-touch-icon.png +0 -0
- docs/references/others/favicon_io/favicon-16x16.png +0 -0
- docs/references/others/favicon_io/favicon-32x32.png +0 -0
- docs/references/others/favicon_io/site.webmanifest +1 -0
- docs/references/others/logo.png +0 -0
- docs/references/others/logo1.png +0 -0
- docs/references/plots/acotsp-parallelcoord-all.png +0 -0
- docs/requirements.txt +5 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import sys
|
|
5
|
+
import inspect
|
|
6
|
+
import traceback
|
|
7
|
+
|
|
8
|
+
from craceplot._containers._core import CplotOptions, ParseOptions, Errors as CE
|
|
9
|
+
from craceplot._plots.parameters import plot_parameters
|
|
10
|
+
from craceplot._plots.quality import plot_experiments
|
|
11
|
+
|
|
12
|
+
from typing import TYPE_CHECKING
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from crace.containers.crace_results import CraceResults
|
|
16
|
+
|
|
17
|
+
def load_options(*kargs, arguments: list=None, _console: bool=True, _add: bool=True):
|
|
18
|
+
"""
|
|
19
|
+
Load options for craceplot: directly called by users
|
|
20
|
+
"""
|
|
21
|
+
if arguments is not None and kargs:
|
|
22
|
+
raise TypeError(
|
|
23
|
+
"load_options() accepts either positional arguments "
|
|
24
|
+
"or 'arguments=', not both")
|
|
25
|
+
if arguments is not None:
|
|
26
|
+
if not isinstance(arguments, list):
|
|
27
|
+
if isinstance(arguments, str):
|
|
28
|
+
arguments = re.split(r"[ ,]+", arguments)
|
|
29
|
+
elif len(kargs) > 0:
|
|
30
|
+
arguments = list(kargs)
|
|
31
|
+
elif _console:
|
|
32
|
+
arguments = []
|
|
33
|
+
else:
|
|
34
|
+
# arguments may be [] (not None)
|
|
35
|
+
arguments = sys.argv[1:]
|
|
36
|
+
|
|
37
|
+
scenario = None
|
|
38
|
+
try:
|
|
39
|
+
scenario = ParseOptions.from_input(arguments=arguments, console=_console, add=_add)
|
|
40
|
+
except Exception as e:
|
|
41
|
+
print("\nERROR: There was an error while loading crace results:")
|
|
42
|
+
sys.tracebacklimit = 3
|
|
43
|
+
traceback.print_exc()
|
|
44
|
+
print(e)
|
|
45
|
+
finally:
|
|
46
|
+
if not _console: sys.exit(1)
|
|
47
|
+
else: return scenario
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def load_results(options: CplotOptions, data_home=None):
|
|
51
|
+
"""
|
|
52
|
+
load crace results from data_home
|
|
53
|
+
|
|
54
|
+
"""
|
|
55
|
+
results = None
|
|
56
|
+
log_path = None
|
|
57
|
+
|
|
58
|
+
if data_home:
|
|
59
|
+
log_path = data_home
|
|
60
|
+
elif options.logDir.value:
|
|
61
|
+
log_path = options.logDir.value
|
|
62
|
+
|
|
63
|
+
from craceplot._utils._crace import get_crace
|
|
64
|
+
crace = get_crace()
|
|
65
|
+
results = crace.run(f'--read, {log_path}, --readlogs-in-cplot, 2')
|
|
66
|
+
|
|
67
|
+
return results
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class DrawPlot:
|
|
71
|
+
"""
|
|
72
|
+
Class defines the procedure to select one drawMethod for drawing plot
|
|
73
|
+
:ivar drawMethod: the method used to draw plot for provided Crace results
|
|
74
|
+
"""
|
|
75
|
+
def __init__(self, reader: CplotOptions, src_data: CraceResults) -> None:
|
|
76
|
+
"""
|
|
77
|
+
initialize for drawing plot
|
|
78
|
+
|
|
79
|
+
src_data: class CraceResults
|
|
80
|
+
scr_vars: list of parameters from the provided crace results
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
src_data = src_data
|
|
84
|
+
options = reader
|
|
85
|
+
|
|
86
|
+
draw_method = reader.drawMethod.value
|
|
87
|
+
data_type = 'exps' if reader.dataType.value in ['experiments', 'quality', 'time'] else 'param'
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
if data_type == 'param':
|
|
91
|
+
plot_parameters(method=draw_method, data=src_data, options=options, _console=False)
|
|
92
|
+
elif data_type == 'exps':
|
|
93
|
+
plot_experiments(method=draw_method, data=src_data, options=options, _console=False)
|
|
94
|
+
|
|
95
|
+
print('#\n# Succeeded! ')
|
|
96
|
+
|
|
97
|
+
except Exception as e:
|
|
98
|
+
if any(isinstance(e, cls) for cls in [x[1] for x in inspect.getmembers(CE, inspect.isclass)]):
|
|
99
|
+
print("#\n! There was an error while plotting:")
|
|
100
|
+
print(f"! {e}")
|
|
101
|
+
else:
|
|
102
|
+
err = traceback.format_exc()
|
|
103
|
+
print(err)
|
|
104
|
+
sys.exit()
|