def hist(values, bins, err=False, density=False, **kwargs):
    '\n    really just a wrapper for numpy.histogram\n    '
    if hasattr(bins, '__getitem__'):
        range = (np.nanmin(bins), np.nanmax(bins))
    else:
        range = None
    (hist, x) = np.histogram(values, bins=bins, range=range, density=density, **kwargs)
    if ((err is None) or (err is False)):
        return (hist.astype(np.float), avg(x))
    else:
        return (hist.astype(np.float), avg(x), np.sqrt(hist))
really just a wrapper for numpy.histogram
def hist(values, bins, err=False, density=False, **kwargs):
    '\n    \n    '
    if hasattr(bins, '__getitem__'):
        range = (np.nanmin(bins), np.nanmax(bins))
    else:
        range = None
    (hist, x) = np.histogram(values, bins=bins, range=range, density=density, **kwargs)
    if ((err is None) or (err is False)):
        return (hist.astype(np.float), avg(x))
    else:
        return (hist.astype(np.float), avg(x), np.sqrt(hist))