Skip to content

Commit

Permalink
fix dump polarized solution
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Mar 7, 2024
1 parent 63f0cd0 commit 1343b23
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 78 deletions.
40 changes: 1 addition & 39 deletions extras/data/machinery/generate/E142.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,4 @@
from .utils import load, obs_template


def dump(src_path, target):
"""Generate the input card for E142 measurements.
Parameters
----------
src_path : str
input path
Returns
-------
dict
observables dictionary, corresponding to the runcard
"""
obs = obs_template.copy()
data = load(src_path, 0, ["x", "Q2"])
dict_kins = [
dict(x=d["x"]["mid"], y=d["y"]["mid"], Q2=d["Q2"]["mid"]) for d in data
]

obs["PolarizationDIS"] = 0.0 if "_F1" in target.parent.name else 1.0
observable_name = "F1_total" if "_F1" in target.parent.name else "g1_total"
obs["observables"] = {observable_name: dict_kins}
if "_ep_" in str(src_path.stem) or "_mup_" in str(src_path.stem):
obs["TargetDIS"] = "proton"
elif "_en_" in str(src_path.stem) or "_mun_" in str(src_path.stem):
obs["TargetDIS"] = "neutron"
elif "_ed_" in str(src_path.stem) or "_mud_" in str(src_path.stem):
obs["TargetDIS"] = "isoscalar"

# Details regarding the observables
obs["prDIS"] = "NC"
obs["ProjectileDIS"] = "electron"

return obs

from .utils import dump_polarized as dump

# renaming
new_names = {
Expand Down
40 changes: 1 addition & 39 deletions extras/data/machinery/generate/E143.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,4 @@
from .utils import load, obs_template


def dump(src_path, target):
"""Generate the input card for E143 measurements.
Parameters
----------
src_path : str
input path
Returns
-------
dict
observables dictionary, corresponding to the runcard
"""
obs = obs_template.copy()
data = load(src_path, 0, ["x", "Q2"])
dict_kins = [
dict(x=d["x"]["mid"], y=d["y"]["mid"], Q2=d["Q2"]["mid"]) for d in data
]

obs["PolarizationDIS"] = 0.0 if "_F1" in target.parent.name else 1.0
observable_name = "F1_total" if "_F1" in target.parent.name else "g1_total"
obs["observables"] = {observable_name: dict_kins}
if "_ep_" in str(src_path.stem) or "_mup_" in str(src_path.stem):
obs["TargetDIS"] = "proton"
elif "_en_" in str(src_path.stem) or "_mun_" in str(src_path.stem):
obs["TargetDIS"] = "neutron"
elif "_ed_" in str(src_path.stem) or "_mud_" in str(src_path.stem):
obs["TargetDIS"] = "isoscalar"

# Details regarding the observables
obs["prDIS"] = "NC"
obs["ProjectileDIS"] = "electron"

return obs

from .utils import dump_polarized as dump

# renaming
new_names = {
Expand Down

0 comments on commit 1343b23

Please sign in to comment.