diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2022-02-21 12:26:29 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2022-02-21 12:26:29 +0100 |
commit | 37c3c6ec5382052743a99d881298255b7b7ccc50 (patch) | |
tree | a0394d9e84f993ef625cd1fb2431a2a33103e8f7 /lib/cli.py | |
parent | 32213cdb49a08bd0f2012baaefb031d0726dc4bf (diff) |
add dtree graphviz/dot export via --export-dot / to_dot()
Diffstat (limited to 'lib/cli.py')
-rw-r--r-- | lib/cli.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -155,8 +155,23 @@ def export_dataref(dref_file, dref): print(f"{prefix}/{k}" + "}{" + str(v[0]) + "}", file=f) +def export_dot(model, dot_prefix): + for name in model.names: + for attribute in model.attributes(name): + dot_model = model.attr_by_name[name][attribute].to_dot() + if not dot_model is None: + with open(f"{dot_prefix}{name}-{attribute}.dot", "w") as f: + print(dot_model, file=f) + + def add_standard_arguments(parser): parser.add_argument( + "--export-dot", + metavar="PREFIX", + type=str, + help="Export model and model quality to LaTeX {PREFIX}{name}-{attribute}.dot", + ) + parser.add_argument( "--export-dref", metavar="FILE", type=str, |