Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_subplotter():
rect = [0.1, 0.1, 0.9, 0.9]
margin = 0.1
ipan = 1
nx = 2
axis = mp.subplotter(rect, margin, ipan, nx)
if savefile is not None:
unpickables = ['dynesty_sampler']
unpickables = np.intersect1d(unpickables, list(output.keys()))
tmp_outputs = {key: output.pop(key) for key in unpickables}
np.savez(savefile, **output)
output.update(tmp_outputs)
log.msg("'{:s}'".format(savefile), indent=2)
if plots:
# Extract filename from savefile or default to sampler:
fname = sampler if savefile is None else os.path.splitext(savefile)[0]
# Include bestp in posterior plots:
best_freepars = output['bestp'][ifree] if showbp else None
# Trace plot:
mp.trace(output['posterior'], zchain=output['zchain'],
burnin=output['burnin'], pnames=texnames[ifree],
savefile=fname+"_trace.png")
log.msg("'{:s}'".format(fname+"_trace.png"), indent=2)
# Pairwise posteriors:
mp.pairwise(posterior, pnames=texnames[ifree], bestp=best_freepars,
savefile=fname+"_pairwise.png")
log.msg("'{:s}'".format(fname+"_pairwise.png"), indent=2)
# Histograms:
mp.histogram(posterior, pnames=texnames[ifree], bestp=best_freepars,
savefile=fname+"_posterior.png",
quantile=0.683, pdf=pdf, xpdf=xpdf)
log.msg("'{:s}'".format(fname+"_posterior.png"), indent=2)
# RMS vs bin size:
if rms:
RMS, RMSlo, RMShi, stderr, bs = ms.time_avg(output['best_model']-data)
mp.rms(bs, RMS, stderr, RMSlo, RMShi, binstep=len(bs)//500+1,