def pueyo_bins(data):
log_ub = np.ceil(np.log2(np.max(data)))<EOL>bins = <NUM_LIT:2>**np.arange(log_ub + <NUM_LIT:1>)<EOL>binned_data = np.histogram(data, bins=bins)[<NUM_LIT:0>]<EOL>epdf = (<NUM_LIT:1> / bins[:-<NUM_LIT:1>]) * binned_data / len(data)<EOL>return binned_data, epdf<EOL>
Binning method based on Pueyo (2006)

Parameters
----------
data : array-like data
    Data to be binned

Returns
-------
: tuple of arrays
    binned data, empirical probability density

Notes
-----
Bins the data in into bins of length 2**i, i=0, 1, 2 ...
The empirical probability densities will sum to 1 if multiplied by the
respective 2**i.