def convert_lowercase(cfg): keys = cfg.keys() lowercase_keys = [key.lower() for key in keys] values = [cfg.get(key) for key in keys] for lowercase_key, value in zip(lowercase_keys, values): cfg.setdefault(lowercase_key, value) return cfg
import numpy as np import os from lib.config import cfg ratios = np.linspace(0, 1, 20, endpoint=True) n_sims = 100 python = cfg.get("python") total_weight = 0.14 + 0.28 # ( # simulation.pars.alignment_weight + simulation.pars.cohesion_weight # ) if __name__ == "__main__": if not os.path.isdir("./logs/"): os.mkdir("./logs") for ratio in ratios: alignment_weight = (1 - ratio) * total_weight cohesion_weight = (ratio) * total_weight # Pass on the parameters as command-line arguments that will overwrite the default parameters. command = f"{python} run.py logs/coh{ratio} {n_sims} --cohesion_weight {cohesion_weight} --alignment_weight {alignment_weight}" print(command) os.system(command)