def parse_json_to_df()

in parse.py [0:0]


def parse_json_to_df(dirs):
    records = []
    groups = {
        "erm": "No",
        "jtt": "No",
        "suby": "No",
        "rwy": "No",
        "dro": "Yes",
        "rwg": "Yes",
        "subg": "Yes",
    }
    nb_hps = {"erm": 4, "jtt": 6, "suby": 4, "rwy": 4, "dro": 5, "rwg": 4, "subg": 4}

    for dname in dirs:
        for fname in glob.glob(os.path.join(dname, "*.out")):
            with open(fname, "r") as f:
                lines = f.readlines()

            for line in lines:
                if not line.startswith("{"):
                    continue

                record = json.loads(line)
                this_row = dict(record["args"])
                this_row["epoch"] = record["epoch"]
                this_row["time"] = record["time"] / 3600
                this_row["min_acc_va"] = min(record["acc_va"])
                this_row["min_acc_tr"] = min(record["acc_tr"])
                this_row["avg_acc_va"] = record["avg_acc_va"]
                this_row["min_acc_te"] = min(record["acc_te"])
                this_row["avg_acc_te"] = record["avg_acc_te"]
                this_row["Groups"] = groups[this_row["method"]]
                this_row["#HP"] = nb_hps[this_row["method"]]
                this_row["file_path"] = os.path.splitext(fname)[0] + ".pt"
                records.append(this_row)
    if not len(records):
        quit()

    pd.set_option(
        "display.max_rows", None, "display.max_columns", None, "display.width", None
    )

    return pd.DataFrame(records)