How to use the mc3.plots.histogram function in mc3

To help you get started, we’ve selected a few mc3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pcubillos / mc3 / tests / test_plots.py View on Github external
def test_histogram(post):
    axes = mp.histogram(post)
github pcubillos / mc3 / mc3 / sampler_driver.py View on Github external
# 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,
                 savefile=fname+"_RMS.png")
          log.msg("'{:s}'".format(fname+"_RMS.png"), indent=2)
      # Sort of guessing that indparams[0] is the X array for data as in y=y(x):
      if (indparams != []
          and isinstance(indparams[0], (list, tuple, np.ndarray))
          and np.size(indparams[0]) == ndata):
          try:
              mp.modelfit(data, uncert, indparams[0], output['best_model'],
                  savefile=fname+"_model.png")