Created
March 3, 2014 14:08
-
-
Save jbwhit/9325641 to your computer and use it in GitHub Desktop.
Survival function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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