Skip to content

Commit 5797865

Browse files
giacomomagniscarlehoff
authored andcommitted
fix evolven3fit evolve
1 parent 5648cfa commit 5797865

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

n3fit/src/evolven3fit/cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def cli_evolven3fit(
5-
configuration_folder, q_fin, q_points, op_card_info, theory_card_info, force, load, dump, ncores
5+
configuration_folder, q_fin, q_points, op_card_info, theory_card_info, force, load, dump,
66
):
77
"""Evolves the fitted PDFs.
88
@@ -31,5 +31,4 @@ def cli_evolven3fit(
3131
force,
3232
load,
3333
dump,
34-
ncores,
3534
)

n3fit/src/evolven3fit/evolve.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def evolve_fit(
3434
force,
3535
eko_path,
3636
dump_eko=None,
37-
ncores=1,
3837
):
3938
"""
4039
Evolves all the fitted replica in fit_folder/nnfit
@@ -126,7 +125,10 @@ def evolve_fit(
126125
# Read the information from all replicas into what eko wants:
127126
all_replicas = []
128127
for pdf_data in initial_PDFs_dict.values():
129-
all_replicas.append(np.array(pdf_data["pdfgrid"]).T)
128+
# swap photon postion to match eko.basis_roation.flavor_basis_pids
129+
pdfgrid = np.array(pdf_data["pdfgrid"])
130+
pdfgrid = np.append(pdfgrid[:,-1].reshape(x_grid.size,1), pdfgrid[:,:-1], axis=1)
131+
all_replicas.append(pdfgrid.T)
130132

131133
# reshape the xgrid eko if necessary
132134
for _, elem in eko_op.items():
@@ -138,26 +140,24 @@ def evolve_fit(
138140
inputgrid=XGrid(x_grid),
139141
)
140142

141-
all_evolved, _ = apply.apply_grids(eko_op, np.array(all_replicas))
142143
# {(Q2, nf): (replica, flavour, x)}
143-
nreplicas = len(all_replicas)
144-
all_evolved = [{i: k[r] for i, k in all_evolved.items()} for r in range(nreplicas)]
144+
all_evolved, _ = apply.apply_grids(eko_op, np.array(all_replicas))
145145

146146
# Now, replica by replica, break into blocks
147147
targetgrid = eko_op.xgrid.tolist()
148148
by_nf = defaultdict(list)
149-
for q, nf in sorted(eko_op.evolgrid, key=lambda ep: ep[1]):
150-
by_nf[nf].append(q)
151-
q2block_per_nf = {nf: sorted(qs) for nf, qs in by_nf.items()}
149+
for q2, nf in sorted(eko_op.evolgrid, key=lambda ep: ep[1]):
150+
by_nf[nf].append(q2)
151+
q2block_per_nf = {nf: sorted(q2s) for nf, q2s in by_nf.items()}
152152

153-
for replica, evolved_pdf in enumerate(all_evolved):
153+
for replica in range(len(all_replicas)):
154154
blocks = []
155155
for nf, q2grid in q2block_per_nf.items():
156156

157157
def pdf_xq2(pid, x, Q2):
158158
x_idx = targetgrid.index(x)
159159
pid_idx = info["Flavors"].index(pid)
160-
return x * evolved_pdf[(Q2, nf)][pid_idx][x_idx]
160+
return x * all_evolved[(Q2, nf)][replica][pid_idx][x_idx]
161161

162162
block = genpdf.generate_block(
163163
pdf_xq2,

n3fit/src/n3fit/scripts/evolven3fit.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ def main():
166166
args.force,
167167
eko_path,
168168
None,
169-
args.n_cores,
170169
)
171170
else:
172171
# If we are in the business of producing an eko, do some checks before starting:

0 commit comments

Comments
 (0)