From 08c623f3332e6b43486881ac32bc8ff8a252d1e6 Mon Sep 17 00:00:00 2001 From: Cmurilochem Date: Fri, 1 Dec 2023 17:06:19 +0100 Subject: [PATCH] Added comments in compute_phi2 --- n3fit/src/n3fit/vpinterface.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/n3fit/src/n3fit/vpinterface.py b/n3fit/src/n3fit/vpinterface.py index 42f4a80f05..e60483e628 100644 --- a/n3fit/src/n3fit/vpinterface.py +++ b/n3fit/src/n3fit/vpinterface.py @@ -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