Created
May 19, 2022 09:05
-
-
Save APN-Pucky/fbc60e97818c89d27c9c0b57b2c8c26b to your computer and use it in GitHub Desktop.
Fix relative to absolute uncertainties in xsec jsons
This file contains 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 json | |
import sys | |
def recursive_for_replace(data): | |
if "xsec_pb" in data and "unc_pb" in data: | |
data["unc_pb"] = data["unc_pb"] * data["xsec_pb"] | |
return | |
for k in data: | |
recursive_for_replace(data[k]) | |
def main(argv): | |
for f in argv[1:]: | |
mydata = json.load(open(f)) | |
recursive_for_replace(mydata["data"]) | |
open(f ,'w').write( json.dumps(mydata)) | |
if __name__ == "__main__": | |
main(sys.argv) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment