From df6371fc602040ef928eed7367a4a6423b83402c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Mon, 5 Jun 2023 11:01:50 +0200 Subject: [PATCH 1/7] Allow Q_IN != 100 --- validphys2/src/validphys/photon/compute.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/validphys2/src/validphys/photon/compute.py b/validphys2/src/validphys/photon/compute.py index bbbdfc650f..20db68a34d 100644 --- a/validphys2/src/validphys/photon/compute.py +++ b/validphys2/src/validphys/photon/compute.py @@ -17,7 +17,6 @@ log = logging.getLogger(__name__) -Q_IN = 100 FIATLUX_DEFAULT = { "apfel": False, "eps_base": 1e-5, # precision on final integration of double integral. @@ -71,6 +70,9 @@ def __init__(self, theoryid, lux_params, replicas): path_to_F2 = theoryid.path / "fastkernel/fiatlux_dis_F2.pineappl.lz4" path_to_FL = theoryid.path / "fastkernel/fiatlux_dis_FL.pineappl.lz4" self.path_to_eko_photon = theoryid.path / "eko_photon.tar" + with EKO.read(self.path_to_eko_photon) as eko: + self.q_in = np.sqrt(eko.mu20) + # set fiatlux self.lux = {} @@ -129,7 +131,7 @@ def compute_photon_array(self, replica): """ # Compute photon PDF log.info(f"Computing photon") - photon_qin = np.array([self.lux[replica].EvaluatePhoton(x, Q_IN**2).total for x in XGRID]) + photon_qin = np.array([self.lux[replica].EvaluatePhoton(x, self.q_in**2).total for x in XGRID]) photon_qin += self.generate_errors(replica) # fiatlux computes x * gamma(x) photon_qin /= XGRID @@ -150,7 +152,7 @@ def compute_photon_array(self, replica): if pid not in self.luxpdfset.flavors: continue pdfs_init[j] = np.array( - [self.luxpdfset.xfxQ(x, Q_IN, replica, pid) / x for x in XGRID] + [self.luxpdfset.xfxQ(x, self.q_in, replica, pid) / x for x in XGRID] ) # Apply EKO to PDFs @@ -188,7 +190,7 @@ def error_matrix(self): if not self.additional_errors: return None extra_set = self.additional_errors.load() - qs = [Q_IN] * len(XGRID) + qs = [self.q_in] * len(XGRID) res_central = np.array(extra_set.central_member.xfxQ(22, XGRID, qs)) res = [] for idx_member in range(101, 107 + 1): From 04ac7a862adc02af3648ae9e891c2ce36af4971e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Mon, 5 Jun 2023 12:20:18 +0200 Subject: [PATCH 2/7] Add theories 524, 525, 526 --- nnpdfcpp/data/theory.db | Bin 102400 -> 106496 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/nnpdfcpp/data/theory.db b/nnpdfcpp/data/theory.db index 1f953e2459c1a85332b22111d2482d6dfe3ba942..4bc4113daa27cf0ac13d2a54120afb9151699767 100644 GIT binary patch delta 477 zcmZozz}9epZGto_I|BoQ)Ipj|IP&uV1tgoz zfTTpT&g544dS)38k%o80+5c)CFs#6m5yvjeD9rkZWzodKuZ+x-6(8hnY+z>Iex!hL zI@5N!cE(2>(+U__gxJ~38TgL#F62q&)?qK_{K&C!V__mYOOsg(-}K66MzzU1o(WIy zX<|G-{cRf~x0FW5xJ^y!XKj2hDyH8Jia!cbGNnHDWPV9nEcfUcPC b9mObz(65T$QF>-zBewfDF$Ob%;s_1^6y}Hy delta 171 zcmV;c095~gzy^Sz29O&C1ONa48Id4A0R*vNqz?!c4}Smv000@23=k@_K@d9+k$@2c z7=tg9g&%(d83-)12Ouy414IZsv2pSRgDfbwEGPlkM*|E1#Fqzf0ll|}gaMZV13QB( zmm!A%CYMco0S=Ri_fwZJiUFFpe{=zb3mOXoPXG?A4P^`_3g!u(2wn#r19bvV1>yvv Zv2ig1x1pT@Qv$cKm;rnOw;qQ9;s{>$F@OL7 From b425a697cad68edf69a331c76c667708ac076d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Tue, 6 Jun 2023 15:43:47 +0200 Subject: [PATCH 3/7] Fix tests --- .../src/validphys/tests/photon/test_compute.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/validphys2/src/validphys/tests/photon/test_compute.py b/validphys2/src/validphys/tests/photon/test_compute.py index 30805be889..f61b13a6bd 100644 --- a/validphys2/src/validphys/tests/photon/test_compute.py +++ b/validphys2/src/validphys/tests/photon/test_compute.py @@ -8,6 +8,7 @@ from validphys.core import PDF as PDFset from ..conftest import PDF +from eko.io import EKO class FakeTheory: @@ -68,6 +69,17 @@ def PlugStructureFunctions(self, f2, fl, f2lo): def EvaluatePhoton(self, x, q): return self.res +class FakeEKO: + def __init__(self, path): + self.path = path + self.mu20 = 100**2 + + def __enter__(self): + return self + + def __exit__(self, exc_type: type, _exc_value, _traceback): + pass + class FakeStructureFunction: def __init__(self, path, pdfs): @@ -95,6 +107,7 @@ def test_parameters_init(monkeypatch): monkeypatch.setattr(structure_functions, "F2LO", FakeF2LO) monkeypatch.setattr(fiatlux, "FiatLux", FakeFiatlux) monkeypatch.setattr(Photon, "compute_photon_array", lambda *args: np.zeros(196)) + monkeypatch.setattr(EKO, "read", FakeEKO) photon = Photon(FakeTheory(), fiatlux_runcard, [1, 2, 3]) alpha = Alpha(FakeTheory().get_description()) From cb59f2e57aed96b8e74ec16da86b36d7c99e2a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Tue, 6 Jun 2023 22:11:14 +0200 Subject: [PATCH 4/7] Upgrade to eko13 --- validphys2/src/validphys/photon/compute.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/validphys2/src/validphys/photon/compute.py b/validphys2/src/validphys/photon/compute.py index 20db68a34d..b161ce8efb 100644 --- a/validphys2/src/validphys/photon/compute.py +++ b/validphys2/src/validphys/photon/compute.py @@ -143,8 +143,8 @@ def compute_photon_array(self, replica): # it has to be done inside vp-setupfit # construct PDFs - pdfs_init = np.zeros((len(eko.rotations.inputpids), len(XGRID))) - for j, pid in enumerate(eko.rotations.inputpids): + pdfs_init = np.zeros((len(eko.bases.inputpids), len(XGRID))) + for j, pid in enumerate(eko.bases.inputpids): if pid == 22: pdfs_init[j] = photon_qin ph_id = j @@ -156,8 +156,7 @@ def compute_photon_array(self, replica): ) # Apply EKO to PDFs - q2 = eko.mu2grid[0] - with eko.operator(q2) as elem: + for (mu2, nf), elem in eko.items(): pdfs_final = np.einsum("ajbk,bk", elem.operator, pdfs_init) photon_Q0 = pdfs_final[ph_id] From 6a33baa5aada3145d2b4568a3b5f3969423e92e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Tue, 6 Jun 2023 22:14:20 +0200 Subject: [PATCH 5/7] Use ev_op_iterations=30 for exact evolution --- n3fit/src/evolven3fit_new/eko_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/n3fit/src/evolven3fit_new/eko_utils.py b/n3fit/src/evolven3fit_new/eko_utils.py index cf92ebb4ce..380acd069e 100644 --- a/n3fit/src/evolven3fit_new/eko_utils.py +++ b/n3fit/src/evolven3fit_new/eko_utils.py @@ -21,7 +21,7 @@ } EVOLVEN3FIT_CONFIGS_DEFAULTS_EXA = { - "ev_op_iterations": 10, + "ev_op_iterations": 30, "ev_op_max_order": (1, 0), "evolution_method": "iterate-exact", "inversion_method": "exact", From 4c19a789ffb186535eda4c66cb816b78bb428c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Wed, 7 Jun 2023 13:24:18 +0200 Subject: [PATCH 6/7] Add control on alphaem running in eko_utils --- n3fit/src/evolven3fit_new/eko_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/n3fit/src/evolven3fit_new/eko_utils.py b/n3fit/src/evolven3fit_new/eko_utils.py index 380acd069e..51516a03bb 100644 --- a/n3fit/src/evolven3fit_new/eko_utils.py +++ b/n3fit/src/evolven3fit_new/eko_utils.py @@ -62,6 +62,10 @@ def construct_eko_cards( # 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 + # if Qedref = Qref alphaem is running, otherwise it's fixed + if theory["QED"] > 0: + if np.isclose(theory["Qref"], theory["Qedref"]): + theory_card.couplings.em_running = True # construct operator card q2_grid = utils.generate_q2grid( theory["Q0"], From 6e98bf887ba6b9466fa52db04be95cc72ab53f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Laurenti?= Date: Tue, 13 Jun 2023 13:09:17 +0200 Subject: [PATCH 7/7] Use _ for unused varibles --- validphys2/src/validphys/photon/compute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validphys2/src/validphys/photon/compute.py b/validphys2/src/validphys/photon/compute.py index 2b94d1f795..657e807ba2 100644 --- a/validphys2/src/validphys/photon/compute.py +++ b/validphys2/src/validphys/photon/compute.py @@ -156,7 +156,7 @@ def compute_photon_array(self, replica): ) # Apply EKO to PDFs - for (mu2, nf), elem in eko.items(): + for _, elem in eko.items(): pdfs_final = np.einsum("ajbk,bk", elem.operator, pdfs_init) photon_Q0 = pdfs_final[ph_id]