Skip to content

Commit 2c5deb3

Browse files
committed
fix for the qed part
1 parent 870e3e3 commit 2c5deb3

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

validphys2/src/validphys/photon/compute.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from scipy.interpolate import interp1d
99
import yaml
1010

11+
from eko import basis_rotation
1112
from eko.io import EKO
1213
from n3fit.io.writer import XGRID
1314
from validphys.n3fit_data import replica_luxseed
@@ -165,26 +166,27 @@ def compute_photon_array(self, replica):
165166
# TODO : the different x points could be even computed in parallel
166167

167168
# Load eko and reshape it
168-
with EKO.read(self.path_to_eko_photon) as eko:
169+
with EKO.read(self.path_to_eko_photon) as eko_photon:
169170
# TODO : if the eko has not the correct grid we have to reshape it
170171
# it has to be done inside vp-setupfit
171172

172-
# construct PDFs
173-
pdfs_init = np.zeros((len(eko.bases.inputpids), len(XGRID)))
174-
for j, pid in enumerate(eko.bases.inputpids):
175-
if pid == 22:
176-
pdfs_init[j] = photon_qin
177-
ph_id = j
178-
else:
179-
if pid not in self.luxpdfset.flavors:
173+
# NB: the eko should contain a single operator
174+
for _, elem in eko_photon.items():
175+
eko_op = elem.operator
176+
177+
pdfs_init = np.zeros_like(eko_op[0, 0])
178+
for j, pid in enumerate(basis_rotation.flavor_basis_pids):
179+
if pid == 22:
180+
pdfs_init[j] = photon_qin
181+
ph_id = j
182+
elif pid not in self.luxpdfset.flavors:
180183
continue
181-
pdfs_init[j] = np.array(
182-
[self.luxpdfset.xfxQ(x, self.q_in, replica, pid) / x for x in XGRID]
183-
)
184+
else:
185+
pdfs_init[j] = np.array(
186+
[self.luxpdfset.xfxQ(x, self.q_in, replica, pid) / x for x in XGRID]
187+
)
184188

185-
# Apply EKO to PDFs
186-
for _, elem in eko.items():
187-
pdfs_final = np.einsum("ajbk,bk", elem.operator, pdfs_init)
189+
pdfs_final = np.einsum("ajbk,bk", eko_op, pdfs_init)
188190

189191
photon_Q0 = pdfs_final[ph_id]
190192

validphys2/src/validphys/tests/photon/test_alpha.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def test_couplings_exa():
100100
dict(
101101
alphas=theory["alphas"],
102102
alphaem=theory["alphaqed"],
103-
scale=theory["Qref"],
104-
num_flavs_ref=None,
105-
max_num_flavs=theory["MaxNfPdf"],
103+
ref=(theory["Qref"], theory["MaxNfPdf"]),
106104
em_running=True,
107105
)
108106
)

validphys2/src/validphys/tests/photon/test_compute.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
import yaml
66

7+
from eko import basis_rotation
78
from eko.io import EKO
89
from n3fit.io.writer import XGRID
910
from validphys.api import API
@@ -94,8 +95,8 @@ def test_photon():
9495
photon_fiatlux_qin = np.array([lux.EvaluatePhoton(x, eko.mu20).total for x in XGRID])
9596
photon_fiatlux_qin /= XGRID
9697
# construct PDFs
97-
pdfs_init = np.zeros((len(eko.bases.inputpids), len(XGRID)))
98-
for j, pid in enumerate(eko.bases.inputpids):
98+
pdfs_init = np.zeros((len(basis_rotation.flavor_basis_pids), len(XGRID)))
99+
for j, pid in enumerate(basis_rotation.flavor_basis_pids):
99100
if pid == 22:
100101
pdfs_init[j] = photon_fiatlux_qin
101102
ph_id = j

0 commit comments

Comments
 (0)