From a6b52d5005c8133bac1a292f0b804de7e7d9398d Mon Sep 17 00:00:00 2001 From: Riccardo Cappuzzo Date: Thu, 21 Sep 2023 17:35:18 +0200 Subject: [PATCH] Added function for reading logs. --- src/data_structures/loggers.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/data_structures/loggers.py b/src/data_structures/loggers.py index a01fd68..16b1f15 100755 --- a/src/data_structures/loggers.py +++ b/src/data_structures/loggers.py @@ -58,6 +58,24 @@ def get_exp_name(): return exp_name +def read_logs(run_name): + path_target_run = Path("results/logs/", run_name) + path_raw_logs = Path(path_target_run, "raw_logs") + path_agg_logs = Path(path_target_run, "run_logs") + + logs = [] + for f in path_raw_logs.glob("*.log"): + logs.append(pl.read_csv(f)) + df_raw = pl.concat(logs) + + logs = [] + for f in path_agg_logs.glob("*.log"): + logs.append(pl.read_csv(f)) + df_agg = pl.concat(logs) + + return df_raw, df_agg + + def setup_run_logging(setup_config=None): exp_name = get_exp_name() os.makedirs(f"results/logs/{exp_name}")