summaryrefslogtreecommitdiff
path: root/lib/cli.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-02-21 12:26:29 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2022-02-21 12:26:29 +0100
commit37c3c6ec5382052743a99d881298255b7b7ccc50 (patch)
treea0394d9e84f993ef625cd1fb2431a2a33103e8f7 /lib/cli.py
parent32213cdb49a08bd0f2012baaefb031d0726dc4bf (diff)
add dtree graphviz/dot export via --export-dot / to_dot()
Diffstat (limited to 'lib/cli.py')
-rw-r--r--lib/cli.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/cli.py b/lib/cli.py
index 3e7865b..0de5505 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -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,