class_docstr: Class which implements the function minimized by knuth_bin_width
  
  Parameters
  ----------
  data : array-like, one dimension
      data to be histogrammed
  
  Notes
  -----
  the function F is given by
  
  .. math::
      F(M|x,I) = n\log(M) + \log\Gamma(\frac{M}{2})
      - M\log\Gamma(\frac{1}{2})
      - \log\Gamma(\frac{2n+M}{2})
      + \sum_{k=1}^M \log\Gamma(n_k + \frac{1}{2})
  
  where :math:`\Gamma` is the Gamma function, :math:`n` is the number of
  data points, :math:`n_k` is the number of measurements in bin :math:`k`.
  
  See Also
  --------
  knuth_bin_width
  astroML.plotting.hist
docstr: Evaluate the Knuth function
  
  Parameters
  ----------
  dx : float
      Width of bins
  
  Returns
  -------
  F : float
      evaluation of the negative Knuth likelihood function:
      smaller values indicate a better fit.
docstr_tok: ["Evaluate","the","Knuth","function","Parameters","--","--","--","--","--","dx",":","float","Width","of","bins","Returns","--","--","--","-","F",":","float","evaluation","of","the","negative","Knuth","likelihood","function",":","smaller","values","indicate","a","better","fit","."]
code: def eval(self, M):
      """Evaluate the Knuth function
  
      Parameters
      ----------
      dx : float
          Width of bins
  
      Returns
      -------
      F : float
          evaluation of the negative Knuth likelihood function:
          smaller values indicate a better fit.
      """
      M = int(M)
  
      if M <= 0:
          return np.inf
  
      bins = self.bins(M)
      nk, bins = np.histogram(self.data, bins)
  
      return -(
          self.n * np.log(M)
          + gammaln(0.5 * M)
          - M * gammaln(0.5)
          - gammaln(self.n + 0.5 * M)
          + np.sum(gammaln(nk + 0.5))
      )
  
file_path: astroML/astroML/density_estimation/histtools.py
imports: import numpy
  from scipy.special import gammaln
  from astropy import stats
  from astroML.utils import deprecated
  from astroML.utils.exceptions import AstroMLDeprecationWarning
label_desc: Use image node_id 4 for calling the KnuthF obj's underlying member method code with example usage: obj.eval(M) and returns: unknown, np