How to use the mc3.stats.residuals 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_stats.py View on Github external
def test_residuals_no_priors():
    data   = np.array([1.1, 1.2, 0.9, 1.0])
    model  = np.array([1.0, 1.0, 1.0, 1.0])
    uncert = np.array([0.1, 0.1, 0.1, 0.1])
    res = ms.residuals(model, data, uncert)
    np.testing.assert_allclose(res, np.array([-1.0, -2.0, 1.0, 0.0]))
github pcubillos / mc3 / tests / test_stats.py View on Github external
def test_residuals():
    data   = np.array([1.1, 1.2, 0.9, 1.0])
    model  = np.array([1.0, 1.0, 1.0, 1.0])
    uncert = np.array([0.1, 0.1, 0.1, 0.1])
    params = np.array([2.5, 5.5])
    priors = np.array([2.0, 5.0])
    plow   = np.array([0.0, 1.0])
    pup    = np.array([0.0, 1.0])
    res = ms.residuals(model, data, uncert, params, priors, plow, pup)
    np.testing.assert_allclose(res, np.array([-1.0, -2.0, 1.0, 0.0, 0.5]))
github pcubillos / mc3 / mc3 / fit_driver.py View on Github external
Returns
  -------
  Array of weighted data-model and prior-params residuals.
  """
  # Update params with fitparams:
  params[ifree] = fitparams

  # Update shared parameters:
  for s in ishare:
      params[s] = params[-int(pstep[s])-1]

  # Compute model:
  model = func(params, *indparams)
  # Calculate residuals:
  residuals = ms.residuals(model, data, uncert, params, prior,
      priorlow, priorup)
  return residuals