diff options
author | Birte Friesel <daniel.friesel@uos.de> | 2023-07-11 14:22:26 +0200 |
---|---|---|
committer | Birte Friesel <daniel.friesel@uos.de> | 2023-07-11 14:22:26 +0200 |
commit | 4da81fa674866550ea1b686911efbbeaabfecad0 (patch) | |
tree | 2f0100b06f003407dbb850f6879d0c9c64c9c550 /lib/cli.py | |
parent | 99b168d637cf0c4e23f4eca6448f2cae05921fd2 (diff) |
analyze-log: add --export-json-unparam
Diffstat (limited to 'lib/cli.py')
-rw-r--r-- | lib/cli.py | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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, |