util/
vis_hist_nd.pro
graphics computation
includes main-level programFind the histogram of a set of n-dimensional points.
Examples
Try:
IDL> q = transpose([[0.1 * findgen(40)], [0.2 * findgen(40)]])
IDL> print, mg_hist_nd(q, bin_size=1, weight=q, unweighted=unweighted)
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, unweighted
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
16 January 2008, written by Michael Galloy.
Code adapted from HIST_ND from David Fanning and HIST_ND_WEIGHT by Jeremy Bailin.
top vis_hist_nd
result = vis_hist_nd(array [, bin_size=numeric] [, nbins=long] [, minimum=float/fltarr(n)] [, maximum=float/fltarr(n)], omin=omin, omax=omax [, reverse_indices=lonarr] [, weights=numeric array] [, unweighted=same as return value] [, /l64])
Find a histogram of a set of n-dimensional points.
Return value
histogram of size n_1 by n_2 by .... by n_n
Parameters
- array in required type=numeric array
array to find histogram of; ndims by npoints array
Keywords
- bin_size in optional type=numeric
the size of bin to use; either an n element vector or a scalar to use for all dimensions; either BIN_SIZE or NBINS must be set
- nbins in optional type=long
the number of bins to use; either an n element vector or a scalar to use for all dimensions; either BIN_SIZE or NBINS must be set
- minimum in optional type=float/fltarr(n) default=min(array, dim
set to either a scalar value to use for the minimum of each dimension or a vector of values; if not specified, will use the natural minimum in each dimension
- maximum in optional type=float/fltarr(n) default=max(array, dim
set to either a scalar value to use for the maximum of each dimension or a vector of values; if not specified, will use the natural maximum in each dimension
- omin
- omax
- reverse_indices out optional type=lonarr
set to a named variable to get 1-dimensional vector representing the indices of the points that fall in a particular bin; to find the indices of the points in bin [i, j, k], use the same formular as when using REVERSE_INDICES with HISTOGRAM (after converting to single dimensional indexing):
See ARRAY_INDICES for converting ind back to 3-dimensional indices.ijk = [i + nx * j + nx * ny * k] ind = ri[ri[ijk]:ri[ijk + 1] - 1]
- weights in optional type=numeric array
array with same dimensions as array containing a weight for each point
- unweighted out optional type=same as return value
set to a named variable to get the unweighted histogram
- l64 in optional type=boolean
set to return long64 results
File attributes
Modification date: | Mon Nov 29 18:32:44 2010 |
Lines: | 211 |
Docformat: | rst rst |