Estimating standard deviation of very coarsely binned data

Yes I think that’s the issue. Empty bins when the counts are low or the standard deviation is small. I am forcing it to have counts = 0 instead of non existent rows in the data_to_bincounts function. Hopefully this fixes it.