|
8 | 8 | import numpy as np
|
9 | 9 |
|
10 | 10 | import eko
|
| 11 | +from eko import basis_rotation, runner |
11 | 12 | from eko.interpolation import XGrid
|
12 | 13 | from eko.io import manipulate
|
13 | 14 | from eko import basis_rotation, runner
|
|
26 | 27 |
|
27 | 28 |
|
28 | 29 | def evolve_fit(
|
29 |
| - fit_folder, |
30 |
| - q_fin, |
31 |
| - q_points, |
32 |
| - op_card_dict, |
33 |
| - theory_card_dict, |
34 |
| - force, |
35 |
| - eko_path, |
36 |
| - dump_eko=None, |
| 30 | + fit_folder, q_fin, q_points, op_card_dict, theory_card_dict, force, eko_path, dump_eko=None |
37 | 31 | ):
|
38 | 32 | """
|
39 | 33 | Evolves all the fitted replica in fit_folder/nnfit
|
@@ -128,12 +122,12 @@ def evolve_fit(
|
128 | 122 | for rep_idx in range(1, n_replicas + 1):
|
129 | 123 | # swap photon postion to match eko.basis_roation.flavor_basis_pids
|
130 | 124 | pdfgrid = np.array(initial_PDFs_dict[f"replica_{rep_idx}"]["pdfgrid"])
|
131 |
| - pdfgrid = np.append(pdfgrid[:,-1].reshape(x_grid.size,1), pdfgrid[:,:-1], axis=1) |
| 125 | + pdfgrid = np.append(pdfgrid[:, -1].reshape(x_grid.size, 1), pdfgrid[:, :-1], axis=1) |
132 | 126 | # and divide by x
|
133 |
| - all_replicas.append(pdfgrid.T / x_grid ) |
| 127 | + all_replicas.append(pdfgrid.T / x_grid) |
134 | 128 |
|
135 | 129 | # reshape the xgrid eko if necessary
|
136 |
| - if not XGrid(x_grid) == eko_op.xgrid: |
| 130 | + if XGrid(x_grid) != eko_op.xgrid: |
137 | 131 | for _, elem in eko_op.items():
|
138 | 132 | elem = manipulate.xgrid_reshape(
|
139 | 133 | elem,
|
@@ -201,53 +195,6 @@ def load_fit(usr_path):
|
201 | 195 | return pdf_dict
|
202 | 196 |
|
203 | 197 |
|
204 |
| -def evolve_exportgrid(exportgrid, eko, x_grid): |
205 |
| - """ |
206 |
| - Evolves the provided exportgrid for the desired replica with the eko and returns the evolved block |
207 |
| -
|
208 |
| - Parameters |
209 |
| - ---------- |
210 |
| - exportgrid: dict |
211 |
| - exportgrid of pdf at fitting scale |
212 |
| - eko: eko object |
213 |
| - eko operator for evolution |
214 |
| - xgrid: list |
215 |
| - xgrid to be used as the targetgrid |
216 |
| - Returns |
217 |
| - ------- |
218 |
| - : list(np.array) |
219 |
| - list of evolved blocks |
220 |
| - """ |
221 |
| - # construct LhapdfLike object |
222 |
| - pdf_grid = np.array(exportgrid["pdfgrid"]).transpose() |
223 |
| - |
224 |
| - pdf_to_evolve = utils.LhapdfLike(pdf_grid, exportgrid["q20"], x_grid) |
225 |
| - # evolve pdf |
226 |
| - evolved_pdf = apply.apply_pdf(eko, pdf_to_evolve) |
227 |
| - # generate block to dump |
228 |
| - targetgrid = eko.bases.targetgrid.tolist() |
229 |
| - |
230 |
| - # Finally separate by nf block (and order per nf/q) |
231 |
| - by_nf = defaultdict(list) |
232 |
| - for q, nf in sorted(eko.evolgrid, key=lambda ep: ep[1]): |
233 |
| - by_nf[nf].append(q) |
234 |
| - q2block_per_nf = {nf: sorted(qs) for nf, qs in by_nf.items()} |
235 |
| - |
236 |
| - blocks = [] |
237 |
| - for nf, q2grid in q2block_per_nf.items(): |
238 |
| - |
239 |
| - def pdf_xq2(pid, x, Q2): |
240 |
| - x_idx = targetgrid.index(x) |
241 |
| - return x * evolved_pdf[(Q2, nf)]["pdfs"][pid][x_idx] |
242 |
| - |
243 |
| - block = genpdf.generate_block( |
244 |
| - pdf_xq2, xgrid=targetgrid, sorted_q2grid=q2grid, pids=basis_rotation.flavor_basis_pids |
245 |
| - ) |
246 |
| - blocks.append(block) |
247 |
| - |
248 |
| - return blocks |
249 |
| - |
250 |
| - |
251 | 198 | def dump_evolved_replica(evolved_blocks, usr_path, replica_num):
|
252 | 199 | """
|
253 | 200 | Dump the evolved replica given by evolved_block as the replica num "replica_num" in
|
|
0 commit comments