def mean(self, histogram, bins):
    """ Given a histogram and the bin widths, calculate the mean for the histogram
        and return it """
    mean_upper = 0
    mean_lower = 0
    for i, binval in enumerate(histogram):
      mean_upper += binval*( (bins[i+1] + bins[i]) % 2 )
      mean_lower += binval 

    mean = mean_upper / mean_lower
    return mean
dataset/ETHPy150Open neurodata/ndstore/scripts/imghist16.py/ImgHist.mean/operator `/` -> `%`