Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions choose_best_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ def parse_args() -> argparse.Namespace:
required=True,
help="Commitment style to use.",
)
p.add_argument(
"--json-summary",
action="store_true",
help="Print JSON summary of all layouts and best choice.",
)

p.add_argument(
"--fanouts",
nargs="+",
Expand Down Expand Up @@ -132,6 +138,23 @@ def main() -> None:
layouts,
key=lambda lr: metric_value(lr.data, args.metric),
)
if args.json_summary:
summary = {
"leaves": args.leaves,
"style": args.style,
"metric": args.metric,
"layouts": [
{
"fanout": lr.fanout,
"metricValue": metric_value(lr.data, args.metric),
"data": lr.data,
}
for lr in layouts
],
"bestFanout": best.fanout,
}
print(json.dumps(summary, indent=2, sort_keys=True))
return

# Print table
header = (
Expand Down