]> code.communitydata.science - ml_measurement_error_public.git/blob - simulations/grid_sweep.py
update sbatch for new directory and default output filename.
[ml_measurement_error_public.git] / simulations / grid_sweep.py
1 #!/usr/bin/env python3
2
3 import fire
4 from itertools import product
5
6 def main(command, arg_dict, outfile):
7     keys = []
8     values = []
9         
10     for i,p in enumerate(arg_dict.items()):
11         k,v = p
12         keys.append(k)
13         values.append(v)
14         command = command + f" --{k} {{{i}}} "
15
16     args_list = product(*values)
17
18     with open(outfile,'w') as of:
19         for args in args_list:
20             of.write(command.format(*args) + '\n')
21
22 if __name__ == '__main__':
23     fire.Fire(main)

Community Data Science Collective || Want to submit a patch?