SHAPE_ITERATIVE
Name
SHAPE_ITERATIVE
Purpose
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.
Category
Astro
Calling Sequence
Result = SHAPE_ITERATIVE(Pos, Radius)
Inputs
Pos: An Nx3 array specifying the 3d positions of the N particles
that make up the mass distribution.
Radius: 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.
Keyword Parameters
SHELL: Use an ellipsoidal shell rather than a filled ellipsoid. The
value is the width of the shell.
AXES: An output 3x3 array containing the principal axes.
AXES[*,i] is the direction of the i-th principal axis.
MASSES: An N-element vector of the mass of each point. If not
specified, all masses are assumed to be unity.
R2WEIGHT: 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.
FVAL: Iterate until the axis ratios and directions of the axes
vary by less than FVAL. Default is 0.001.
MAXIT: Maximum number of iterations to allow. Default is 20.
VERBOSE: Print information about each iteration.
Outputs
The function returns a 3-element array containing the lengths of the
principal axes of the ellipse.
Example
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
Modification History
Written by: Jeremy Bailin
22 July 2011 Initial release