blob: d987c37df919507193609a2472b30afcce983282 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
|