math/
hist_nd_weight.pro
top source hist_nd_weight
Math
result = hist_nd_weight(V, BIN, weight=weight, reverse_indices=reverse_indices, unweighted=unweighted, _extra=_extra)
Wrapper to the dfanning HIST_ND function that calculates a weighted multi-dimensional histogram.
Return value
The function returns a multi-dimensional histogram where each data value has been weighted by its WEIGHT value. The return type is the same type as WEIGHT.
Parameters
- V in
Values whose histogram is to be taken. V should be an NxP array for P points in N dimensions.
- BIN in
Bin size. May either be a scalar, or an N-dimensional vector.
Keywords
- weight in
A vector of the same dimensions as V with the weights for each data value.
- reverse_indices in
Outputs the reverse index array.
- unweighted in
Outputs the unweighted histogram.
- _extra in
All extra keywords are passed through to HIST_ND.
Examples
IDL> q = TRANSPOSE( [ [0.1*FINDGEN(40)], [0.2*FINDGEN(40)] ] )
IDL> PRINT, HIST_ND_WEIGHT(q, 1, WEIGHT=q, UNWEIGHTED=plainhist)
0.500000 0.00000 0.00000 0.00000
2.50000 0.00000 0.00000 0.00000
0.00000 4.00000 0.00000 0.00000
0.00000 6.50000 0.00000 0.00000
0.00000 0.00000 7.50000 0.00000
0.00000 0.00000 10.5000 0.00000
0.00000 0.00000 0.00000 11.0000
0.00000 0.00000 0.00000 14.5000
IDL> PRINT, plainhist
5 0 0 0
5 0 0 0
0 5 0 0
0 5 0 0
0 0 5 0
0 0 5 0
0 0 0 5
0 0 0 5
Author information
- History:
Written by: Jeremy Bailin 12 June 2008 Public release in JBIU 17 June 2011 Bug fix for bins with no entries.
File attributes
| Modification date: | Fri Jun 17 11:45:44 2011 |
| Lines: | 79 |
![[attach.png]](../idldoc-resources/attach.png)