Skip to content

Commit

Permalink
split bcdms per q2 bin
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyStegeman committed Aug 3, 2023
1 parent ac0363b commit c4c1006
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 14 additions & 11 deletions extras/data/machinery/generate/BCDMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ def dump(src_path, _target):
src = pathlib.Path(src_path)

esf = []
for sub in sorted(src.glob("*")):
text = sub.read_text()
with tempfile.NamedTemporaryFile(mode="w") as ntf:
cut_text = "\n".join(text.splitlines()[::2])
ntf.write(cut_text)
ntf.flush()
data = load(ntf.name, 0, ["x", "y", "Q2"])
esf += [dict(x=d["x"], y=d["y"], Q2=d["Q2"]) for d in data]

text = src.read_text()
with tempfile.NamedTemporaryFile(mode="w") as ntf:
cut_text = "\n".join(text.splitlines()[::2])
ntf.write(cut_text)
ntf.flush()
data = load(ntf.name, 0, ["x", "y", "Q2"])
esf += [dict(x=d["x"], y=d["y"], Q2=d["Q2"]) for d in data]
obs["prDIS"] = "NC"
obs["observables"] = {"F2_total": esf}
obs["ProjectileDIS"] = "electron"
Expand All @@ -46,6 +44,11 @@ def dump(src_path, _target):

# renaming
new_names = {
"bcd_d": "BCDMS_NC_EM_D_F2",
"bcd_p": "BCDMS_NC_EM_P_F2",
"bcd_d120": "BCDMS_NC_100GEV_EM_D_F2",
"bcd_d200": "BCDMS_NC_200GEV_EM_D_F2",
"bcd_d280": "BCDMS_NC_280GEV_EM_D_F2",
"bcd_p100": "BCDMS_NC_100GEV_EM_P_F2",
"bcd_p120": "BCDMS_NC_120GEV_EM_P_F2",
"bcd_p200": "BCDMS_NC_200GEV_EM_P_F2",
"bcd_p280": "BCDMS_NC_280GEV_EM_P_F2",
}

0 comments on commit c4c1006

Please sign in to comment.