diff options
author | tlatorre <tlatorre@uchicago.edu> | 2020-10-09 11:31:25 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2020-10-09 11:31:25 -0500 |
commit | 4521e01bd9e6dde09aa1f3ccb4300a47e875c2c1 (patch) | |
tree | fa79407c4564ce2792672878d6834ecc59242ff5 | |
parent | 22f1ead8e6ab663978cadd42819376130037a99c (diff) | |
download | sddm-4521e01bd9e6dde09aa1f3ccb4300a47e875c2c1.tar.gz sddm-4521e01bd9e6dde09aa1f3ccb4300a47e875c2c1.tar.bz2 sddm-4521e01bd9e6dde09aa1f3ccb4300a47e875c2c1.zip |
don't run nlopt before running MCMC
This commit updates the chi2 script to skip minimzing the likelihood
before running the MCMC. The reason for this is that I was occasionally
seeing a linear algebra error about a singular matrix when running the
MCMC with the KDEMove which I suspect is caused by too many points being
in the same place.
-rwxr-xr-x | utils/chi2 | 16 |
1 files changed, 1 insertions, 15 deletions
@@ -366,23 +366,9 @@ def do_fit(data,muon,data_mc,bins,steps,print_nll=False,walkers=100,thin=10): """ nll = make_nll(data,muon,data_mc,bins,print_nll) - x0 = np.array(PRIORS) - opt = nlopt.opt(nlopt.LN_SBPLX, len(x0)) - opt.set_min_objective(nll) - low = np.array(PRIORS_LOW) - high = np.array(PRIORS_HIGH) - opt.set_lower_bounds(low) - opt.set_upper_bounds(high) - opt.set_ftol_abs(1e-2) - opt.set_initial_step([0.01]*len(x0)) - - pos = np.empty((walkers, len(x0)),dtype=np.double) + pos = np.empty((walkers, len(PRIORS)),dtype=np.double) for i in range(pos.shape[0]): pos[i] = truncnorm_scaled(PRIORS_LOW,PRIORS_HIGH,PRIORS,PRIOR_UNCERTAINTIES) - pos[i,:] = np.clip(pos[i,:],low,high) - pos[i] = opt.optimize(pos[i]) - with printoptions(precision=2, suppress=True): - print("pos[%i] = %s, nll = %.2f" % (i, pos[i], opt.last_optimum_value())) nwalkers, ndim = pos.shape |