Skip to content

Commit

Permalink
use a more precise calculation of the chi-squares so that we
Browse files Browse the repository at this point in the history
only square things that supposed to be small
  • Loading branch information
segasai committed Sep 5, 2024
1 parent 161f722 commit 87cabab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion py/rvspecfit/spec_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def get_chisq0(spec, templ, polys, get_coeffs=False, espec=None):
# so I need to invert the matrix1. I can do it using svd
v2 = v.T @ (
(1. / s)[:, None] * u.T) @ vector1 # this is matrix1^(-1) vector1
chisq = -vector1.T @ v2 - ldetI + 2 * logl_z + np.dot(normspec, normspec)
chisq = -ldetI + 2 * logl_z + np.linalg.norm(normspec - v2 @ polys1)**2
if get_coeffs:
coeffs = v2.flatten()
return chisq, coeffs
Expand Down

0 comments on commit 87cabab

Please sign in to comment.