def chivecfn(theta):
"""A version of lnprobfn that returns the simple uncertainty
normalized residual instead of the log-posterior, for use with
least-squares optimization methods like Levenburg-Marquardt.
"""
lnp_prior = model.prior_product(theta)
if not np.isfinite(lnp_prior):
return -np.infty
# Generate mean model
t1 = time.time()
try:
spec, phot, x = model.mean_model(theta, obs, sps=sps)
except(ValueError):
return -np.infty
d1 = time.time() - t1
chispec = chi_spec(spec, obs)
chiphot = chi_phot(phot, obs)
return np.concatenate([chispec, chiphot])
###
评论列表
文章目录