Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calc_chisq not returning same values as my chisq routine #12

Open
paigegiorlagodfrey opened this issue Apr 17, 2016 · 1 comment
Open

Comments

@paigegiorlagodfrey
Copy link
Collaborator

The link to my chi^2 routine: https://github.com/paigegiorlagodfrey/gof_model_fitting/blob/master/chi_squared_fit_routine.py

and the m.redchisq snippet from line 51:
def redchisq(ydata,ymod,deg=2,unc=None):
chisq=0
if unc==None:
chisq=np.sum((ydata-ymod)**2)
else:
diff=ydata-ymod
div=diff/unc
square=(div)**2
chisq=np.sum(square)
return chisq

@stephtdouglas
Copy link
Member

Hey Paige,

Are you normalizing the model at all before you calculate chi squared in your code? If you look at lines 98-107 in calc_chisq (i'd paste them but I'm on a bus with my phone for Internet), I normalize the model to the data before I calculate chi squared. If you don't do that, or use a different method, that may account for at least some of the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants