math/
histogram_weight.pro
top source histogram_weight
Math
result = histogram_weight(DATA, bin=bin, weight=weight, reverse_indices=reverse_indices, unweighted=unweighted, _ref_extra=_ref_extra)
Wrapper to the built-in HISTOGRAM function that calculates a weighted histogram.
Return value
The function returns a histogram where each Data value has been weighted by its WEIGHT value. The return type is the same type as WEIGHT.
Parameters
- DATA in
Values whose histogram is to be taken.
Keywords
- bin in
Bin width. Passed through to HISTOGRAM.
- weight in
A vector of the same length as Data with the weights for each data value.
- reverse_indices in
Outputs the reverse index array.
- unweighted in
Outputs the unweighted histogram.
- _ref_extra in
All extra keywords are passed through to HISTOGRAM.
Examples
IDL> values = 0.1*FINDGEN(40)
IDL> PRINT, HISTOGRAM_WEIGHT(values, WEIGHT=VALUES, UNWEIGHTED=plainhist)
4.50000 14.5000 24.5000 34.5000
IDL> PRINT, plainhist
10 10 10 10
Author information
- History:
Written by: Jeremy Bailin 12 June 2008 Public release in JBIU 11 April 2009 Bug fix 8 November 2009 Bug fux for bins with no entries
File attributes
| Modification date: | Sun Nov 8 21:41:51 2009 |
| Lines: | 65 |
![[attach.png]](../idldoc-resources/attach.png)