class_docstr: A general minimizer for curve fitting and optimization.
class_docstr_tok: ["A","general","minimizer","for","curve","fitting","and","optimization","."]
docstr: Calculate the log-posterior probability.
  
  See the `Minimizer.emcee` method for more details.
  
  Parameters
  ----------
  theta : sequence
      Float parameter values (only those being varied).
  userfcn : callable
      User objective function.
  params : Parameters
      The entire set of Parameters.
  var_names : list
      The names of the parameters that are varying.
  bounds : numpy.ndarray
      Lower and upper bounds of parameters, with shape
      ``(nvarys, 2)``.
  userargs : tuple, optional
      Extra positional arguments required for user objective function.
  userkws : dict, optional
      Extra keyword arguments required for user objective function.
  float_behavior : {'posterior', 'chi2'}, optional
      Specifies meaning of objective when it returns a float. Use
      `'posterior'` if objective function returns a log-posterior
      probability (default) or `'chi2'` if it returns a chi2 value.
  is_weighted : bool, optional
      If `userfcn` returns a vector of residuals then `is_weighted`
      (default is True) specifies if the residuals have been weighted
      by data uncertainties.
  nan_policy : {'raise', 'propagate', 'omit'}, optional
      Specifies action if `userfcn` returns NaN values. Use `'raise'`
      (default) to raise a `ValueError`, `'propagate'` to use values
      as-is, or `'omit'` to filter out the non-finite values.
  
  Returns
  -------
  lnprob : float
      Log posterior probability.
