From 253f5cac8e2fd2d3ca849b4e72d3d15c4740ef4f Mon Sep 17 00:00:00 2001 From: Filippo Airaldi Date: Tue, 26 Nov 2024 11:19:24 +0100 Subject: [PATCH] small improvment to dat file saving --- benchmarking/analyze.py | 4 ++++ mpc-tuning/analyze.py | 1 + 2 files changed, 5 insertions(+) diff --git a/benchmarking/analyze.py b/benchmarking/analyze.py index 98b25f6..b95c67c 100644 --- a/benchmarking/analyze.py +++ b/benchmarking/analyze.py @@ -4,6 +4,7 @@ """ import argparse +import os import re from functools import partial from math import ceil @@ -219,6 +220,7 @@ def optimiser_convergences( fig.suptitle(title, fontsize=12) if pgfplotstables: + os.makedirs("pgfplotstables", exist_ok=True) tables_already_written = set() column = column.replace("-", "") for problem in problem_names: @@ -313,6 +315,7 @@ def itertime_vs_gap( fig.suptitle(title, fontsize=12) if pgfplotstables: + os.makedirs("pgfplotstables", exist_ok=True) fn = "pgfplotstables/itertime-vs-gap" fn += f"_{title}.dat" if title is not None else ".dat" df_.reset_index().apply(_compute_official_name_and_type, axis=1).to_string( @@ -443,6 +446,7 @@ def summary_tables( latex = latex.replace("|", "&") latex = "\n".join(line[:-1] + r"\\" for line in latex.split("\n")) + os.makedirs("pgfplotstables", exist_ok=True) fn = "pgfplotstables/summary" fn += f"_{title}.tex" if title is not None else ".tex" with open(fn, "w", encoding="utf-8") as f: diff --git a/mpc-tuning/analyze.py b/mpc-tuning/analyze.py index e5979aa..f18f61b 100644 --- a/mpc-tuning/analyze.py +++ b/mpc-tuning/analyze.py @@ -67,6 +67,7 @@ def plot_reactor_temp( fig.suptitle(title, fontsize=12) if pgfplotstables: + os.makedirs("pgfplotstables", exist_ok=True) for method, row_data in df_.iterrows(): method = official_method_name_and_type(method, for_filename=True)[0].lower() Tr = row_data["Tr"]