code: def get_histogram(
          xall, yall, nbins=100,
          weights=None, avoid_zero_count=False):
      
      z, xedge, yedge = _np.histogram2d(
          xall, yall, bins=nbins, weights=weights)
      x = 0.5 * (xedge[:-1] + xedge[1:])
      y = 0.5 * (yedge[:-1] + yedge[1:])
      if avoid_zero_count:
          z = _np.maximum(z, _np.min(z[z.nonzero()]))
      return x, y, z.T
docs: Compute a two-dimensional histogram.
  
      Parameters
      ----------
      xall : ndarray(T)
          Sample x-coordinates.
      yall : ndarray(T)
          Sample y-coordinates.
      nbins : int, optional, default=100
          Number of histogram bins used in each dimension.
      weights : ndarray(T), optional, default=None
          Sample weights; by default all samples have the same weight.
      avoid_zero_count : bool, optional, default=True
          Avoid zero counts by lifting all histogram elements to the
          minimum value before computing the free energy. If False,
          zero histogram counts would yield infinity in the free energy.
  
      Returns
      -------
      x : ndarray(nbins, nbins)
          The bins' x-coordinates in meshgrid format.
      y : ndarray(nbins, nbins)
          The bins' y-coordinates in meshgrid format.
      z : ndarray(nbins, nbins)
          Histogram counts in meshgrid format.