From 4d0b1991b2d08ea651f490d4e4c489dec864956c Mon Sep 17 00:00:00 2001 From: franchioping Date: Wed, 4 Feb 2026 18:39:23 +0000 Subject: [PATCH] quick mv fix --- gen.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 gen.py diff --git a/gen.py b/gen.py new file mode 100644 index 0000000..cc92430 --- /dev/null +++ b/gen.py @@ -0,0 +1,36 @@ +import os +import subprocess + +subprocess.run("rm configurations/*.toml", shell=True) + +MOT_FOLDER = "configurations/mot/" +SIM_FOLDER = "configurations/sim/" +PID_FOLDER = "configurations/pid_cont/" + +mot_files = os.listdir(MOT_FOLDER) +sim_files = os.listdir(SIM_FOLDER) +pid_files = os.listdir(PID_FOLDER) + +prod: list[tuple[str, str, str]] = [ + (y, x, z) for x in mot_files for y in sim_files for z in pid_files +] + +for case in prod: + settings = "" + with open(SIM_FOLDER + case[0], "r") as f1: + with open(MOT_FOLDER + case[1], "r") as f2: + with open(PID_FOLDER + case[2], "r") as f3: + settings = f1.read() + "\n" + f2.read() + "\n" + f3.read() + with open( + "configurations/" + + "".join(case).replace(".toml", "_").removesuffix("_") + + ".toml", + "w", + ) as f: + f.write(settings) + +# cont = open(PID_FOLDER + "low_1.toml").read() +# for i in range(1, 11): +# num = 0.005 * i +# with open(PID_FOLDER + f"low_{i:02d}.toml", "w") as f: +# f.write(cont.replace("0.005", str(num)))