Commit 5917743b authored by Médéric Boquien's avatar Médéric Boquien
Browse files

Do not crash when all χ² are extremely large.

parent 7439507e
......@@ -13,6 +13,7 @@
- The histogram bin width was not computed optimally when some models were invalid. (David Corre & Médéric Boquien)
- Missing import in the `m2005` module. (Médéric Boquien, reported by Dominika Wylezalek)
- The plot of the PDF could not be generated for physical properties estimated in log (Médéric Boquien)
- We do not attempt anymore to estimate the physical properties of galaxies with insanely large χ² that lead to an underflow in the computation of the likelihood. (Médéric Boquien)
### Optimised
- The estimation of the physical properties is made a bit faster when all the models are valid. (Médéric Boquien)
......@@ -178,7 +178,7 @@ def analysis(idx, obs):
chi2, scaling = compute_chi2(gbl_models, obs, corr_dz, wz,
if np.any(np.isfinite(chi2)):
if np.any(chi2 < -np.log(np.finfo(np.float64).tiny) * 2.):
# We use the exponential probability associated with the χ² as
# likelihood function.
likelihood = np.exp(-chi2 / 2.)
......@@ -222,11 +222,11 @@ def analysis(idx, obs):[idx] = scaling[best_idx_z][idx] = (wz.start + best_idx_z*wz.step +
# It sometimes happens because models are older than the Universe's age
print("No suitable model found for the object {}. One possible origin "
"is that models are older than the Universe.".format(
print("No suitable model found for the object {}. It may be that "
"models are older than the Universe or that your chi² are very "
with gbl_ncomputed.get_lock():
gbl_ncomputed.value += 1
Supports Markdown
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