Created
June 12, 2018 18:18
-
-
Save swang373/0ad38b479f0f506eb38b170495dcd6d8 to your computer and use it in GitHub Desktop.
Split an AnalysisTools resubmission job into more subjobs and calculate the starts and stops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# The only command line argument should be the path to a file | |
# where each line is a set of arguments for resubmission. | |
with open(sys.argv[1]) as f: | |
lines = f.read().splitlines() | |
for line in lines: | |
start, stop = line.split()[-3:-1] | |
start = float(start) | |
stop = float(stop) | |
step = (stop - start) / 20. | |
current_start = start | |
for i in range(20): | |
newargs = line.split() | |
newargs[-4] = newargs[-4].replace('.root', 'part{0!s}.root'.format(i)) | |
newargs[-3] = str(current_start) | |
newargs[-2] = str(current_start + step) | |
current_start += step | |
print ' '.join(newargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment