Skip to content
Snippets Groups Projects

Proposed rwalk change

Merged Gregory Ashton requested to merge proposed-rwalk into master
1 file
+ 6
11
Compare changes
  • Side-by-side
  • Inline
@@ -688,7 +688,6 @@ def sample_rwalk_bilby(args):
u_list = []
v_list = []
logl_list = []
max_walk_warning = True
while len(u_list) < nact * act:
@@ -697,7 +696,7 @@ def sample_rwalk_bilby(args):
drhat /= linalg.norm(drhat)
# Scale based on dimensionality.
dr = drhat * rstate.rand()**(1. / n)
dr = drhat * rstate.rand() ** (1.0 / n)
# Transform to proposal distribution.
du = np.dot(axes, dr)
@@ -749,15 +748,11 @@ def sample_rwalk_bilby(args):
# If we've taken too many likelihood evaluations then break
if accept + reject > maxmcmc:
if max_walk_warning:
warnings.warn(
"Hit maximum number of walks {} with accept={}, reject={}, "
"and nfail={} try increasing maxmcmc"
.format(maxmcmc, accept, reject, nfail))
max_walk_warning = False
if accept > 0:
# Break if we are above maxmcmc and have at least one accepted point
break
warnings.warn(
"Hit maximum number of walks {} with accept={}, reject={}, "
"and nfail={} try increasing maxmcmc"
.format(maxmcmc, accept, reject, nfail))
break
# If the act is finite, pick randomly from within the chain
if np.isfinite(act) and int(.5 * nact * act) < len(u_list):
Loading