Commit cbe36039 authored by Médéric Boquien's avatar Médéric Boquien

Move the selection of models down as we need to check first if there is any χ².

parent 5aa45567
......@@ -290,16 +290,6 @@ def analysis(idx, obs):
(obs_fluxes[mask_data] - model_fluxes[:, mask_data]) /
obs_errors[mask_data]), axis=1)
# We select only models that have at least 0.1% of the probability of the
# best model to reproduce the observations. It helps eliminating very bad
# models.
maxchi2 = st.chi2.isf(st.chi2.sf(np.min(chi2_), obs_fluxes.size-1)*1e-3,
obs_fluxes.size-1)
wlikely = np.where(chi2_ < maxchi2)
# We use the exponential probability associated with the χ² as
# likelihood function.
likelihood = np.exp(-chi2_[wlikely]/2)
##################################################################
# Variable analysis #
##################################################################
......@@ -313,6 +303,16 @@ def analysis(idx, obs):
print("One possible origin is that models are older than the Universe")
print("--------------------------------------------------------------")
else:
# We select only models that have at least 0.1% of the probability of the
# best model to reproduce the observations. It helps eliminating very bad
# models.
maxchi2 = st.chi2.isf(st.chi2.sf(np.min(chi2_), obs_fluxes.size-1)*1e-3,
obs_fluxes.size-1)
wlikely = np.where(chi2_ < maxchi2)
# We use the exponential probability associated with the χ² as
# likelihood function.
likelihood = np.exp(-chi2_[wlikely]/2)
best_index = chi2_.argmin()
# We compute once again the best sed to obtain its info
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment