[Previous]
[Next]
NAME:
GAMMA
PURPOSE:
Return the Gamma function of (possibly complex) Z.
CALLING SEQUENCE:
Result = GAMMA(Z)
INPUTS:
Z: The expression for which the gamma function will be evaluated.
If Z is double-precision, the result is double-precision,
otherwise the result is floating-point. Z may be complex.
KEYWORD PARAMETERS:
None
CALLED BY:
FACTORIAL, LAGUERRE, WV_FN_GAUSSIAN
MODIFICATION HISTORY:
3 July 1995, AB, 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.
CT, RSI, Jan 2001: Added complex support.
[Previous]
[Next]
NAME:
GAMMA_CT
PURPOSE:
Apply gamma correction to the color table.
CATEGORY:
Image display.
CALLING SEQUENCE:
GAMMA_CT, Gamma
GAMMA_CT, Gamma, /CURRENT
INPUTS:
Gamma: The value of gamma correction. A value of 1.0 indicates a
linear ramp, i.e., no gamma correction. Higher values of
gamma give more contrast. Values less than 1.0 yield lower
contrast.
KEYWORD PARAMETERS:
CURRENT: If this keyword is set, apply correction from the current
table. Otherwise, apply from the original color table. When
CURRENT is set, the color table input to GAMMA_CT
is taken from the R_CURR, G_CURR, and B_CURR variables.
Otherwise, input is from R_ORIG, G_ORIG, and B_ORIG.
The resulting tables are always saved in the "current" table.
INTENSITY: If this keyword is set, correct the individual intensities of
each color in the color table. Otherwise, shift the colors
according to the gamma function.
OUTPUTS:
No explicit outputs. The modified color table vectors
are saved in the COLORS common block, as the variables
r_curr, g_curr, and b_curr variables.
COMMON BLOCKS:
COLORS: The IDL color table common block.
SIDE EFFECTS:
A new color table is loaded, and its contents are placed
in the "current" variables of the COLORS common block.
RESTRICTIONS:
None.
PROCEDURE:
Straightforward. The gamma correction is implemented
as x^gamma, where x is the range of color table indices
scaled from 0 to 1.
MODIFICATION HISTORY:
DMS, Oct, 1990. Added ability shift intensities of colors, rather
than the mapping of the colors. DMS, April, 1991.
[Previous]
[Next]
NAME:
GAUSS2_FUNCT
PURPOSE:
Evaluate function for gauss2fit.
CALLING SEQUENCE:
FUNCT,X,A,F,PDER
INPUTS:
X = values of independent variables, encoded as: [nx, ny, x, y]
A = parameters of equation described below.
OUTPUTS:
F = value of function at each X(i,j), Y(i,j).
Function is:
F(x,y) = A0 + A1*EXP(-U/2)
where: U= (yp/A2)^2 + (xp/A3)^2
If A has 7 elements a rotation of the ellipse is present and:
xp = (x-A4) * cos(A6) - (y-A5) * sin(A6)
yp = (x-A4) * sin(A6) + (y-A5) * cos(A6)
If A has 6 elements, A6 (theta) is 0, the major and minor axes
of the ellipse are parallel to the XY axes, and:
xp = (x-A4) and yp = (x-A5)
Optional output parameters:
PDER = (n_elements(z),6 or 7) array containing the
partial derivatives. pder(i,j) = derivative
at ith point w/respect to jth parameter.
CALLS: ***
CURVEFIT, GAUSS2DFIT, GAUSSFIT
CALLED BY:
GAUSS2DFIT
PROCEDURE:
Evaluate the function and then if requested, eval partials.
MODIFICATION HISTORY:
WRITTEN, DMS, RSI, June, 1995.
[Previous]
[Next]
NAME:
GAUSS2DFIT
PURPOSE:
Fit a 2 dimensional elliptical gaussian equation to rectilinearly
gridded data.
Z = F(x,y) where:
F(x,y) = A0 + A1*EXP(-U/2)
And the elliptical function is:
U= (x'/a)^2 + (y'/b)^2
The parameters of the ellipse U are:
Axis lengths are 2*a and 2*b, in the unrotated X and Y axes,
respectively.
Center is at (h,k).
Rotation of T radians from the X axis, in the CLOCKWISE direction.
The rotated coordinate system is defined as:
x' = (x-h) * cos(T) - (y-k) * sin(T) <rotate by T about (h,k)>
y' = (x-h) * sin(T) + (y-k) * cos(T)
The rotation is optional, and may be forced to 0, making the major/
minor axes of the ellipse parallel to the X and Y axes.
The coefficients of the function, are returned in a seven
element vector:
a(0) = A0 = constant term.
a(1) = A1 = scale factor.
a(2) = a = width of gaussian in X direction.
a(3) = b = width of gaussian in Y direction.
a(4) = h = center X location.
a(5) = k = center Y location.
a(6) = T = Theta the rotation of the ellipse from the X axis
in radians, counterclockwise.
CATEGORY:
curve / data fitting
CALLING SEQUENCE:
Result = GAUSS2DFIT(z, a [,x,y])
INPUTS:
Z = dependent variable in a 2D array dimensioned (Nx, Ny). Gridding
must be rectilinear.
X = optional Nx element vector containing X values of Z. X(i) = X value
for Z(i,j). If omitted, a regular grid in X is assumed,
and the X location of Z(i,j) = i.
Y = optional Ny element vector containing Y values of Z. Y(j) = Y value
for Z(i,j). If omitted, a regular grid in Y is assumed,
and the Y location of Z(i,j) = j.
Optional Keyword Parameters:
NEGATIVE = if set, implies that the gaussian to be fitted
is a valley (such as an absorption line).
By default, a peak is fit.
TILT = if set to 1, allow the orientation of the major/minor axes of
the ellipse to be unrestricted. The default is that
the axes of the ellipse must be parallel to the X-Y axes.
In this case, A(6) is always returned as 0.
OUTPUTS:
The fitted function is returned.
OUTPUT PARAMETERS:
A: The coefficients of the fit. A is a seven element vector as
described under PURPOSE.
CALLS: ***
CURVEFIT, GAUSS2_FUNCT, GAUSSFIT
CALLED BY:
GAUSS2_FUNCT
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
Timing: Approximately 4 seconds for a 128 x 128 array, on a
Sun SPARC LX. Time required is roughly proportional to the
number of elements in Z.
PROCEDURE:
The peak/valley is found by first smoothing Z and then finding the
maximum or minimum respectively. Then GAUSSFIT is applied to the row
and column running through the peak/valley to estimate the parameters
of the Gaussian in X and Y. Finally, CURVEFIT is used to fit the 2D
Gaussian to the data.
Be sure that the 2D array to be fit contains the entire Peak/Valley
out to at least 5 to 8 half-widths, or the curve-fitter may not
converge.
EXAMPLE: This example creates a 2D gaussian, adds random noise
and then applies GAUSS2DFIT:
nx = 128 ;Size of array
ny = 100
;** Offs Scale X width Y width X cen Y cen **
;** A0 A1 a b h k **
a = [ 5., 10., nx/6., ny/10., nx/2., .6*ny] ;Input function parameters
x = findgen(nx) # replicate(1.0, ny) ;Create X and Y arrays
y = replicate(1.0, nx) # findgen(ny)
u = ((x-a(4))/a(2))^2 + ((y-a(5))/a(3))^2 ;Create ellipse
z = a(0) + a(1) * exp(-u/2) ;to gaussian
z = z + randomn(seed, nx, ny) ;Add random noise, SD = 1
yfit = gauss2dfit(z,b) ;Fit the function, no rotation
print,'Should be:',string(a,format='(6f10.4)') ;Report results..
print,'Is: :',string(b(0:5),format='(6f10.4)')
MODIFICATION HISTORY:
DMS, RSI, June, 1995.
[Previous]
[Next]
NAME:
GAUSS_CVF
PURPOSE:
This function computes the cutoff value (v) such that:
Probability(X > v) = p
where X is a random variable from the standard Gaussian (Normal)
distribution with a mean of 0.0 and a variance of 1.0
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = Gauss_cvf(P)
INPUTS:
P: A non-negative scalar, in the interval [0.0, 1.0], of type
float or double that specifies the probability of occurance
or success.
CALLS: ***
BISECT_PDF, GAUSS_PDF
EXAMPLE:
Compute the cutoff value (v) such that Probability(X > v) = 0.025
from the standard Gaussian (Normal) distribution. The result should
be 1.95997
result = gauss_cvf(0.025)
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
MODIFICATION HISTORY:
Modified by: GGS, RSI, July 1994
Minor changes to code. New documentation header.
[Previous]
[Next]
NAME:
GAUSS_PDF
PURPOSE:
This function computes the probabilty (p) such that:
Probability(X <= v) = p
where X is a random variable from the standard Gaussian (Normal)
distribution with a mean of 0.0 and a variance of 1.0
CATEGORY:
Statistics.
CALLING SEQUENCE:
Result = Gauss_Pdf(V)
INPUTS:
V: A scalar of type integer, float or double that specifies
the cutoff value.
EXAMPLES:
Compute the probability that a random variable X, from the
standard Gaussian (Normal) distribution, is less than or equal
to 2.44. The result should be 0.992656
result = gauss_pdf(2.44)
Compute the probability that a random variable X, from the
standard Gaussian (Normal) distribution, is less than or equal
to 10.0 and greater than or equal to 2.0. The result should be
0.0227501 [i.e. Probability(2.0 <= X <= 10.0)]
result = gauss_pdf(10.0) - gauss_pdf(2.0)
Compute the probability that a random variable X, from the
Gaussian (Normal) distribution with a mean of 0.8 and a variance
of 4.0, is less than or equal to 2.44. The result should be
0.793892
result = gauss_pdf( (2.44 - 0.80)/sqrt(4.0) )
CALLED BY:
BINOMIAL, GAUSS_CVF, MD_TEST, RS_TEST, R_TEST
PROCEDURE:
GAUSS_PDF calls GAUSSINT() to evaluate the Gaussian integral.
This function was included to provide consistency with the
other probability functions: CHISQR_PDF(), F_PDF(), and T_PDF().
REFERENCE:
APPLIED STATISTICS (third edition)
J. Neter, W. Wasserman, G.A. Whitmore
ISBN 0-205-10328-6
MODIFICATION HISTORY:
Written by: GGS, RSI, July 1994
[Previous]
[Next]
NAME:
GAUSSFIT
PURPOSE:
Fit the equation y=f(x) where:
F(x) = A0*EXP(-z^2/2) + A3 + A4*x + A5*x^2
and
z=(x-A1)/A2
A0 = height of exp, A1 = center of exp, A2 = sigma (the width).
A3 = constant term, A4 = linear term, A5 = quadratic term.
Terms A3, A4, and A5 are optional.
The parameters A0, A1, A2, A3 are estimated and then CURVEFIT is
called.
CATEGORY:
?? - fitting
CALLING SEQUENCE:
Result = GAUSSFIT(X, Y [, A])
INPUTS:
X: The independent variable. X must be a vector.
Y: The dependent variable. Y must have the same number of points
as X.
KEYWORD INPUTS:
CHISQ: Set this keyword to a named variable that will contain
the value of the chi-square goodness-of-fit.
ESTIMATES = optional starting estimates for the parameters of the
equation. Should contain NTERMS (6 if NTERMS is not
provided) elements.
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).
NTERMS = Set NTERMS to 3 to compute the fit: F(x) = A0*EXP(-z^2/2).
Set it to 4 to fit: F(x) = A0*EXP(-z^2/2) + A3
Set it to 5 to fit: F(x) = A0*EXP(-z^2/2) + A3 + A4*x
SIGMA: Set this keyword to a named variable that will contain
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.
YERROR: The standard error between YFIT and Y.
OUTPUTS:
The fitted function is returned.
OPTIONAL OUTPUT PARAMETERS:
A: The coefficients of the fit. A is a three to six
element vector as described under PURPOSE.
CALLS: ***
CURVEFIT, GAUSS_FUNCT, POLY_FIT
CALLED BY:
GAUSS2DFIT, GAUSS2_FUNCT, idlitopcurvefitting__define
COMMON BLOCKS:
None.
SIDE EFFECTS:
None.
RESTRICTIONS:
The peak or minimum of the Gaussian must be the largest
or smallest point in the Y vector.
PROCEDURE:
The initial estimates are either calculated by the below procedure
or passed in by the caller. Then the function CURVEFIT is called
to find the least-square fit of the gaussian to the data.
Initial estimate calculation:
If NTERMS>=4 then a constant term is subtracted first.
If NTERMS>=5 then a linear term is subtracted first.
If the (MAX-AVG) of Y is larger than (AVG-MIN) then it is assumed
that the line is an emission line, otherwise it is assumed there
is an absorbtion line. The estimated center is the MAX or MIN
element. The height is (MAX-AVG) or (AVG-MIN) respectively.
The width is found by searching out from the extrema until
a point is found less than the 1/e value.
MODIFICATION HISTORY:
DMS, RSI, Dec, 1983.
DMS, RSI, Jun, 1995, Added NTERMS keyword. Result is now float if
Y is not double.
DMS, RSI, Added ESTIMATES keyword.
CT, RSI, Feb 2001: Change the way estimates are computed.
If NTERMS>3 then a polynomial of degree NTERMS-4 is subtracted
before estimating Gaussian coefficients.
CT, RSI, Nov 2001: Slight change to above modification:
Because a Gaussian and a quadratic can be highly correlated,
do not subtract off the quadratic term,
only the constant and linear terms.
Also added CHISQ, SIGMA and YERROR output keywords.
CT, RSI, May 2003: Added MEASURE_ERRORS keyword.
CT, RSI, March 2004: If estimate[2] is zero, compute a default value.
[Previous]
[Next]
NAME:
GET_DXF_OBJECTS
PURPOSE:
This function returns an IDLgrModel contaning graphics from a
given dxf file.
CATEGORY:
Data Access.
CALLING SEQUENCE:
Result = GET_DXF_OBJECTS(Filename [, BlockTable [, LayerTable]])
INPUTS:
Filename: String. The name of a DXF file.
Input keywords:
NORMALIZE: ignored, but present for backwards compatibility.
ByLayer: set to read files by layer, rather than by block which
is the default.
OUTPUTS:
BlockTable: a structure array describing the blocks. See below
for description.
LayerTable: a structure array describing the layers.
Structure tags for BlockTable and LayerTable:
Name : <string> Block/layer name or NULL for *Model_Space block
Model: <object> ;IDLgrModel for this block/layer
nEntries: <lonarr(21)> number of DXF entities in this block,
indexed by DXF type.
ColorName: <string> Entitiy's color name
Color: <bytarr(3)> Entitiy's color RGB
ColorIndex: <int> DXF color index
Visible: <int> Set if layer is visible
OUTPUT KEYWORD PARAMETERS
IGNORED: An array of 21 elements containing the counts of the DXF
entities that were ignored because of unimplemented DXF data
types.
ERROR: Set to 0 on return if successful, 1 if an error occured.
OUTPUTS:
This function returns the IDLgrModel for the *Model_Space block,
the default block.
EXAMPLE:
IDL> filename = filepath('heart.dxf', subdir=['examples', 'data'])
IDL> oModel = get_dxf_objects(filename)
IDL> xobjview, oModel
Note: GET_DXF_OBJECTS is undocumented.
MODIFICATION HISTORY:
Written by: DMS, RSI, July, 2000.
[Previous]
[Next]
FILE:
get_screen_size.pro
PURPOSE:
This application retrieves the screen size for the current
(or specified) display.
CATEGORY:
Graphics
CONTENTS:
fun get_screen_size - retrieves the screen size
NAMED STRUCTURES:
none.
CALLED BY:
CW_PANES [1], CW_PANES_DASHED_BAR, CW_PANES_DISPLAY_SLIDER_BAR
CW_PANES_DRAW_SLIDER_BAR, CW_PANES_EVENT, CW_PANES_GET, CW_PANES_KILL
CW_PANES_LINE_EVENT, CW_PANES_NULL_EVENT, CW_PANES_REALIZE_LINE
CW_PANES_RIGHT_BUTTON, CW_PANES_SET, IDLitUIContourLevels
IDLitUIConvolKernel [1], IDLitUICurveFitting, IDLitUIDataBottomTop
IDLitUIIntVol, IDLitUIIsoSurface, IDLitUIPaletteEditor, IDLitUISubVolume
IDLituiMapGridLines, IDLituiMapProjection, IDLituiRotateByAngle, IDLitwdTool
XDISPLAYFILE, cw_panes [2], dicomex_net_startup, idlitsystem__define
COMMON BLOCKS:
none.
MODIFICATION HISTORY:
10/96 DD - Original.
01/97 DD - Use an unmapped widget draw rather than a pixmap
window because in some (rare) cases on certain X
window configurations, a GL pixmap context cannot
be supported.
[Previous]
[Next]
NAME:
getDicomexStorScpDir
PURPOSE:
Returns the path to the system config or local config file
CALLING SEQUENCE:
PATH = getDicomexConfigPath
INPUTS:
NONE
KEYWORD PARAMETERS:
NONE
CALLS: ***
DICOMEX_GETCONFIGFILEPATH
MODIFICATION HISTORY:
Written by: LFG, RSI, January 2005
Modified by:
[Previous]
[Next]
NAME:
getDicomexStorScpDir
PURPOSE:
Returns the directory StorScpDir used by the IDLffDicomExCfg object
CALLING SEQUENCE:
PATH = GETDICOMEXSTORSCPDIR
INPUTS:
NONE
KEYWORD PARAMETERS:
NONE
CALLS: ***
DICOMEX_GETSTORSCPDIR
MODIFICATION HISTORY:
Written by: LFG, RSI, October 2004
Modified by:
[Previous]
[Next]
NAME:
GRAPHICS_TIMES
PURPOSE:
This is a wrapper on the procedure GRAPHICS_TIMES_INTERNAL contained
in the file time_test.pro. Please see that file for further
information. The reason for doing it this way is so that the
various time_test and graphics_test routines can stay in a single
file while still being easily callable.
CALLS: ***
GRAPHICS_TIMES_INTERNAL
[Previous]
[Next]
NAME:
GRAPHICS_TIMES2
PURPOSE:
This is a wrapper on the procedure GRAPHICS_TIMES2_INTERNAL contained
in the file time_test.pro. Please see that file for further
information. The reason for doing it this way is so that the
various time_test and graphics_test routines can stay in a single
file while still being easily callable.
CALLS: ***
GRAPHICS_TIMES2_INTERNAL
[Previous]
[Next]
NAME:
GRAPHICS_TIMES3
PURPOSE:
This is a wrapper on the procedure GRAPHICS_TIMES3_INTERNAL contained
in the file time_test.pro. Please see that file for further
information. The reason for doing it this way is so that the
various time_test and graphics_test routines can stay in a single
file while still being easily callable.
CALLS: ***
GRAPHICS_TIMES3_INTERNAL
[Previous]
[Next]
NAME:
GS_ITER
PURPOSE:
This function solves an n by n linear system of equations
using Gauss-Seidel iteration.
CATEGORY:
Linear Algebra.
CALLING SEQUENCE:
Result = GS_ITER(A, B)
INPUTS:
A: An N by N array of type: int, float, or double.
B: An N-element vector of type: int, float, or double.
KEYWORD PARAMETERS:
CHECK: An integer value of 0 or 1 that denies or requests
checking A for a diagonally dominant form.
CHECK = 0 (the default) results in no checking.
CHECK = 1 Checks A and reports if it does not
meet the required condition. This is
just a warning. The algorithm will
proceed on the chance it may converge.
DOUBLE: Set this keyword to force the computation to be done
in double-precision arithmetic.
LAMBDA: A scalar value in the range: [0.0, 2.0]
This value determines the amount of 'RELAXATION'.
Relaxation is a weighting technique that is used
to enhance convergence.
1) LAMBDA = 1.0 (the default) no weighting.
2) A value in the range 0.0 <= LAMBDA < 1.0 improves
convergence in oscillatory and non-convergent systems.
3) A value in the range 1.0 < LAMBDA <= 2.0 improves
convergence in systems known to converge.
MAX_ITER: The maximum number of iterations allowable for the
algorithm to converge to the solution. The default
is 30 iterations.
X_0: An N-element vector that provides the algorithm's
starting point. The default is [1.0, 1.0, ... , 1.0].
TOL: The relative error tolerance between current and past
iterates calculated as: ABS( (current-past)/current )
The default is 1.0e-4.
SIDE EFFECTS:
Upon output A and B are divided by the diagonal elements of A.
Integer inputs are converted to floats.
Note: These SIDE EFFECTS have been removed for IDL v5.0.
RESTRICTIONS:
The equations must be entered in a DIAGONALLY DOMINANT form
to guarantee convergence.
A system is diagonally dominant if it satisfies the condition:
abs(A(row,row)) > SUM(abs(A(row,col)))
where SUM runs col=1,N excluding col = row and A is in row major.
This restriction on A is known as a sufficient condition. That is,
it is sometimes possible for the algorithm to converge without the
condition being satisfied. But, convergence is guaranteed if the
condition is satisfied.
EXAMPLE:
Define an array (a) in a non-diagonally dominant form.
a = [[ 1.0, 7.0, -4.0], $
[ 4.0, -4.0, 9.0], $
[12.0, -1.0, 3.0]]
And right-side vector (b).
b = [12.0, 2.0, -9.0]
Compute the solution of the system, ax = b.
result = gs_iter(a, b)
Note: This example fails to converge, because A is not in
diagonally dominant form.
Reorder the array given above into diagonally dominant form.
a = [[12.0, -1.0, 3.0], $
[ 1.0, 7.0, -4.0], $
[ 4.0, -4.0, 9.0]]
Make corresponding changes in the ordering of b.
b = [-9.0, 12.0, 2.0]
Compute the solution of the system, ax = b.
result = gs_iter(a, b)
PROCEDURE:
GS_ITER.PRO implements the Gauss-Seidel iterative method with
over- and under- relaxation to enhance convergence.
REFERENCE:
ADVANCED ENGINEERING MATHEMATICS (seventh edition)
Erwin Kreyszig
ISBN 0-471-55380-8
MODIFICATION HISTORY:
Written by: GGS, RSI, April 1993
Modified: GGS, RSI, February 1994
1) Format keyword is no longer supported. The matrix
should be supplied in a row major format.
2) The input/output parameter X has been removed. The
algorithm's initial starting point is an n-element
vector of 1s. The keyword X_0 has been added to
override the default.
3) GS_ITER is now called as a function, x = gs_iter( ).
Modified: GGS, RSI, April 1996
The input arguments are no longer overwritten.
Added DOUBLE keyword. Modified keyword checking and use
of double precision.
Modified: S. Lett, RSI, March 1998
Modified stopping criteria. Tol is used as an absolute
tolerance when the iterates are very near zero.