From 4f763f85e9f572b56e3465ccd47641c71cdb8bbf Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 8 Mar 2021 14:20:42 +0100 Subject: add dataref export --- bin/analyze-archive.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bin') diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py index a9ee5cf..e7027ed 100755 --- a/bin/analyze-archive.py +++ b/bin/analyze-archive.py @@ -499,6 +499,12 @@ if __name__ == "__main__": help="Export power traces of all states and transitions to DIRECTORY. " "Creates a JSON file for each state and transition.", ) + parser.add_argument( + "--export-dref", + metavar="FILE", + type=str, + help="Export model and model quality to LaTeX dataref file", + ) parser.add_argument( "--filter-param", metavar="=[,=...]", @@ -1078,6 +1084,19 @@ if __name__ == "__main__": extra_function=function, ) + if args.export_dref: + dref = raw_data.to_dref() + dref.update(model.to_dref(static_quality, lut_quality, analytic_quality)) + with open(args.export_dref, "w") as f: + for k, v in dref.items(): + if type(v) is not tuple: + v = (v, None) + if v[1] is None: + prefix = r"\drefset{" + else: + prefix = r"\drefset" + f"[unit={v[1]}]" + "{" + print(f"{prefix}{k}" + "}{" + str(v[0]) + "}", file=f) + if args.export_energymodel: if not pta: print( -- cgit v1.2.3