Skip to content

Commit

Permalink
small improvment to dat file saving
Browse files Browse the repository at this point in the history
  • Loading branch information
FilippoAiraldi committed Nov 26, 2024
1 parent be251d6 commit 253f5ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions benchmarking/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""

import argparse
import os
import re
from functools import partial
from math import ceil
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions mpc-tuning/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 253f5ca

Please sign in to comment.