Here it is. Have fun.

Suggestions are welcome !

David

“”"Class constructor to compute weighted 1-D histogram.

Usage: Histogram(data, bins=10, range=None, weights=None, normed=False)

```
Input parameters
```

histogramc.py (13 KB)

## ···

```
----------------------
data: Input array
bins: Number of bins or the bin array(overides the range).
range: A tuple of two values defining the lower and upper ends of the bin span.
If no argument is given, defaults to (data.min(), data.max()).
weights: Array of weights stating the importance of each data. This array must have the same shape as data.
Methods
-----------
add_data(values, weights): Add values array to existing data and update bin count. This does not modify the histogram bining.
optimize_binning(method): Chooses an optimal number of bin. Available methods are : Freedman, Scott.
score(percentile): Returns interpolated value at given percentile.
cdf(x, method): Return interpolated cdf at x.
Attributes
```

```
freq: The resulting bin count. If normed is true, this is a frequency. If normed is False, then freq is simply the number of data falling into each bin.
cum_freq: The cumulative bin count.
data: Array of data.
weights: Array of weights.
s_data: Array of sorted data.
range : Bin limits : (min, max)
Nbins : Number of bins
bin : The bin array (Nbin + 1)
normed: Normalization factor. Setting it to True will normed the density to 1.
weighted : Boolean indicating whether or not the data is weighted.
"""
```