@@ -34,7 +34,6 @@ def sv_scheme(tcard):
3434 ----------
3535 tcard : dict
3636 theory card
37-
3837 """
3938 modsv_list = {a .value for a in ScaleVariationsMethod }
4039 xif = tcard ["XIF" ]
@@ -49,6 +48,25 @@ def sv_scheme(tcard):
4948 return modsv
5049
5150
51+ def construct_atlas (tcard ):
52+ """Construct the atlas for heavy quarks matching.
53+
54+ Parameters
55+ ----------
56+ tcard : dict
57+ theory card
58+ """
59+ masses = np .array ([tcard ["mc" ], tcard ["mb" ], tcard ["mt" ]]) ** 2
60+ thresholds_ratios = np .array ([tcard ["kcThr" ], tcard ["kbThr" ], tcard ["ktThr" ]]) ** 2
61+ for q in range (tcard ["MaxNfPdf" ] + 1 , 6 + 1 ):
62+ thresholds_ratios [q - 4 ] = np .inf
63+ atlas = Atlas (
64+ matching_scales = heavy_quarks .MatchingScales (masses * thresholds_ratios ),
65+ origin = (tcard ["Q0" ] ** 2 , tcard ["nf0" ]),
66+ )
67+ return atlas
68+
69+
5270def get_convolution_suffix (convolution : pineappl .convolutions .Conv ) -> str :
5371 """Get the correct suffix for a given convolution.
5472
@@ -200,19 +218,12 @@ def write_operator_card(
200218 raise ValueError ("Template declares a value of Q0, nf0 different from theory" )
201219
202220 q2_grid = (xif * xif * muf2_grid ).tolist ()
203- masses = np .array ([tcard ["mc" ], tcard ["mb" ], tcard ["mt" ]]) ** 2
204- thresholds_ratios = np .array ([tcard ["kcThr" ], tcard ["kbThr" ], tcard ["ktThr" ]]) ** 2
205- for q in range (tcard ["MaxNfPdf" ] + 1 , 6 + 1 ):
206- thresholds_ratios [q - 4 ] = np .inf
207- atlas = Atlas (
208- matching_scales = heavy_quarks .MatchingScales (masses * thresholds_ratios ),
209- origin = (tcard ["Q0" ] ** 2 , tcard ["nf0" ]),
210- )
211221 # If we are producing nFONLL FKs we need to look to NfFF...
212222 if check .is_num_fonll (tcard ["FNS" ]):
213223 nf = tcard ["NfFF" ]
214224 operators_card ["mugrid" ] = [(float (np .sqrt (q2 )), int (nf )) for q2 in q2_grid ]
215225 else :
226+ atlas = construct_atlas (tcard )
216227 operators_card ["mugrid" ] = [
217228 (float (np .sqrt (q2 )), nf_default (q2 , atlas )) for q2 in q2_grid
218229 ]
@@ -287,9 +298,9 @@ def evolve_grid(
287298 xir : float ,
288299 xif : float ,
289300 xia : float ,
301+ theory_meta : dict ,
290302 assumptions = "Nf6Ind" ,
291303 comparison_pdfs : Optional [list [str ]] = None ,
292- meta_data = None ,
293304 min_as = None ,
294305):
295306 """Convolute grid with EKO from file paths.
@@ -312,12 +323,12 @@ def evolve_grid(
312323 factorization scale variation
313324 xia : float
314325 fragmentation scale variation
326+ tcard: dict
327+ card containing the theory parameters
315328 assumptions : str
316329 assumptions on the flavor dimension
317330 comparison_pdfs : list(str) or None
318331 if given, a comparison table (with / without evolution) will be printed
319- meta_data : None or dict
320- if given, additional meta data written to the FK table
321332 min_as: None or int
322333 minimum power of strong coupling
323334 """
@@ -335,6 +346,7 @@ def evolve_grid(
335346 if "integrability_version" in grid .metadata :
336347 x_grid = np .append (x_grid , 1.0 )
337348
349+ muf2_grid = evol_info .fac1
338350 mur2_grid = evol_info .ren1
339351 xif = 1.0 if operators [0 ].operator_card .configs .scvar_method is not None else xif
340352 tcard = operators [0 ].theory_card
@@ -356,9 +368,12 @@ def evolve_grid(
356368 # To compute the alphas values we are first reverting the factorization scale shift
357369 # and then obtaining the renormalization scale using xir.
358370 ren_grid2 = xir * xir * mur2_grid
359- # NOTE: Currently, getting `nfgrid` from the first Operator is correct but this
360- # might need to be addressed in the future
361- nfgrid = [x [1 ] for x in operators [0 ].operator_card .mugrid ]
371+ if check .is_num_fonll (theory_meta ["FNS" ]):
372+ nfgrid = [int (theory_meta ["NfFF" ]) for _ in mur2_grid ]
373+ else :
374+ q2mur_grid = (xir * xir * mur2_grid ).tolist ()
375+ atlas = construct_atlas (theory_meta )
376+ nfgrid = [nf_default (q2 , atlas ) for q2 in q2mur_grid ]
362377 alphas_values = [
363378 4.0 * np .pi * sc .a_s (mur2 , nf_to = nf ) for mur2 , nf in zip (ren_grid2 , nfgrid )
364379 ]
@@ -415,9 +430,7 @@ def prepare(operator, convolution_types):
415430 )
416431
417432 fktable .set_metadata ("pineko_version" , version .__version__ )
418- if meta_data is not None :
419- for k , v in meta_data .items ():
420- fktable .set_metadata (k , v )
433+ fktable .set_metadata ("theory_card" , json .dumps (theory_meta ))
421434
422435 # compare before/after
423436 comparison = None
0 commit comments