@@ -122,35 +122,38 @@ def evolve_fit(
122
122
info ["NumFlavors" ] = 5 # TODO: Maximum number in evol
123
123
dump_info_file (usr_path , info )
124
124
125
- # Read the information from all replicas into what eko wants:
125
+ # Read the information from all the sorted replicas into what eko wants
126
+ n_replicas = len (initial_PDFs_dict )
126
127
all_replicas = []
127
- for pdf_data in initial_PDFs_dict . values ( ):
128
+ for rep_idx in range ( 1 , n_replicas + 1 ):
128
129
# swap photon postion to match eko.basis_roation.flavor_basis_pids
129
- pdfgrid = np .array (pdf_data ["pdfgrid" ])
130
+ pdfgrid = np .array (initial_PDFs_dict [ f"replica_ { rep_idx } " ] ["pdfgrid" ])
130
131
pdfgrid = np .append (pdfgrid [:,- 1 ].reshape (x_grid .size ,1 ), pdfgrid [:,:- 1 ], axis = 1 )
131
- all_replicas .append (pdfgrid .T )
132
+ # and divide by x
133
+ all_replicas .append (pdfgrid .T / x_grid )
132
134
133
135
# reshape the xgrid eko if necessary
134
- for _ , elem in eko_op .items ():
135
- elem = manipulate .xgrid_reshape (
136
- elem ,
137
- eko_op .xgrid ,
138
- op .configs .interpolation_polynomial_degree ,
139
- targetgrid = XGrid (x_grid ),
140
- inputgrid = XGrid (x_grid ),
141
- )
136
+ if not XGrid (x_grid ) == eko_op .xgrid :
137
+ for _ , elem in eko_op .items ():
138
+ elem = manipulate .xgrid_reshape (
139
+ elem ,
140
+ eko_op .xgrid ,
141
+ op .configs .interpolation_polynomial_degree ,
142
+ targetgrid = XGrid (x_grid ),
143
+ inputgrid = XGrid (x_grid ),
144
+ )
142
145
143
- # {(Q2, nf): (replica, flavour, x)}
146
+ # output is {(Q2, nf): (replica, flavour, x)}
144
147
all_evolved , _ = apply .apply_grids (eko_op , np .array (all_replicas ))
145
148
146
- # Now, replica by replica, break into blocks
149
+ # Now, replica by replica, break into nf blocks
147
150
targetgrid = eko_op .xgrid .tolist ()
148
151
by_nf = defaultdict (list )
149
152
for q2 , nf in sorted (eko_op .evolgrid , key = lambda ep : ep [1 ]):
150
153
by_nf [nf ].append (q2 )
151
154
q2block_per_nf = {nf : sorted (q2s ) for nf , q2s in by_nf .items ()}
152
155
153
- for replica in range (len ( all_replicas ) ):
156
+ for replica in range (n_replicas ):
154
157
blocks = []
155
158
for nf , q2grid in q2block_per_nf .items ():
156
159
@@ -166,8 +169,7 @@ def pdf_xq2(pid, x, Q2):
166
169
pids = basis_rotation .flavor_basis_pids ,
167
170
)
168
171
blocks .append (block )
169
-
170
- dump_evolved_replica (blocks , usr_path , int (replica + 1 ))
172
+ dump_evolved_replica (blocks , usr_path , replica + 1 )
171
173
172
174
# remove folder:
173
175
# The function dump_evolved_replica dumps the replica files in a temporary folder
0 commit comments