RustPhysicsMQ/configurations/gen.py

29 lines
788 B
Python

import os
import subprocess
subprocess.run("rm -rf final && mkdir final", shell=True)
MOT_FOLDER = "mot/"
SIM_FOLDER = "sim/"
PID_FOLDER = "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(
"final/" + "".join(case).replace(".toml", "_").removesuffix("_") + ".toml",
"w",
) as f:
f.write(settings)