def steady_state_potential(xdata, HistBins=100):
    """
    Calculates the steady state potential. Used in
    fit_radius_from_potentials.

    Parameters
    ----------
    xdata : ndarray
        Position data for a degree of freedom
    HistBins : int
        Number of bins to use for histogram
        of xdata. Number of position points
        at which the potential is calculated.

    Returns
    -------
    position : ndarray
        positions at which potential has been
        calculated
    potential : ndarray
        value of potential at the positions above

    """
    import numpy as _np
    pops = _np.histogram(xdata, HistBins)[0]
    bins = _np.histogram(xdata, HistBins)[1]
    bins = bins[0:-1]
    bins = bins + _np.mean(_np.diff(bins))
    pops = pops / float(_np.sum(pops))
    return bins, -_np.log(pops)
