]> code.communitydata.science - ml_measurement_error_public.git/blobdiff - simulations/grid_sweep.py
update sbatch for new directory and default output filename.
[ml_measurement_error_public.git] / simulations / grid_sweep.py
diff --git a/simulations/grid_sweep.py b/simulations/grid_sweep.py
new file mode 100755 (executable)
index 0000000..86312ea
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import fire
+from itertools import product
+
+def main(command, arg_dict, outfile):
+    keys = []
+    values = []
+        
+    for i,p in enumerate(arg_dict.items()):
+        k,v = p
+        keys.append(k)
+        values.append(v)
+        command = command + f" --{k} {{{i}}} "
+
+    args_list = product(*values)
+
+    with open(outfile,'w') as of:
+        for args in args_list:
+            of.write(command.format(*args) + '\n')
+
+if __name__ == '__main__':
+    fire.Fire(main)

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