diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-12-03 10:04:24 -0600 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-12-03 10:04:24 -0600 |
commit | 7e7614fbc9ad0f6cb3e65912134069082109fd6e (patch) | |
tree | 547eccbf86643b560f3dcaa627bc5806b4c6adc5 /src/run-fit | |
parent | 3c77f5827644971fb0697a23120a8d3d3ae92e1f (diff) | |
download | sddm-7e7614fbc9ad0f6cb3e65912134069082109fd6e.tar.gz sddm-7e7614fbc9ad0f6cb3e65912134069082109fd6e.tar.bz2 sddm-7e7614fbc9ad0f6cb3e65912134069082109fd6e.zip |
add script to run multiple fits
Diffstat (limited to 'src/run-fit')
-rwxr-xr-x | src/run-fit | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/run-fit b/src/run-fit new file mode 100755 index 0000000..d987c37 --- /dev/null +++ b/src/run-fit @@ -0,0 +1,29 @@ +#!/usr/bin/env python +from __future__ import print_function, division +import subprocess +from os.path import splitext + +def run_fit(filename): + root, ext = splitext(filename) + output = root + '.txt' + cmd = ["./fit", filename, "-o", output] + subprocess.call(cmd) + +if __name__ == '__main__': + import argparse + from multiprocessing import Pool, cpu_count + + parser = argparse.ArgumentParser("fit multiple zdab files") + parser.add_argument("-j", "--jobs", type=int, default=None, + help="number of jobs") + parser.add_argument("filenames", nargs="+", + help="zdab files") + args = parser.parse_args() + + jobs = args.jobs + + if jobs is None: + jobs = cpu_count() + + p = Pool(jobs) + p.map(run_fit,args.filenames) |