Skip to content

Commit

Permalink
correct norm
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisrkckl committed Oct 6, 2023
1 parent 10095dd commit 344f611
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pint/residuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,14 @@ def _calc_gls_chi2(self, lognorm=False):
if not lognorm:
return chi2
else:
logdet_N = np.sum(np.log(Nvec))
logdet_Phiinv = np.sum(np.log(phiinv))
logdet_N = np.sum(np.log(np.abs(Nvec)))
logdet_Phiinv = np.sum(np.log(np.abs(phiinv)))
logdet_Sigma = (
np.sum(np.log(np.diag(c[0]))) if not svd else np.sum(np.abs(np.log(s)))
np.sum(np.log(np.abs(np.diag(c[0]))))
if not svd
else np.sum(np.log(np.abs(s)))
)
log_norm = logdet_N + logdet_Phiinv + logdet_Sigma
log_norm = 0.5 * (logdet_N - logdet_Phiinv + logdet_Sigma)
return chi2, log_norm

def calc_chi2(self, lognorm=False):
Expand Down

0 comments on commit 344f611

Please sign in to comment.