def main()

in compile_table.py [0:0]


def main():
    parser = argparse.ArgumentParser(description="Compiles results into a table.")
    parser.add_argument("--input", "-i", default="-", help="Input logs")
    parser.add_argument("--latex", action="store_true", help="Output latex")
    parser.add_argument("--html", action="store_true", help="Output html")
    parser.add_argument("--test", action="store_true", help="Display test results")
    args = parser.parse_args()

    # Rad in the log format
    results = read_json_log(args.input)
    # For output, we want to limit the number of decimal points and auto round
    pd.set_option("precision", 2)
    # And for the purpose of output, don't allow wrapping
    pd.set_option("display.width", 100000)

    # baselines replace "distfn" with the baseline name for simplicitly of grouping
    df = gather_metrics(results)
    for tablename, subset in df.groupby("tablename"):
        subset = subset.copy().reset_index(drop=False)
        nice_val = nice_grouping(subset[subset.fold == "val"])
        nice_test = nice_grouping(subset[subset.fold == "test"])
        if args.test:
            nice_subset = nice_test
        else:
            nice_subset = nice_val

        if args.latex:
            output_latex(nice_subset)
        elif args.html:
            sys.stdout.write(
                "<style type='text/css'>"
                "td { padding: 0.1em; text-align: right; }"
                "</style>\n"
            )
            output_html(nice_subset)
        else:
            print(tablename)
            output_console(nice_subset)
            print()
        print()