I have set of value in float (always less than 0). Which I want to bin into histogram,
i,e. each bar in histogram contain range of value [0,0.150)

The data I have looks like this:

0.000
0.005
0.124
0.000
0.004
0.000
0.111
0.112


Whith my code below I expect to get result that looks like

[0, 0.005) 5
[0.005, 0.011) 0
...etc..


I tried to do do such binning with this code of mine.
But it doesn't seem to work. What's the right way to do it?

#! /usr/bin/env python


import fileinput, math

log2 = math.log(2)

def getBin(x):
    return int(math.log(x+1)/log2)

diffCounts = [0] * 5

for line in fileinput.input():
    words = line.split()
    diff = float(words[0]) * 1000;

    diffCounts[ str(getBin(diff)) ] += 1

maxdiff = [i for i, c in enumerate(diffCounts) if c &gt; 0][-1]
print maxdiff
maxBin = max(maxdiff)


for i in range(maxBin+1):
     lo = 2**i - 1
     hi = 2**(i+1) - 1
     binStr = '[' + str(lo) + ',' + str(hi) + ')'
     print binStr + '\t' + '\t'.join(map(str, (diffCounts[i])))


~                                                                   


Question: Measure defined in an atypical way
Answer: The gradient is to be understood as a distributional derivative. This is an operation which makes sense on any function that is locally integrable.

As for the Radon-Nikodym Theorem, write $\mu=(\mu_1,\ldots,\mu_n)$. When restricted to a compact set, the components are finite, real measures, so it makes sense to consider the positive, finite measure
$$
|\mu|=\mu_1^++\mu_1^-+\ldots+\mu_n^++\mu_n^-,
$$
where $\mu_j=\mu_j^+-\mu_j^-$ is the Hahn Decomposition of $\mu_j$. It follows that $\mu_j\ll |\mu|$ for all $j$. By the Radon-Nikodym Theorem, there is a function $\nu=(\nu_1,\ldots,\nu_n)$ such that $\mu=\nu \sigma$, where $\sigma=|\mu|$.