Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for evolven3fit_new and lhapdf .info files. #1746

Merged
merged 11 commits into from
Jun 7, 2023
17 changes: 14 additions & 3 deletions n3fit/src/evolven3fit_new/eko_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def construct_eko_cards(
theory_card_dict = {}
if op_card_dict is None:
op_card_dict = {}

# theory_card construction
theory = Loader().check_theoryID(theoryID).get_description()
theory.pop("FNS")
Expand All @@ -59,19 +60,29 @@ def construct_eko_cards(
theory["nfref"] = NFREF_DEFAULT
if "nf0" not in theory:
theory["nf0"] = NF0_DEFAULT

# The Legacy function is able to construct a theory card for eko starting from an NNPDF theory
legacy_class = runcards.Legacy(theory, {})
theory_card = legacy_class.new_theory

# Prepare the thresholds according to MaxNfPdf
thresholds = {"c": theory["kcThr"], "b": theory["kbThr"], "t": theory["kbThr"]}
if theory["MaxNfPdf"] < 5:
thresholds["b"] = np.inf
if theory["MaxNfPdf"] < 6:
thresholds["t"] = np.inf

# construct operator card
q2_grid = utils.generate_q2grid(
theory["Q0"],
q_fin,
q_points,
{theory["mb"]: theory["kbThr"], theory["mt"]: theory["ktThr"]},
{theory["mb"]: thresholds["b"], theory["mt"]: thresholds["t"]},
scarlehoff marked this conversation as resolved.
Show resolved Hide resolved
)
op_card = default_op_card
masses = np.array([theory["mc"],theory["mb"],theory["mt"]]) ** 2
thresholds_ratios=np.array([theory["kcThr"],theory["kbThr"],theory["ktThr"]]) ** 2
masses = np.array([theory["mc"], theory["mb"], theory["mt"]]) ** 2
thresholds_ratios = np.array([thresholds["c"], thresholds["b"], thresholds["t"]]) ** 2

atlas = Atlas(
matching_scales=MatchingScales(masses * thresholds_ratios),
origin=(theory["Q0"]**2, theory["nf0"])
Expand Down
1 change: 1 addition & 0 deletions n3fit/src/evolven3fit_new/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def evolve_fit(
info["XMax"] = float(x_grid[-1])
# Save the PIDs in the info file in the same order as in the evolution
info["Flavors"] = basis_rotation.flavor_basis_pids
info["NumFlavors"] = theory.couplings.max_num_flavs
scarlehoff marked this conversation as resolved.
Show resolved Hide resolved
scarlehoff marked this conversation as resolved.
Show resolved Hide resolved
dump_info_file(usr_path, info)

for replica, pdf_data in initial_PDFs_dict.items():
Expand Down
2 changes: 2 additions & 0 deletions n3fit/src/n3fit/tests/test_evolven3fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def check_lhapdf_info(info_path):
for flavor in info["Flavors"]:
assert isinstance(flavor, int)

assert info["NumFlavors"] <= 6

return info


Expand Down