Skip to content

Commit

Permalink
Added comments in compute_phi2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cmurilochem committed Dec 1, 2023
1 parent 5dba88c commit 08c623f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions n3fit/src/n3fit/vpinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,20 @@ def compute_phi2(n3pdfs, experimental_data):
Returns
-------
sum_phi2: np.float64
sum_phi2: float
Sum of phi2 over all experimental group datasets
"""
sum_phi2 = 0.0
# Loop over `validphys.core.DataGroupSpec` groups
for groupdataset, covmat in experimental_data:
# print(f"Dataset: {groupdataset.name}, Covariant Matrix: {covmat.shape}")
# get experimental (`DataResult`) and theory (`ThPredictionsResult`) predictions
res = results(groupdataset, n3pdfs, covmat, sqrt_covmat(covmat))

# calculate standard chi2 (all_chi2) and chi2 using PDF central values (central_chi2)
chi2 = abs_chi2_data(res)
(phi, _) = phi_data(chi2)

# calculate phi and store phi**2
phi, _ = phi_data(chi2)
sum_phi2 += phi**2

return sum_phi2

0 comments on commit 08c623f

Please sign in to comment.