docstr_tok: ["Calculate","the","log-posterior","probability",".","See","the","`","Minimizer.emcee","`","method","for","more","details",".","Parameters","--","--","--","--","--","theta",":","sequence","Float","parameter","values","(","only","those","being","varied",")",".","userfcn",":","callable","User","objective","function",".","params",":","Parameters","The","entire","set","of","Parameters",".","var_names",":","list","The","names","of","the","parameters","that","are","varying",".","bounds",":","numpy.ndarray","Lower","and","upper","bounds","of","parameters",",","with","shape","``","(","nvarys",",","2",")","``",".","userargs",":","tuple",",","optional","Extra","positional","arguments","required","for","user","objective","function",".","userkws",":","dict",",","optional","Extra","keyword","arguments","required","for","user","objective","function",".","float_behavior",":","{","'posterior","'",",","'chi2","'","}",",","optional","Specifies","meaning","of","objective","when","it","returns","a","float",".","Use","`","'posterior","'","`","if","objective","function","returns","a","log-posterior","probability","(","default",")","or","`","'chi2","'","`","if","it","returns","a","chi2","value",".","is_weighted",":","bool",",","optional","If","`","userfcn","`","returns","a","vector","of","residuals","then","`","is_weighted","`","(","default","is","True",")","specifies","if","the","residuals","have","been","weighted","by","data","uncertainties",".","nan_policy",":","{","'raise","'",",","'propagate","'",",","'omit","'","}",",","optional","Specifies","action","if","`","userfcn","`","returns","NaN","values",".","Use","`","'raise","'","`","(","default",")","to","raise","a","`","ValueError","`",",","`","'propagate","'","`","to","use","values","as-is",",","or","`","'omit","'","`","to","filter","out","the","non-finite","values",".","Returns","--","--","--","-","lnprob",":","float","Log","posterior","probability","."]
code: def _lnprob(
      self,
      theta,
      userfcn,
      params,
      var_names,
      bounds,
      userargs=(),
      userkws=None,
      float_behavior="posterior",
      is_weighted=True,
      nan_policy="raise",
  ):
      """Calculate the log-posterior probability.
  
      See the `Minimizer.emcee` method for more details.
  
      Parameters
      ----------
      theta : sequence
          Float parameter values (only those being varied).
      userfcn : callable
          User objective function.
      params : Parameters
          The entire set of Parameters.
      var_names : list
          The names of the parameters that are varying.
      bounds : numpy.ndarray
          Lower and upper bounds of parameters, with shape
          ``(nvarys, 2)``.
      userargs : tuple, optional
          Extra positional arguments required for user objective function.
      userkws : dict, optional
          Extra keyword arguments required for user objective function.
      float_behavior : {'posterior', 'chi2'}, optional
          Specifies meaning of objective when it returns a float. Use
          `'posterior'` if objective function returns a log-posterior
          probability (default) or `'chi2'` if it returns a chi2 value.
      is_weighted : bool, optional
          If `userfcn` returns a vector of residuals then `is_weighted`
          (default is True) specifies if the residuals have been weighted
          by data uncertainties.
      nan_policy : {'raise', 'propagate', 'omit'}, optional
          Specifies action if `userfcn` returns NaN values. Use `'raise'`
          (default) to raise a `ValueError`, `'propagate'` to use values
          as-is, or `'omit'` to filter out the non-finite values.
  
      Returns
      -------
      lnprob : float
          Log posterior probability.
  
      """
      # the comparison has to be done on theta and bounds. DO NOT inject theta
      # values into Parameters, then compare Parameters values to the bounds.
      # Parameters values are clipped to stay within bounds.
      if np.any(theta > bounds[:, 1]) or np.any(theta < bounds[:, 0]):
          return -np.inf
      for name, val in zip(var_names, theta):
          params[name].value = val
      userkwargs = {}
      if userkws is not None:
          userkwargs = userkws
      # update the constraints
      params.update_constraints()
      # now calculate the log-likelihood
      out = userfcn(params, *userargs, **userkwargs)
      self.result.nfev += 1
      if callable(self.iter_cb):
          abort = self.iter_cb(
              params, self.result.nfev, out, *userargs, **userkwargs
          )
          self._abort = self._abort or abort
      if self._abort:
          self.result.residual = out
          self._lastpos = theta
          raise AbortFitException("fit aborted by user.")
      else:
          out = coerce_float64(out, nan_policy=self.nan_policy)
      lnprob = coerce_float64(out, nan_policy=self.nan_policy)
      if len(lnprob) == 0:
          lnprob = np.array([-1.0e100])
      if lnprob.size > 1:
          # objective function returns a vector of residuals
          if "__lnsigma" in params and not is_weighted:
              # marginalise over a constant data uncertainty
              __lnsigma = params["__lnsigma"].value
              c = np.log(2 * np.pi) + 2 * __lnsigma
              lnprob = -0.5 * np.sum(
                  (lnprob / np.exp(__lnsigma)) ** 2 + c
              )
          else:
              lnprob = -0.5 * (lnprob * lnprob).sum()
      else:
          # objective function returns a single value.
          # use float_behaviour to figure out if the value is posterior or chi2
          if float_behavior == "posterior":
              pass
          elif float_behavior == "chi2":
              lnprob *= -0.5
          else:
              raise ValueError(
                  "float_behaviour must be either 'posterior' "
                  "or 'chi2' " + float_behavior
              )
      return lnprob
  
imports: from collections import namedtuple
  from copy import deepcopy
  import inspect
  import multiprocessing
  import numbers
  import warnings
  import numpy
  from scipy.linalg import LinAlgError, inv
  from scipy.optimize import basinhopping
  from scipy.optimize import brute
  from scipy.optimize import differential_evolution
  from scipy.optimize import dual_annealing
  from scipy.optimize import least_squares
  from scipy.optimize import leastsq
  from scipy.optimize import minimize
  from scipy.optimize import shgo
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator
  from scipy.stats import cauchy
  from scipy.stats import norm
  from ._ampgo import ampgo
  from .parameter import Parameter, Parameters
  from .printfuncs import fitreport_html_table
label_desc: Use image node_id 13 for calling the Minimizer obj's underlying member method code with example usage: obj._lnprob(theta, userfcn, params, var_names, bounds, userargs, userkws, float_behavior, is_weighted, nan_policy) and returns: lnprob, unknown