Skip to content

Instantly share code, notes, and snippets.

@APN-Pucky
Created May 19, 2022 09:05
Show Gist options
  • Save APN-Pucky/fbc60e97818c89d27c9c0b57b2c8c26b to your computer and use it in GitHub Desktop.
Save APN-Pucky/fbc60e97818c89d27c9c0b57b2c8c26b to your computer and use it in GitHub Desktop.
Fix relative to absolute uncertainties in xsec jsons
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