How to use the mc3.plots.modelfit 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_modelfit():
    indparams = np.linspace(0.0, 1.0, nsamples)
    data = np.random.normal(1.00, 1.0, nsamples)
    uncert = np.random.normal(1.0, 0.1, nsamples)
    model = np.tile(1.0, nsamples)
    axes = mp.modelfit(data, uncert, indparams, model)
github pcubillos / mc3 / mc3 / sampler_driver.py View on Github external
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")
              log.msg("'{:s}'".format(fname+"_model.png"), indent=2)
          except:
              pass

  # Close the log file if necessary:
  if closelog:
      log.msg("'{:s}'".format(log.logname), indent=2)
      log.close()

  return output