|
8 | 8 | from scipy.interpolate import interp1d |
9 | 9 | import yaml |
10 | 10 |
|
| 11 | +from eko import basis_rotation |
11 | 12 | from eko.io import EKO |
12 | 13 | from n3fit.io.writer import XGRID |
13 | 14 | from validphys.n3fit_data import replica_luxseed |
@@ -165,26 +166,27 @@ def compute_photon_array(self, replica): |
165 | 166 | # TODO : the different x points could be even computed in parallel |
166 | 167 |
|
167 | 168 | # 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: |
169 | 170 | # TODO : if the eko has not the correct grid we have to reshape it |
170 | 171 | # it has to be done inside vp-setupfit |
171 | 172 |
|
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: |
180 | 183 | 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 | + ) |
184 | 188 |
|
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) |
188 | 190 |
|
189 | 191 | photon_Q0 = pdfs_final[ph_id] |
190 | 192 |
|
|
0 commit comments