plot/
hist_nd_adaptive.pro
top source hist_nd_adaptive
Plot
result = hist_nd_adaptive(v, bin, min=min, max=max, weight=weight, levelmax=levelmax, nthreshold=nthreshold)
Given a list of particle positions (and optional particle weights), bin sizes, and ranges, creates a density image where the regions with fewer particles are sampled at larger bin sizes. This can be used as a drop-in for HIST_ND_WEIGHT, but it divides by the bin area (or ND-volume).
Return value
Result contains a density map of the points. The map has its highest effective resolution in the regions with the most points, but degrades to factor-of-2 lower resolutions when the number of particles per pixel drops below the threshold.
Parameters
- v in
An NDxN element array of the ND-dimensional positions of the N particles.
- bin in
Size of highest-resolution pixels in output image.
Keywords
- min in
ND-element array of minimum positions in final map. If a scalar, used for all dimensions. Default is the minimum particle position in each dimension.
- max in
ND-element array of maximum positions in final map. If a scalar, used for all dimensions. Default is the maximum particle position in each dimension.
- weight in
Array of weights for each particle.
- levelmax in
Maximum number of lower-density levels to use (0=no smoothing). Default: 4.
- nthreshold in
Minimum number of particles within a pixel before going to the next level. Default: 3.
Examples
n = 100000
positions = 5*randomn(seed, 2, n)
image = hist_nd(positions, 0.5, min=-20, max=20) * 4
smthimage = hist_nd_adaptive(positions, 0.5, min=-20, max=20)
isurface, image, zrange=[0,3], title='Original'
isurface, smthimage, zrange=[0,3], title='Smooth'
Author information
- History:
Written by: Jeremy Bailin 20 June 2011
File attributes
| Modification date: | Wed Jun 29 15:27:21 2011 |
| Lines: | 95 |
![[attach.png]](../idldoc-resources/attach.png)