1515
1616pass
1717from validphys .checks import check_pc_parameters
18- from validphys .core import PDF
1918from validphys .results import results , results_central
2019from validphys .theorycovariance .higher_twist_functions import compute_deltas_pc
2120from validphys .theorycovariance .theorycovarianceutils import (
@@ -227,34 +226,31 @@ def covmat_n3lo_ad(name1, name2, deltas1, deltas2):
227226def covmat_power_corrections (deltas1 , deltas2 ):
228227 """Returns the the theory covariance sub-matrix for power
229228 corrections. The two arguments `deltas1` and `deltas2` contain
230- the shifts for the firs and second experiment, respectively.
229+ the shifts for the first and second experiment, respectively.
231230
232231 The shifts are given in this form:
233232 ```
234- deltas1 = {shift1_label: array1_of_shifts1,
235- shift2_label: array1_of_shifts2,
236- shift3_label: array1_of_shifts3,
237- ...}
238- deltas2 = {shift1_label: array2_of_shifts1,
239- shift2_label: array2_of_shifts2,
240- shift3_label: array2_of_shifts3,
241- ...}
233+ deltas1 = [ array1_of_shifts1,
234+ array1_of_shifts2,
235+ array1_of_shifts3,
236+ ...]
237+ deltas2 = [ array2_of_shifts1,
238+ array2_of_shifts2,
239+ array2_of_shifts3,
240+ ...]
242241 ```
243242 The sub-matrix is computed using the 5-point prescription, thus
244243
245244 s = array1_of_shifts1 X array2_of_shifts1 + array1_of_shifts2 X array2_of_shifts2 + ...
246245
247- where `X ` is the outer product.
246+ where ``X` ` is the outer product.
248247 """
249- # Check that `deltas1` and `deltas2` have the same shifts
250- if deltas1 .keys () != deltas2 .keys ():
251- raise RuntimeError ('The two dictionaries do not contain the same shifts.' )
252248
253- size1 = next ( iter ( deltas1 . values ())) .size
254- size2 = next ( iter ( deltas2 . values ())) .size
249+ size1 = deltas1 [ 0 ] .size
250+ size2 = deltas2 [ 0 ] .size
255251 s = np .zeros (shape = (size1 , size2 ))
256- for shift in deltas1 . keys ( ):
257- s += np .outer (deltas1 [ shift ], deltas2 [ shift ] )
252+ for shift1 , shift2 in zip ( deltas1 , deltas2 ):
253+ s += np .outer (shift1 , shift2 )
258254 return s
259255
260256
@@ -367,12 +363,7 @@ def covs_pt_prescrip_mhou(combine_by_type, point_prescription):
367363
368364@check_pc_parameters
369365def covs_pt_prescrip_pc (
370- combine_by_type ,
371- point_prescription ,
372- pdf : PDF ,
373- pc_parameters ,
374- pc_included_procs ,
375- pc_excluded_exps ,
366+ combine_by_type , point_prescription , pdf , pc_parameters , pc_included_procs , pc_excluded_exps
376367):
377368 """Produces the sub-matrices of the theory covariance matrix for power
378369 corrections. Sub-matrices correspond to applying power corrected shifts
@@ -399,6 +390,11 @@ def covs_pt_prescrip_pc(
399390 if not (is_excluded_exp or is_included_proc ):
400391 deltas1 = compute_deltas_pc (data_spec1 , pdf , pc_parameters )
401392 deltas2 = compute_deltas_pc (data_spec2 , pdf , pc_parameters )
393+
394+ # Convert deltas1 and deltas2 to the format expected by compute_covs_pt_prescrip
395+ deltas1 = [np .array (deltas1 [shift ]) for shift in sorted (deltas1 .keys ())]
396+ deltas2 = [np .array (deltas2 [shift ]) for shift in sorted (deltas2 .keys ())]
397+
402398 s = compute_covs_pt_prescrip (
403399 point_prescription , exp_name1 , deltas1 , exp_name2 , deltas2
404400 )
0 commit comments