[Previous]
[Next]
NAME:
P_CORRELATE
PURPOSE:
This function computes the partial correlation coefficient of a
dependent variable and one particular independent variable when
the effects of all other variables involved are removed.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = P_correlate(X, Y, C)
INPUTS:
X: An n-element vector of type integer, float or double that
specifies the independent variable data.
Y: An n-element vector of type integer, float or double that
specifies the dependent variable data.
C: An array of type integer, float or double that specifies the
independent variable data whose effects are to be removed.
The columns of this two dimensional array correspond to the
n-element vectors of independent variable data.
KEYWORD PARAMETERS:
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
EXAMPLES:
Define the data vectors.
x0 = [64, 71, 53, 67, 55, 58, 77, 57, 56, 51, 76, 68]
x1 = [57, 59, 49, 62, 51, 50, 55, 48, 52, 42, 61, 57]
x2 = [ 8, 10, 6, 11, 8, 7, 10, 9, 10, 6, 12, 9]
Compute the partial correlation of x0 and x1 with the effects of
x2 removed. The result should be 0.533469
result = p_correlate(x0, x1, reform(x2, 1, n_elements(x2)))
Compute the partial correlation of x0 and x2 with the effects of
x1 removed. The result should be 0.334572
result = p_correlate(x0, x2, reform(x1, 1, n_elements(x1)))
Compute the partial correlation of x1 and x2 with the effects of
x0 removed. The result should be 0.457907
result = p_correlate(x1, x2, reform(x0, 1, n_elements(x0)))
REFERENCE:
APPLIED STATISTICS (third edition)
J. Neter, W. Wasserman, G.A. Whitmore
ISBN 0-205-10328-6
CALLS: ***
CORRELATE, REGRESS
CALLED BY:
M_CORRELATE
MODIFICATION HISTORY:
Modified by: GGS, RSI, July 1994
Minor changes to code. New documentation header.
Modified by: GGS, RSI, August 1996
Added DOUBLE keyword.
Modified keyword checking and use of double precision.
CT, RSI, Feb 2003: Completely rewrote to correct formula for
multiple columns. Before it would always return
a positive correlation. Now the sign is correct.
CT, RSI, Jan 2004: Use double precision for internal calculations.
Throw error if REGRESS failed due to matrix inversion.
[Previous]
[Next]
NAME:
PATH_SEP
PURPOSE:
Return the proper file path segment separator character for the
current operating system. This is the character used by
the host operating system for delimiting subdirectory names
in a path specification. Use of this function instead
of hardwiring separators makes code more portable.
CATEGORY:
File Management.
CALLING SEQUENCE:
Result = PATH_SEP()
INPUTS:
None
KEYWORDS:
SEARCH_PATH
If set, PATH_SEP returns the character used to separate entries
in a search path.
PARENT_DIRECTORY
If set, PATH_SEP returns the standard directory notation used
by the host operating system to indicate the parent of a
directory.
OUTPUTS:
The path separator character is returned as a scalar string.
CALLED BY:
CW_FILESEL, DIALOG_READ_IMAGE, FILEPATH, FILE_WHICH, MK_HTML_HELP
ONLINE_HELP_PDF_INDEX, ONLINE_HELP_PDF_ND2FILE, PREF_MIGRATE, RESOLVE_ALL
idlfflangcat__define
COMMON BLOCKS:
None.
MODIFICATION HISTORY:
4 April 2001, AB
[Previous]
[Next]
NAME:
PCOMP
PURPOSE:
This function computes the principal components of an M-column, N-row
array, where M is the number of variables and N is the number of
observations or samples. The principal components of a multivariate
data set may be used to restate the data in terms of derived variables
or may be used to reduce the dimensionality of the data by reducing
the number of variables (columns). The result is an Nvariables-column
(Nvariables <= M), N-row array of derived variables.
CATEGORY:
Statistics
CALLING SEQUENCE:
Result = Pcomp(A)
INPUTS:
A: An M-column, N-row array of type float or double.
KEYWORD PARAMETERS:
COEFFICIENTS: Use this keyword to specify a named variable which
returns the principal components used to compute the
derived variables. The principal components are the
coefficients of the derived variables and are returned
in an M-column, M-row array. The rows of this array
correspond to the coefficients of the derived variables.
The coefficients are scaled so that the sums of their
squares are equal to the eigenvalue from which they are
computed.
COVARIANCE: If set to a non-zero value, the principal components
are computed using the covariances of the original data.
The default is to use the correlations of the original
data to compute the principal components.
DOUBLE: If set to a non-zero value, computations are done in
double precision arithmetic.
EIGENVALUES: Use this keyword to specify a named variable which returns
a 1-column, M-row array of eigenvalues that correspond to
the principal components. The eigenvalues are listed in
descending order.
NVARIABLES: Use this keyword to specify the number of derived variables.
A value of zero, negative values, and values in excess of
the input array's column dimension result in a complete set
(M-columns and N-rows) of derived variables.
STANDARDIZE: If set to a non-zero value, the variables (the columns) of
the input array are converted to standardized variables;
variables with a mean of zero and variance of one.
VARIANCES: Use this keyword to specify a named variable which returns
a 1-column, M-row array of variances. The variances corr-
espond to the percentage of the total variance for each
derived variable.
CALLS: ***
CORRELATE, EIGENQL, STANDARDVAR, TRACE
EXAMPLE:
MODIFICATION HISTORY:
Written by: GGS, RSI, February 1996
RJF, RSI, June 1998 - Added protection for the
case where the Coefficients keyword
was not specified.
CT, RSI, Nov 2001: Make copy of Array so values don't
change with /STANDARDIZE.
[Previous]
[Next]
NAME:
Plot_3dbox
PURPOSE:
This procedure plots data in a 3-dimensional box, with options
to have the data displayed on the walls surrounding the plot area.
CATEGORY:
Plotting, Three-dimensional
CALLING SEQUENCE:
Plot_3dbox, X, Y, Z
INPUTS:
X: A one dimensional array that contains the X coordinats
Y: A one dimensional array that contains the Y coordinates
Z: A one dimensional array that contains the Z coordinates
OPTIONAL INPUTS:
None.
KEYWORD PARAMETERS:
COLOR: The color for the Grid and Lines or the Color
for the box walls when the keyword SOLID_WALLS
is set.
BACKGROUND: The background color of the plot or the color
of the Grid and Plot data when the SOLID_WALLS
keyword is set.
XY_PLANE: Setting this keyword will cause the X and Y values
of the data to be plotted on the Z=0 axis plane.
XZ_PLANE: Setting this keyword will cause the X and Z values
of the data to be plotted on the Y=Ymax axis plane.
YZ_PLANE: Setting this keyword will cause the Y and Z values
of the data to be plotted on the X=Xmax axis plane.
SOLID_WALLS: Setting this keyword causes the axis "walls" of
the plot box to be filled with the value of COLOR.
PSYM: The plotting symbol that the data is draw with.
GRIDSTYLE: Set this keyword to the linestyle that will be
used in drawing the gridlines.
TITLE: Set this keyword to the Main plot title
XTITLE: Set this keyword to the X axis title.
YTITLE: Set this keyword to the Y axis title.
ZTITLE: Set this keyword to the Z axis title.
SUBTITLE: Set this keyword to the Sub-Title
LINESTYLE: The linestyle used to plot the data.
XYSTYLE: The linesytle used to draw the plot in the XY plane.
If this keyword is not set, the value of LINESTYLE
is used.
XZSTYLE: The linesytle used to draw the plot in the XZ plane.
If this keyword is not set, the value of LINESTYLE
is used.
YZSTYLE: The linesytle used to draw the plot in the YZ plane.
If this keyword is not set, the value of LINESTYLE
is used.
Surface All other keywords available to SURFACE are also
Keywords: used by this procedure.
OUTPUTS:
None.
OPTIONAL OUTPUTS:
None.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Plotting on the current device is performed.
RESTRICTIONS:
None.
PROCEDURE:
Straightforward. Unrecognized keywords are passed to the SURFACE
procedure.
EXAMPLE:
Create some data that can be passed to Plot_3dbox
x = Replicate(5., 10)
x1 = cos(findgen(36)*10.*!dtor)*2.+5.
x=[x,x1,x]
y = findgen(56)
z = Replicate(5., 10)
z1 =sin(findgen(36)*10.*!dtor)*2.+5.
z=[z,z1,z]
; Plot this data in a "plot box"
Plot_3dbox, X, Y, Z, /XY_PLANE, /YZ_PLANE, /XZ_PLANE, $
/SOLID_WALLS, GRIDSTYLE=1, XYSTYLE=3, XZSTYLE=4, $
YZSTYLE=5, AZ=40, TITLE="Example Plot Box", $
Xtitle="X Coodinate", Ytitle="Y Coodinate", $
Ztitle="Z Coodinate", SubTitle="Sub Title", $
/YSTYLE, ZRANGE=[0,10], XRANGE=[0,10],Charsize=1.6
; Then to plot symbols on the locations of the above plot
plots, X, Y, Z, /T3D, PSYM=4, COLOR=!p.background
MODIFICATION HISTORY:
6/94 KDB, RSI - Initial Coding and Testing
[Previous]
[Next]
NAME:
PLOT_FIELD
PURPOSE:
This procedure plots a 2-dimensional field.
CATEGORY:
Plotting, two-dimensional.
CALLING SEQUENCE:
PLOT_FIELD, U, V
INPUTS:
U: The 2-dimensional array giving the field vector at each
point in the U[X] direction.
V: The 2-dimensional array giving the field vector at each
point in the V[Y] direction.
KEYWORD PARAMETERS:
N: The number of arrows to draw. The default is 200.
LENGTH: The length of the longest field vector expressed as a fraction
of the plotting area. The default is 0.1.
ASPECT: The aspect ratio of the plot (i.e., the ratio of the X size
to Y size). The default is 1.0.
TITLE: The title of plot. The default is "Velocity Field".
OUTPUTS:
No explicit outputs.
CALLS: ***
PLOT_FIELD__ARRHEAD, PLOT_FIELD__ARROWS, PLOT_FIELD__MYBI
SIDE EFFECTS:
A new plot is drawn to the current output device.
PROCEDURE:
N random points are picked, and from each point a path is traced
along the field. The length of the path is proportional to "LENGTH"
and the field vector magnitude.
EXAMPLE:
X = FINDGEN(20, 20) ; Create array X
Y = FINDGEN(20, 20)*3 ; Create array Y
PLOT_FIELD, X, Y ; Create plot
MODIFICATION HISTORY:
Jan., 1988 Neal Hurlburt, University of Colorado.
[Previous]
[Next]
NAME:
PLOTERR
PURPOSE:
Plot data points with accompanying error bars.
(See also OPLOTERR.)
CATEGORY:
Plotting, two-dimensional.
CALLING SEQUENCE:
PLOTERR, [ X ,] Y , Err [, PSYM = Psym] [, TYPE = Type]
INPUTS:
X: The array of abcissae.
Y: The array of Y values.
Err: The array of error-bar values.
OPTIONAL KEYWORD PARAMETERS:
PSYM: The plotting symbol to use. The default is +7.
TYPE: The type of plot to be produced. The possible types are:
TYPE = 0 : X Linear - Y Linear (default)
TYPE = 1 : X Linear - Y Log
TYPE = 2 : X Log - Y Linear
TYPE = 3 : X Log - Y Log
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Arrays cannot be of type string. There must be enough points to
plot.
PROCEDURE:
A plot of X versus Y with error bars drawn from Y - ERR to Y + ERR
is written to the output device.
MODIFICATION HISTORY:
William Thompson Applied Research Corporation
July, 1986 8201 Corporate Drive
Landover, MD 20785
DMS, April, 1989 Modified for Unix.
[Previous]
[Next]
NAME:
PNT_LINE
PURPOSE:
This function returns the perpendicular distance between the
point P0 and the line between points L0 and L1.
CATEGORY:
Geometry.
CALLING SEQUENCE:
Result = PNT_LINE(P0, L0, L1 [, Pl])
INPUTS:
P0: The location of the point. P0 may have 2 to N elements,
for N dimensions.
L0: One end-point of the line. L0 must have same number of
elements as P0.
L1: The other end-point of the line. L1 must have the same
number of elements as LO.
KEYWORD PARAMETERS:
INTERVAL: If set, and if the point on the line between L0
and L1 that is closest to PO is not within the
interval [L0, L1], causes the function to return
the distance from P0 to the closer of the two
endpoints L0 and L1.
OUTPUTS:
This function returns the distance from point P0 to the line
between L0 and L1, unless the closest point on the line is
not in the interval [L0, L1] and the keyword INTERVAL is set.
In this case, the function returns the distance between P0
and the closer of the two end-points.
OPTIONAL OUTPUTS:
Pl: The point on the line between L0 and L1 that is closest to P0.
Pl is not necessarily in the interval [L0, L1].
RESTRICTIONS:
This function is limited by the machine accuracy of single
precision floating point.
PROCEDURE:
Solve equations of perpendicular, etc.
EXAMPLE:
To print the distance between the point (2,3) and the line
from (-3,3) to (5,12), and also the location of the point on
the line closest to (2,3), enter the following command:
PRINT, PNT_LINE([2,3], [-3,3], [5,12], Pl), Pl
MODIFICATION HISTORY:
DMS, RSI, Jan, 1993. Written.
[Previous]
[Next]
NAME:
POLAR_CONTOUR
PURPOSE:
Produce a contour plot from data in polar coordinates.
Data may be in a regular or scattered grid.
CATEGORY:
Graphics.
CALLING SEQUENCE:
POLAR_CONTOUR, Z, Theta, R
INPUTS:
Z = data values. If regulary gridded, Z must have dimensions of
(NTheta, NR).
Theta = values of theta in radians. For the regular grid, Theta
must have the same number of elements as the first dimension
of Z. For the scattered grid, Theta must have the same number
of elements as Z.
R = values of radius. For the regular grid, R
must have the same number of elements as the second dimension
of Z. For the scattered grid, R must have the same number
of elements as Z.
KEYWORD PARAMETERS:
SHOW_TRIANGULATION = color. If set, the triangulation connecting
the data points is overplotted in the designated color.
DITHER = dither the input points by a small amount (1 part in
10^5) to avoid ambiguous triangulations. Regular
grids frequently make ambiguous triangulations, making
this keyword necessary.
Also, most of the keywords accepted by CONTOUR may be specified.
Keywords associated with contour following, such as FOLLOW,
PATH_xxx, and C_LABELS, are not accepted.
OUTPUTS:
A contour plot is produced.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Plot is produced on the current graphics output device.
RESTRICTIONS:
None.
PROCEDURE:
The cartesian coordinates of each point are calculated.
TRIANGULATE is called to grid the data into triangles.
CONTOUR is called to produce the contours from the triangles.
EXAMPLE:
Example with regular grid:
nr = 12 ;# of radii
nt = 18 ;# of thetas
r = findgen(nr) / (nr-1) ;Form r and Theta vectors
theta = 2 * !pi * findgen(nt) / (nt-1)
z = cos(theta*3) # (r-.5)^2 ;Fake function value
tek_color
Create filled contours:
Polar_Contour, z, theta, r, /fill, c_color=[2,3,4,5]
Example with random (scattered) grid:
n = 200
r = randomu(seed, n) ;N random r's and Theta's
theta = 2*!pi * randomu(seed, n)
x = cos(theta) * r ;Make a function to plot
y = sin(theta) * r
z = x^2 - 2*y
Polar_Contour, z, theta, r, Nlevels=10, xrange=[0,1], yrange=[0,1]
MODIFICATION HISTORY:
Written by: Your name here, Date.
January, 1995. DMS, RSI.
AB, 5/4/2001, Switch from using _EXTRA to _STRICT_EXTRA, so that
incorrect keywords will cause issue proper messages to
be issued instead of being silently ignored.
[Previous]
[Next]
NAME:
POLAR_SURFACE
PURPOSE:
This function interpolates a surface from polar coordinates
(R, Theta, Z) to rectangular coordinates (X, Y, Z).
CATEGORY:
Gridding.
CALLING SEQUENCE:
Result = POLAR_SURFACE(Z, R, Theta)
INPUTS:
Z: An array containing the surface value at each point.
If the data are regularly gridded (GRID=1) in R and
Theta, Z is a two dimensional array, where Z[i,j] has a
radius of R[i] and an azimuth of Theta[j]. If GRID is
not set, R[i] and Theta[i] contain the radius and azimuth
of each Z[i].
R: The radius. If GRID is set, Z[i,j] has a radius of R[i].
If GRID is not set, R must have the same number of elements
as Z, and contains the radius of each point.
Theta: The azimuth, in radians. If GRID is set, Z[i,j] has an
azimuth of Theta[j]. If GRID is not set, Theta must
have the same number of elements as Z, and contains
the azimuth of each point.
KEYWORD PARAMETERS:
GRID: Set GRID to indicate that Z is regularly gridded in R
and Theta.
SPACING: A two element vector containing the desired grid spacing
of the resulting array in X and Y. If omitted, the grid
will be approximately 51 by 51.
BOUNDS: A four element vector, [X0, Y0, X1, Y1], containing the
limits of the XY grid of the resulting array. If omitted,
the extent of input data sets the limits of the grid.
QUINTIC: If set, the function uses quintic interpolation, which is
slower but smoother than the default linear interpolation.
MISSING: A value to use for areas within the grid but not within
the convex hull of the data points. The default is 0.0.
OUTPUTS:
This function returns a two-dimensional array of the same type as Z.
PROCEDURE:
First, each data point is transformed to (X, Y, Z). Then
the TRIANGULATE and TRIGRID procedures are used to interpolate
the surface over the rectangular grid.
EXAMPLE:
r = findgen(50) / 50. ;Radius
theta = findgen(50) * (2 * !pi / 50.) ;Theta
z = r # sin(theta) ;Make a function (tilted circle)
SURFACE, POLAR_SURFACE(z, r, theta, /GRID) ;Show it
MODIFICATION HISTORY:
DMS Sept, 1992 Written
[Previous]
[Next]
NAME:
POLY
PURPOSE:
Evaluate a polynomial function of a variable.
CATEGORY:
C1 - Operations on polynomials.
CALLING SEQUENCE:
Result = POLY(X,C)
INPUTS:
X: The variable. This value can be a scalar, vector or array.
C: The vector of polynomial coefficients. The degree of
of the polynomial is N_ELEMENTS(C) - 1.
OUTPUTS:
POLY returns a result equal to:
C[0] + c[1] * X + c[2]*x^2 + ...
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
PROCEDURE:
Straightforward.
MODIFICATION HISTORY:
DMS, Written, January, 1983.
CT, RSI, Nov 2004: Special case for zero-order polynomial.
Be sure to still return an array.
[Previous]
[Next]
NAME:
POLY_AREA
PURPOSE:
Return the area of a polygon given the coordinates
of its vertices.
CATEGORY:
Analytical Geometry
CALLING SEQUENCE:
Result = POLY_AREA(X, Y)
INPUTS:
It is assumed that the polygon has N vertices with N sides
and the edges connect the vertices in the order:
[(x1,y1), (x2,y2), ..., (xn,yn), (x1,y1)].
i.e. the last vertex is connected to the first vertex.
X: An N-element vector of X coordinate locations for the vertices.
Y: An N-element vector of Y coordinate locations for the vertices.
Keyword Inputs:
SIGNED = If set, returned a signed area. Polygons with edges
listed in counterclockwise order have a positive area, while those
traversed in the clockwise direction have a negative area.
DOUBLE = Set this keyword to force the computation to be done using
double-precision arithmetic.
OUTPUTS:
POLY_AREA returns the area of the polygon. This value is
positive, unless the SIGNED keyword is set and the polygon is
in clockwise order.
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
PROCEDURE:
The area is computed as:
Area = 1/2 * [ x1y2 + x2y3 + x3y4 +...+x(n-1)yn + xny1
- y1x2 - y2x3 -...-y(n-1)xn - ynx1)
MODIFICATION HISTORY:
DMS, July, 1984.
DMS, Aug, 1996, Added SIGNED keyword.
CT, Nov 2000, Add DOUBLE keyword, subtract offsets to improve accuracy.
[Previous]
[Next]
NAME:
POLY_FIT
PURPOSE:
Perform a least-square polynomial fit with optional error estimates.
This routine uses matrix inversion. A newer version of this routine,
SVDFIT, uses Singular Value Decomposition. The SVD technique is more
flexible, but slower.
CATEGORY:
Curve fitting.
CALLING SEQUENCE:
Result = POLY_FIT(X, Y, Degree)
INPUTS:
X: The independent variable vector.
Y: The dependent variable vector, should be same length as x.
Degree: The degree of the polynomial to fit.
OUTPUTS:
POLY_FIT returns a vector of coefficients with a length of NDegree+1.
KEYWORDS:
CHISQ: Sum of squared errors divided by MEASURE_ERRORS if specified.
COVAR: Covariance matrix of the coefficients.
DOUBLE: if set, force computations to be in double precision.
MEASURE_ERRORS: Set this keyword to a vector containing standard
measurement errors for each point Y[i]. This vector must be the same
length as X and Y.
Note - For Gaussian errors (e.g. instrumental uncertainties),
MEASURE_ERRORS should be set to the standard
deviations of each point in Y. For Poisson or statistical weighting
MEASURE_ERRORS should be set to sqrt(Y).
SIGMA: The 1-sigma error estimates of the returned parameters.
Note: if MEASURE_ERRORS is omitted, then you are assuming that
your model is correct. In this case, SIGMA is multiplied
by SQRT(CHISQ/(N-M)), where N is the number of points
in X and M is the number of terms in the fitting function.
See section 15.2 of Numerical Recipes in C (2nd ed) for details.
STATUS = Set this keyword to a named variable to receive the status
of the operation. Possible status values are:
0 for successful completion, 1 for a singular array (which
indicates that the inversion is invalid), and 2 which is a
warning that a small pivot element was used and that significant
accuracy was probably lost.
Note: if STATUS is not specified then any error messages will be output
to the screen.
YBAND: 1 standard deviation error estimate for each point.
YERROR: The standard error between YFIT and Y.
YFIT: Vector of calculated Y's. These values have an error
of + or - YBAND.
CALLED BY:
GAUSSFIT, idlitopcurvefitting__define
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
MODIFICATION HISTORY:
Written by: George Lawrence, LASP, University of Colorado,
December, 1981.
Adapted to VAX IDL by: David Stern, Jan, 1982.
Modified: GGS, RSI, March 1996
Corrected a condition which explicitly converted all
internal variables to single-precision float.
Added support for double-precision inputs.
Added a check for singular array inversion.
SVP, RSI, June 1996
Changed A to Corrm to match IDL5.0 docs.
S. Lett, RSI, December 1997
Changed inversion status check to check only for
numerically singular matrix.
S. Lett, RSI, March 1998
Initialize local copy of the independent variable
to be of type DOUBLE when working in double precision.
CT, RSI, March 2000: Changed to call POLYFITW.
CT, RSI, July-Aug 2000: Removed call to POLYFITW,
added MEASURE_ERRORS keyword,
added all other keywords (except DOUBLE),
made output arguments obsolete.
CT, RSI, Jan 2003: Combine some vector math expressions,
general code cleanup. About 50% faster.
[Previous]
[Next]
NAME:
POLYWARP
PURPOSE:
Perform polynomial spatial warping.
Using least squares estimation, determine the coefficients Kx[i,j]
and Ky[i,j] of the polynomial functions:
Xi = sum over i and j of: Kx[i,j] * Xo^j * Yo^i
Yi = sum over i and j of: Ky[i,j] * Xo^j * Yo^i
Kx and Ky can be used as inputs P and Q to the built-in function
POLY_2D.
CATEGORY:
Image processing.
CALLING SEQUENCE:
POLYWARP, Xi, Yi, Xo, Yo, Degree, Kx, Ky
INPUTS:
Xi, Yi: The vectors of x,y coordinates to be fit as a function
of Xo and Yo.
Xo, Yo: The vectors of x,y independent coordinates. These vectors
must have the same number of elements as Xi and Yi.
Degree: The degree of the fit. The number of coordinate pairs must be
greater than or equal to (Degree+1)^2.
OUTPUTS:
Kx: The array of coefficients for Xi as a function of (xo,yo).
This parameter is returned as a (Degree+1) by (Degree+1)
element array.
Ky: The array of coefficients for yi. This parameter is returned
as a (Degree+1) by (Degree+1) element array.
CALLED BY:
SHOW3
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
None.
PROCEDURE:
See: Computer Image Processing and Recognition, Ernest L. Hall,
Academic Press, 1979, Pages 186-188.
Xi and Yi are expressed as polynomials of Xo, Yo:
Xi = Kx[i,j] * Xo^j * Yo^i Summed for i,j = 0 to degree.
And
Yi = Ky[i,j] * Xo^j * Yo^i.
This coordinate transformation may be then used to
map from Xo, Yo coordinates into Xi, Yi coordinates.
EXAMPLE:
The following example shows how to display an image and warp it
using the POLYWARP and POLY_2D routines.
Create and display the original image by entering:
A = BYTSCL(SIN(DIST(250)))
TVSCL, A
Now set up the Xi's and Yi's. Enter:
XI = [24, 35, 102, 92]
YI = [81, 24, 25, 92]
Enter the Xo's and Yo's:
XO = [61, 62, 143, 133]
YO = [89, 34, 38, 105]
Run POLYWARP to obtain a Kx and Ky:
POLYWARP, XI, YI, XO, YO, 1, KX, KY
Create a warped image based on Kx and Ky with POLY_2D:
B = POLY_2D(A, KX, KY)
Display the new image:
TV, B
MODIFICATION HISTORY:
DMS, RSI, Dec, 1983.
[Previous]
[Next]
NAME:
POPD
PURPOSE:
Change the current working directory to the directory
saved on the top of the directory stack maintained
by the PUSHD and POPD User Library procedures. This top entry
is then removed.
CALLING SEQUENCE:
POPD
SIDE EFFECTS:
The top entry of the directory stack is removed.
RESTRICTIONS:
Popping a directory from an empty stack causes a warning
message to be printed. The current directory is not changed
in this case.
COMMON BLOCKS:
DIR_STACK: Contains the stack.
MODIFICATION HISTORY:
17, July, 1989, Written by AB, RSI.
[Previous]
[Next]
NAME:
PREF_MIGRATE
PURPOSE:
A graphical interface to the PREF_SET and PREF_COMMIT routines
designed to ease the migration of IDL user preferences between
IDL versions.
CATEGORY:
User Preferences
CALLING SEQUENCE:
PREF_MIGRATE
INPUTS:
None.
KEYWORDS:
MACRO: If set, the migration process only migrates Idlde macros.
This option is only allowed under Microsoft Windows, as it
has no meaning to the Motif/Unix version of the Idlde.
PREFERENCE: If set, the migration process only migrates Idlde
preferences, and not macros. This option only has meaning
when running under Microsoft Windows. It is quietly ignored
on other platforms.
STARTUP: Intended for internal use by IDL. At startup, if IDL
determines that the user does not have a user preference
file, it runs PREF_MIGRATE with the STARTUP keyword set
prior to running the startup file (if any) or prompting the
user for input. STARTUP mode differs from a regular call
in a few ways:
- Since the user didn't explicitly run us, we use
a dialog to explain ourselves and ask their permission
to continue before moving into the main application.
- We block in XMANAGER so any changes we make will
be in effect when the startup file runs and the user
is able to enter commands.
OUTPUTS:
None.
CALLS: ***
CW_BGROUP, PATH_SEP, PREF_MIGRATE_CENTER_BBASE, PREF_MIGRATE_DISPLAY_ERROR
PREF_MIGRATE_EVENT, PREF_MIGRATE_HELP, PREF_MIGRATE_MARK
PREF_MIGRATE_NOT_POSSIBLE, PREF_MIGRATE_OK, PREF_MIGRATE_READ_DATA
PREF_MIGRATE_SET_CURRENT, REVERSE, WDE_IMPORT_MACROS, XDISPLAYFILE, XMANAGER
XREGISTERED
COMMON BLOCKS:
None.
SIDE EFFECTS:
Importing preferences can cause IDL's behavior to change, as specified
by those preferences.
RESTRICTIONS:
None
MODIFICATION HISTORY:
4 May 2004, Written by AB, RSI.
[Previous]
[Next]
NAME:
PRIMES
PURPOSE:
This function computes the first K prime numbers. The result is a
K-element vector of type long integer.
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = Primes(K)
INPUTS:
K: A scalar of type integer or long integer that specifies the
number of primes to be computed.
EXAMPLE:
Compute the first 25 prime numbers.
result = primes(25)
The result should be:
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, $
53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
REFERENCE:
PROBABILITY and STATISTICS for ENGINEERS and SCIENTISTS (3rd edition)
Ronald E. Walpole & Raymond H. Myers
ISBN 0-02-424170-9
MODIFICATION HISTORY:
Written by: GGS, RSI, November 1994
S. Lett, RSI, December 1997, added support for k=1
[Previous]
[Next]
NAME:
PRINTD
PURPOSE:
Display the contents of the directory stack maintained by the
PUSHD and POPD User Library procedures.
CALLING SEQUENCE:
PRINTD
OUTPUTS:
PRINTD lists the contents of the directory stack on the default
output device.
COMMON BLOCKS:
DIR_STACK: Contains the stack.
MODIFICATION HISTORY:
17, July, 1989, Written by AB, RSI.
[Previous]
[Next]
NAME:
PROFILE
PURPOSE:
Extract a profile from an image.
CATEGORY:
Image processing.
CALLING SEQUENCE:
Result = PROFILE(Image, XX, YY)
INPUTS:
Image: The data array representing the image. This array can be
of any type except complex.
KEYWORD PARAMETERS:
XSTART: The starting X location of the lower-left corner of Image.
If this keyword is not specified, 0 is assumed.
YSTART: The starting Y location of the lower-left corner of Image.
If this keyword is not specified, 0 is assumed.
NONMARK: Set this keyword to inhibit marking the image with the
profile line.
OUTPUTS:
PROFILE returns a floating-point vector containing the values of
the image along the profile line marked by the user.
OPTIONAL OUTPUTS:
XX: After picking the end points, XX contains the X coordinates
of the points along the selected profile.
YY: After picking the end points, YY contains the Y coordinates
of the points along the selected profile.
COMMON BLOCKS:
None.
SIDE EFFECTS:
Cursor on image display is enabled.
RESTRICTIONS:
None.
PROCEDURE:
Allow the operator to mark two points on the
image display with the joystick. Extract and
return the points along the line. Optionally
return the X and Y values of each extracted point.
EXAMPLE:
Display an image, select a profile and plot that profile in a new
window. Create and display an image by entering:
A = BYTSCL(DIST(256))
TV, A
Extract a profile from the image. Enter the following command and
mark two points on the image with the mouse:
R = PROFILE(A)
Create a new plotting window and plot the profile by entering:
WINDOW, /FREE
PLOT, R
An interactive version of this routine is available with the User
Library procedure PROFILES.
MODIFICATION HISTORY:
Written, DMS, November, 1982.
Modified for Sun, march, 1988.
December 1991, KRC Made PROFILES return XX and YY.
Modified: GGS, June 1996 OPTIONAL OUTPUTS: XX and YY are type long.
[Previous]
[Next]
NAME:
PROFILES
PURPOSE:
Interactively draw row or column profiles of an image in a separate
window.
CATEGORY:
Image analysis.
CALLING SEQUENCE:
PROFILES, Image [, SX = sx, SY = sy]
INPUTS:
Image: The variable that represents the image displayed in current
window. This data need not be scaled into bytes.
The profile graphs are made from this array.
KEYWORD PARAMETERS:
SX: Starting X position of the image in the window. If this
keyword is omitted, 0 is assumed.
SY: Starting Y position of the image in the window. If this
keyword is omitted, 0 is assumed.
WSIZE: The size of the PROFILES window as a fraction or multiple
of 640 by 512.
ORDER: Set this keyword param to 1 for images written top down or
0 for bottom up. Default is the current value of !ORDER.
OUTPUTS:
No explicit outputs.
COMMON BLOCKS:
None.
SIDE EFFECTS:
A new window is created and used for the profiles. When done,
the new window is deleted.
RESTRICTIONS:
None.
PROCEDURE:
A new window is created and the mouse location in the original
window is used to plot profiles in the new window. Pressing the
left mouse button toggles between row and column profiles.
The right mouse button exits.
EXAMPLE:
Create and display an image and use the PROFILES routine on it.
Create and display the image by entering:
A = BYTSCL(DIST(256))
TV, A
Run the PROFILES routine by entering:
PROFILES, A
The PROFILES window should appear. Move the cursor over the original
image to see the profile at the cursor position. Press the left mouse
button to toggle between row and column profiles. Press the right
mouse button (with the cursor over the original image) to exit the
routine.
MODIFICATION HISTORY:
DMS, Nov, 1988.
[Previous]
[Next]
NAME:
PROJECT_VOL
PURPOSE:
This function returns a two dimensional image that is the
projection of a 3-D volume of data onto a plane (similar to an
X-ray). The returned image is a translucent rendering of the
volume (the highest data values within the volume show up as the
brightest regions in the returned image). Depth queing and
opacity may be used to affect the image. The volume is
projected using a 4x4 matrix, so any type of projection may
be used including perspective. Typically the system viewing
matrix (!P.T) is used as the 4x4 matrix.
Also, see the intrinsic procedure VOXEL_PROJ which performs many
of the same functions as this routine. VOXEL_PROJ provides the
RGBO rendering method. VOXEL_PROJ is faster, but it does not
allow for perspective projections.
PROJECT_VOL can combine the contents of the Z-buffer with the
projection when the Z_BUFFER keyword is set. PROJECT_VOL will not,
however, modify the contents of the Z-buffer.
CATEGORY:
Volume Rendering.
CALLING SEQUENCE:
Image = PROJECT_VOL(Vol, X_sample, Y_sample, Z_sample)
INPUTS:
Vol: The three dimensional volume of data to project.
Data type : Any 3-D array except string or structure.
X_sample: The number of rays to project along the X dimension
of the image. (The returned image will have the
dimensions X_sample by Y_sample).
Data type : Long.
Y_sample: The number of rays to project along the Y dimension
of the image.
Data type : Long.
Z_sample: The number of samples to take along each ray.
Higher values for X_sample, Y_sample, and Z_sample
increase the image resolution as well as execution time.
Data type : Long.
KEYWORD PARAMETERS:
AVG_INTENSITY:
If set, then the average intensity method of projection
is used. The default is a maximum intensity projection.
This keyword only has effect when NOT using the Z-buffer.
CUBIC: If set, then the cubic method of interpolation is used.
The default is a bilinear interpolation.
DEPTH_Q: Set this keyword to indicate that the image should be
created using depth queing. The depth queing should
be a single floating point value (between 0.0 and 1.0).
This value specifies the brightness of the farthest
regions of the volume relative to the closest regions
of the volume. A value of 0.0 will cause the back
side of the volume to be completely blacked out,
while a value of 1.0 indicates that the back side
will show up just as bright as the front side.
The default is 1.0 (indicating no depth queing).
Data type : Float.
OPAQUE: A 3-D array with the same size and dimensions as Vol.
This array specifies the opacity of each cell in the
volume. Opaque values of 0 allow all light to
pass through. Opaque values are cumulative.
For example, if a ray eminates from a data value of 50,
and then passes through 10 opaque cells (each with a
data value of 0 and an opacity value of 5) then that
ray would be completely blocked out (the cell with the
data value of 50 would be invisible on the returned
image). The default is no opacity.
Data type : Any 3-D array except string or structure
(usually the same type as Vol).
TRANS: A 4x4 floating point array to use as the
transformation matrix when projecting the volume.
The default is to use the system viewing matrix (!P.T).
Data type : Fltarr(4, 4).
XSIZE: The X size of the image to return. Congrid is used to
resize the final image to be XSIZE by YSIZE. The default
is the X size of the current window (or the X size of the
Z-buffer). If there is no current window then the
default is X_sample.
Data type: Int or Long.
YSIZE: The Y size of the image to return. Congrid is used to
resize the final image to be XSIZE by YSIZE. The default
is the Y size of the current window (or the Y size of the
Z-buffer). If there is no current window then the
default is Y_sample.
Data type: Int or Long.
Z_BUFFER: If set, then the projection is combined with the contents
of the Z-buffer. The default is to not use the Z-buffer
contents.
OUTPUTS:
This function returns the projected volume as a two dimensional
array with the same data type as Vol. The dimensions of the
returned array are XSIZE by YSIZE.
CALLS: ***
CONGRID
EXAMPLE:
Use "T3D" to set up a viewing projection and render a volume of
data using "PROJECT_VOL" :
; Create some data.
vol = RANDOMU(s, 40, 40, 40)
FOR i=0, 10 DO vol = SMOOTH(vol, 3)
vol = BYTSCL(vol[3:37, 3:37, 3:37])
opaque = RANDOMU(s, 40, 40, 40)
FOR i=0, 10 DO opaque = SMOOTH(opaque, 3)
opaque = BYTSCL(opaque[3:37, 3:37, 3:37], TOP=25B)
; Set up the view.
xmin = 0 & ymin = 0 & zmin = 0
xmax = 34 & ymax = 34 & zmax = 34
!X.S = [-xmin, 1.0] / (xmax - xmin)
!Y.S = [-ymin, 1.0] / (ymax - ymin)
!Z.S = [-zmin, 1.0] / (zmax - zmin)
T3D, /RESET
T3D, TRANSLATE=[-0.5, -0.5, -0.5]
T3D, SCALE=[0.7, 0.7, 0.7]
T3D, ROTATE=[30, -30, 60]
T3D, TRANSLATE=[0.5, 0.5, 0.5]
window, 0, xsize=512, ysize=512
; Generate and display the image.
img = PROJECT_VOL(vol, 64, 64, 64, DEPTH_Q=0.7, $
OPAQUE=opaque, TRANS=(!P.T))
TVSCL, img
MODIFICATION HISTORY:
Written by: Daniel Carr. Tue Sep 1 17:52:06 MDT 1992
Modified to increase speed. Also modified
to use current data->normal coordinate conversion. Added
CUBIC, AVG_INTENSITY, XSIZE, YSIZE, and Z_BUFFER keywords.
Daniel Carr. Tue Nov 15 16:03:15 MST 1994
[Previous]
[Next]
NAME:
PS_SHOW_FONTS
PURPOSE:
This procedure displays all the PostScript fonts that IDL knows
about, with both the StandardAdobe and ISOLatin1 encodings. Each
display takes a separate page, and each character in each font
is shown with its character index.
CATEGORY:
Misc., PostScript, Fonts.
CALLING SEQUENCE:
PS_SHOW_FONTS
INPUTS:
None.
KEYWORDS:
NOLATIN: If set, do NOT output ISOLatin1 encodings.
OUTPUTS:
None.
CALLS: ***
PS_SHOFONT
COMMON BLOCKS:
None.
SIDE EFFECTS:
A PostScript file is produced, one page per font/mapping combination.
RESTRICTIONS:
The output file contains almost 70 pages of output. A PostScript
previewer is recommended rather than sending it to a printer.
MODIFICATION HISTORY:
12 January 1993, AB, RSI.
12 October 1993, Rob Montgomery, NCAR - added 'nolatin' keyword.
[Previous]
[Next]
NAME:
PSAFM
PURPOSE:
Given an Abobe Font metric file, this procedure generates an AFM
file in the format that IDL likes. This new file differs from the
original in the following ways:
[] Information not used by IDL is removed.
[] AFM files with the AdobeStandardEncoding are
supplemented with an ISOLatin1Encoding.
CATEGORY:
Misc., PostScript, Fonts
CALLING SEQUENCE:
PSAFM, input_filename, output_filename
INPUTS:
Input_Filename: Name of existing AFM file from Adobe.
Output_FIlename: Name of new AFM file to be created.
OUTPUTS:
None.
CALLS: ***
PSAFM_ISOMAP
COMMON BLOCKS:
None.
SIDE EFFECTS:
Generates an output file.
MODIFICATION HISTORY:
8 January 1993, Written by AB, RSI.
[Previous]
[Next]
NAME:
PUSHD
PURPOSE:
Push a directory onto the top of the directory stack maintained
by the PUSHD and POPD User Library procedures.
CALLING SEQUENCE:
PUSHD, Dir
INPUTS:
Dir: The directory to change to. The current directory will
be pushed to the top of the directory stack.
SIDE EFFECTS:
The current directory is pushed onto the directory stack.
It will be the next directory used by POPD.
COMMON BLOCKS:
DIR_STACK: Contains the stack.
MODIFICATION HISTORY:
17, July, 1989, Written by AB, RSI.