Documentation for jbiu/

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

astro/

shape_iterative.pro


top source shape_iterative

Astro

result = shape_iterative(pos, radius, masses=masses, r2weight=r2weight, shell=shell, axes=axes, fval=fval, maxit=maxit, verbose=verbose)

Given a 3-dimensional distribution of points, determines the best ellipsoidal shape using particles in an interatively-defined ellipsoid (or ellipsoidal shell) of the same shape.

Return value

The function returns a 3-element array containing the lengths of the principal axes of the ellipse.

Parameters

pos in

An Nx3 array specifying the 3d positions of the N particles that make up the mass distribution.

radius in

Radius at which to compute the shape. For a filled ellipsoid, this is the geometric mean radius of the principal axes that define the outer limits of the ellipsoid; for an ellipsoidal shell, this is the geometric mean radius at the center of the shell.

Keywords

masses in

An N-element vector of the mass of each point. If not specified, all masses are assumed to be unity.

r2weight in

If /R2WEIGHT is specified then particles are downweighted by a factor of 1/r^2 so that all particles have equal effect regardless of radius.

shell in

Use an ellipsoidal shell rather than a filled ellipsoid. The value is the width of the shell.

axes in

An output 3x3 array containing the principal axes. AXES[*,i] is the direction of the i-th principal axis.

fval in

Iterate until the axis ratios and directions of the axes vary by less than FVAL. Default is 0.001.

maxit in

Maximum number of iterations to allow. Default is 20.

verbose in

Print information about each iteration.

Examples

Set up a 1/r^2 ellipsoidal density distribution and find its shape. np = 100000 r = 200 * randomu(seed, np) ph = 2. * !pi * randomu(seed, np) th = acos(randomu(seed, np)) x = 2. * r * cos(ph) * sin(th) y = r * sin(ph) * sin(th) z = 3. * r * cos(th) print, shape_iterative([[x],[y],[z]], 100., axes=axes) print, axes

Author information

History:

Written by: Jeremy Bailin 22 July 2011 Initial release

File attributes

Modification date: Fri Jul 22 15:00:20 2011
Lines: 126