summaryrefslogtreecommitdiff
path: root/lib/cli.py
diff options
context:
space:
mode:
authorBirte Friesel <daniel.friesel@uos.de>2023-07-11 14:22:26 +0200
committerBirte Friesel <daniel.friesel@uos.de>2023-07-11 14:22:26 +0200
commit4da81fa674866550ea1b686911efbbeaabfecad0 (patch)
tree2f0100b06f003407dbb850f6879d0c9c64c9c550 /lib/cli.py
parent99b168d637cf0c4e23f4eca6448f2cae05921fd2 (diff)
analyze-log: add --export-json-unparam
Diffstat (limited to 'lib/cli.py')
-rw-r--r--lib/cli.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/cli.py b/lib/cli.py
index 4b2d1ca..17e7b29 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -199,6 +199,22 @@ def export_pgf_unparam(model, pgf_prefix):
print(f"{i} {value} {parameters}", file=f)
+def export_json_unparam(model, filename):
+ import json
+ from dfatool.utils import NpEncoder
+
+ ret = {"paramNames": model.parameters, "byName": dict()}
+ for name in model.names:
+ ret["byName"][name] = dict()
+ for attribute in model.attributes(name):
+ ret["byName"][name][attribute] = {
+ "paramValues": model.attr_by_name[name][attribute].param_values,
+ "data": model.attr_by_name[name][attribute].data,
+ }
+ with open(filename, "w") as f:
+ json.dump(ret, f, cls=NpEncoder)
+
+
def add_standard_arguments(parser):
parser.add_argument(
"--export-dot",
@@ -219,6 +235,12 @@ def add_standard_arguments(parser):
help="Export raw (parameter-independent) observations in tikz-pgf-compatible format to {PREFIX}{name}-{attribute}.txt",
)
parser.add_argument(
+ "--export-json-unparam",
+ metavar="FILENAME",
+ type=str,
+ help="Export raw (parameter-independent) observations in JSON format to FILENAME",
+ )
+ parser.add_argument(
"--dref-precision",
metavar="NDIG",
type=int,