From 00dacd206e5ff3798b7b34c359dda644e8f767b5 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Sun, 31 May 2020 11:57:35 -0500 Subject: update contamination analysis step size This commit updates the step size used for the MCMC in the contamination analysis to 0.5 times the error returned by scanning near the minimum. I ran some tests and this seemed to be pretty efficient compared to either the full error or 0.1 times the error. I also reduced the number of workers to 10. --- utils/dc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'utils/dc') diff --git a/utils/dc b/utils/dc index 8227e99..b36579e 100755 --- a/utils/dc +++ b/utils/dc @@ -453,7 +453,7 @@ if __name__ == '__main__': #samples = metropolis_hastings(nll,xopt,stepsizes,100000) #print("nll(xopt) = %.2g" % nll(xopt)) - pos = np.empty((100, len(x0)),dtype=np.double) + pos = np.empty((10, len(x0)),dtype=np.double) for i in range(pos.shape[0]): pos[i] = xopt + np.random.randn(len(x0))*stepsizes pos[i,:6] = np.clip(pos[i,:6],EPSILON,1e9) @@ -465,7 +465,7 @@ if __name__ == '__main__': nwalkers, ndim = pos.shape - proposal = get_proposal_func(stepsizes,low,high) + proposal = get_proposal_func(stepsizes*0.5,low,high) sampler = emcee.EnsembleSampler(nwalkers, ndim, lambda x, grad, fill_value: -nll(x,grad,fill_value), moves=emcee.moves.MHMove(proposal),args=[None,np.inf]) with np.errstate(invalid='ignore'): sampler.run_mcmc(pos, args.steps) -- cgit