Skip to content

Instantly share code, notes, and snippets.

@jbwhit
Created March 3, 2014 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbwhit/9325641 to your computer and use it in GitHub Desktop.
Save jbwhit/9325641 to your computer and use it in GitHub Desktop.
Survival function.
from scipy.stats import chi2
def compare_chi2(first, second):
"""Given two dictionaries (usually simulated and actual),
return the survival probability"""
if len(first['J2000']) != len(second['J2000']):
raise Exception
return chi2.sf(np.sum((second['da'] - first['da'])**2 / second['eda']**2.0), len(first['da']) - 1)
average = keck_error.copy()
average['da'] = np.ones_like(average['da'] * np.average(keck_error['da']))
compare_chi2(average, keck_error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment