F_CVF $RSI/f_cvf.pro
[Previous] [Next]
 NAME:
       F_CVF

 PURPOSE:
       This function computes the cutoff value (v) such that:
                   Probability(X > v) = p
       where X is a random variable from the F distribution with
       (dfn) and (dfd) degrees of freedom.

 CALLING SEQUENCE:
     Result = f_cvf(P, DFN, DFD)

 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.

     DFN:    A positive scalar of type integer, float or double that
             specifies the degrees of freedom of the F distribution
             numerator.

     DFD:    A positive scalar of type integer, float or double that
             specifies the degrees of freedom of the F distribution
             denominator.

 CALLS: ***
	BISECT_PDF, F_PDF
 EXAMPLE:
       Compute the cutoff value (v) such that Probability(X > v) = 0.100
       from the F distribution with (dfn = 10) and (dfd = 6) degrees of
       freedom. The result should be 7.87413
         result = f_cvf(0.01, 10, 6)

 REFERENCE:
       APPLIED STATISTICS (third edition)
       J. Neter, W. Wasserman, G.A. Whitmore
       ISBN 0-205-10328-6

 MODIFICATION HISTORY:
       Modified by:  GGS, RSI, July 1994
                     Minor changes to code. New documentation header.
   CT, RSI, August 2003: Add check for NaN result.


F_PDF $RSI/f_pdf.pro
[Previous] [Next]
 NAME:
     F_PDF

 PURPOSE:
       This function computes the probabilty (p) such that:
                   Probability(X <= v) = p
       where X is a random variable from the F distribution with
       (dfn) and (dfd) degrees of freedom.

 CATEGORY:
	Statistics.

 CALLING SEQUENCE:
       Result = f_pdf(V, DFN, DFD)

 INPUTS:
       V:    A scalar of type integer, float or double that specifies
             the cutoff value.

     DFN:    A positive scalar of type integer, float or double that
             specifies the degrees of freedom of the F distribution
             numerator.

     DFD:    A positive scalar of type integer, float or double that
             specifies the degrees of freedom of the F distribution

 CALLS: ***
	IBETA
 CALLED BY:
	F_CVF
 EXAMPLE:
       Compute the probability that a random variable X, from the F
       distribution with (dfn = 5) and (dfd = 24) degrees of freedom,
       is less than or equal to 3.90. The result should be 0.990059
         result = f_pdf(3.90, 5, 24)

 REFERENCE:
       APPLIED STATISTICS (third edition)
       J. Neter, W. Wasserman, G.A. Whitmore
       ISBN 0-205-10328-6

 MODIFICATION HISTORY:
       Modified by:  GGS, RSI, July 1994
                     Minor changes to code. New documentation header.
        CT, RSI, March 2000: changed call from ibeta_pdf to ibeta


FACTORIAL $RSI/factorial.pro
[Previous] [Next]
 NAME:
       FACTORIAL

 PURPOSE:
       This function computes the factorial N! as the double-precision
       product, (N) * (N-1) * (N-2) * ...... * 3 * 2 * 1.

 CATEGORY:
       Special Functions.

 CALLING SEQUENCE:
       Result = Factorial(n)

 INPUTS:
       N:    A non-negative scalar or array of values.

 KEYWORD PARAMETERS:
       STIRLING:    If set to a non-zero value, Stirling's asymptotic
                    formula is used to approximate N!.

       UL64: Set this keyword to return values as unsigned 64-bit integers.

 CALLS: ***
	GAMMA
 CALLED BY:
	SPHER_HARM, WV_FN_PAUL
 EXAMPLE:
       Compute 20! with and without Stirling's asymptotic formula.
         result_1 = factorial(20, /stirling)
         result_2 = factorial(20)

       Result_1 and result_2 should be 2.4227869e+18 and 2.4329020e+18
       respectively.

 REFERENCE:
       ADVANCED ENGINEERING MATHEMATICS (seventh edition)
       Erwin Kreyszig
       ISBN 0-471-55380-8

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, November 1994
       CT, RSI, June 2000: Rewrote to handle array input; uses GAMMA for
              non-integers; added UL64 keyword.
       CT, RSI, October 2000: Separate calculation for scalar input.
              Use common variable for look-up table.


FILE_WHICH $RSI/file_which.pro
[Previous] [Next]
 NAME:
       FILE_WHICH

 PURPOSE:
       Look in the directories given by a file search path for a
       specific file.

       This command is modeled after the Unix which(1) command.

 CATEGORY:
       File Manipulation.

 CALLING SEQUENCE:
       Result = FILE_WHICH([PATH,] FILE)

 INPUTS:                 
       PATH: A search path to be searched.If Path is not
		present, the value of the IDL !PATH system
               variable is used.
       FILE: The file to look for in the directories given by
               PATH.

 KEYWORDS:
	INCLUDE_CURRENT_DIR:
	If set, include the current working directory at the
	head of the PATH. This is useful when trying to simulate
	the way IDL searches for routines, because it looks in the
	current directory and then looks at the value of !PATH.

 OUTPUTS:
       If the file is found, the full path is returned. If the
       file is not found, a NULL scalar string is returned.

 CALLS: ***
	PATH_SEP
 RESTRICTIONS:
       None.

 PROCEDURE:
       The path is separated into it's component directories, and each
       directory is searched in turn. The first directory that has
       the file is used. If the file does not exist in any of the
       directories, a NULL string is returned.

 EXAMPLES:
       To find the location of this routine:

               Result = FILE_WHICH('file_which.pro')

       To find the location of the Unix ls command:

               Result = FILE_WHICH(getenv('PATH'), 'ls')

 REVISION HISTORY:
       11 January 2000         Written AB, RSI


FILEPATH $RSI/filepath.pro
[Previous] [Next]
 NAME:
	FILEPATH

 PURPOSE:
	Given the name of a file in the IDL distribution,
	FILEPATH returns the fully-qualified path to use in
	opening the file. Operating system dependencies
	are taken into consideration. This routine is used by RSI to
	make the User Library portable.

 CATEGORY:
	File Management.

 CALLING SEQUENCE:
	Result = FILEPATH('filename' [, SUBDIRECTORY = subdir])

 INPUTS:
    filename:	The lowercase name of the file to be opened. No device
		or directory information should be included.

 KEYWORDS:
    ROOT_DIR: The name of the directory from which the resulting path
	should be based. If not present, the value of !DIR is used.
	This keyword is ignored if TERMINAL or TMP are specified.

    SUBDIRECTORY:	The name of the subdirectory in which the file
		should be found. If this keyword is omitted, the main
		directory is used.  This variable can be either a scalar
		string or a string array with the name of each level of
		subdirectory depth represented as an element of the array.

    TERMINAL:	Return the filename of the user's terminal.

    TMP:	The file is a scratch file.  Return a path to the
		proper place for temporary files under the current operating
		system.

 OUTPUTS:
	The fully-qualified file path is returned.  If one of the subdirectory
	keywords is not specified, the file is assumed to exist in the
	main distribution directory.

 CALLS: ***
	PATH_SEP
 CALLED BY:
	ANNOTATE, CW_FILESEL, CW_ITPANEL, CW_ITTOOLBAR, CW_ITUPDOWNFIELD, CW_TREESTRUCTURE
	EFONT, H5_BROWSER, IDLitWdToolSplash, IDLittool_systeminit, IDLitwdImportWizard
	IDLitwdMacroEditor, LOADCT, MAP_CONTINENTS, MK_HTML_HELP, MODIFYCT
	ONLINE_HELP_PDF_INDEX, SHOWFONT, SLICER3, TIME_TEST, XFONT, XLOADCT, XPALETTE, XROI
	cw_dicomex_query, cw_dicomex_stor_scu, cw_itoperationpreview
	idlfflangcat__define, idlitmanipvisrangepan__define
	idlitmanipvisrangezoom__define, idlitopinsertmapshape__define
	idlitsystem__define, xplot3d
 COMMON BLOCKS:
	None.

 RESTRICTIONS:
	ROOT_DIR, TERMINAL, and TMP are mutually exclusive. Only one of
	these should be used in a single call to FILEPATH. SUBDIRECTORY
	does not make sense with TERMINAL or TMP.

 EXAMPLE:
	To get a path to the file DETERM in the "userlib" subdirectory to the
	IDL "lib" subdirectory, enter:

		path = FILEPATH("determ", SUBDIRECTORY = ["lib", "userlib"])

	The variable "path" contains a string that is the fully-qualified file
	path for the file DETERM.

 MODIFICATION HISTORY:
	December, 1989, AB, RSI (Formalized from original by DMS)
	October, 1990, SG, RSI (added support for MSDOS)
	February, 1991, SMR, RSI (added string array support for multi-level
	    			  directories)
	21 April 1993, AB, Added ROOT_DIR keyword.
       14 July  1994, KDB, RSI - Corrected logic error in VMS section
           of the ROOT_DIR keyword. Any sub-directory specification was
           being ignored when using ROOT_DIR.
	March, 1995, DJE, Add a ':' if root_dir is specified on the Mac.
	29 July 1995, Robert.M.Candey.1@gsfc.nasa.gov, Changed VMS case for
	    no specified path to not append '.][000000]'
	April, 1996, DJE, Remove call to STRLOWCASE(SUBDIR).
	August, 1996, AJH, used environment variables to define TMP on Win32
	12 January 1998, AB, General cleanup and added 2 improvements for VMS
           supplied by Paul Hick (pphick@ucsd.edu): (1) Add a colon to the
           end of ROOT_DIR if it doesn't end in a ':' or ']' to allow
           root_dir to be a logical name without the trailing ':', and
           (2) Remove instances of '.][' that result when using rooted
           logical names for ROOT_DIR. These changes make it easier to use
           the same FILEPATH call across VMS and other operating systems.
	28 January 1999, AB, use new behavior of GETTMP('IDL_TMPDIR') to obtain
	    the correct TMP directory. This means that internal IDL and PRO
	    code will all treat temporary files the same way.


FLICK $RSI/flick.pro
[Previous] [Next]
 NAME:
	FLICK

 PURPOSE:
	Flicker between two output images at a given rate.

 CATEGORY:
	Image display, animation.

 CALLING SEQUENCE:
	FLICK, A, B, Rate

 INPUTS:
	A:	Byte image number 1, scaled from 0 to 255.
	B:	Byte image number 2, scaled from 0 to 255.

 OPTIONAL INPUT PARAMETERS:
	Rate:	The flicker rate.  The default is 1.0 sec/frame

 KEYWORD PARAMETERS:
	None.

 OUTPUTS:
	No explicit outputs.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	Sunview: Modifies the display, changes the write mask.
	X and Windows: uses two additional pixmaps.

 RESTRICTIONS:
	None.

 PROCEDURE:
  SunView:
	Image A is written to the bottom 4 bits of the display.
	Image B is written to the top 4 bits.
	Two color tables are created from the current table, one that
	shows the low 4 bits using 16 of the original colors, and one
	that shows the high 4 bits.  The color table is changed to
	switch between images.
  Other window systems:
	two off screen pixmaps are used to contain the images.

 MODIFICATION HISTORY:
	DMS, 3/ 88.
	DMS, 4/92, Added X window and MS window optimizations.


FLOW3 Draw 3D flowvelocity field. $RSI/flow3.pro
[Previous] [Next]
 NAME:
	FLOW3 - Draw 3D flow/velocity field.
 PURPOSE:
	Draw lines representing a 3D flow/velocity field.
 CATEGORY:
	Graphics.
 CALLING SEQUENCE:
	FLOW3, vx, vy, vz
 INPUTS:
	Vx, Vy, Vz = 3D arrays containing X, Y, and Z components
		of the field.
 KEYWORD PARAMETERS:
	Sx, Sy, Sz = Optional vectors containing the starting coordinates
	  of the flow lines. If omitted random starting points are chosen.
	Nvecs = Number of random flow lines to draw (Default = 200).
	  Only used if Sx, Sy, Sz are not present.
	Len = Length of each step used to follow flow lines.  Default = 2.0
	  Expressed in units of largest field vector, i.e. the length of
	  the longest step is set to len times the grid spacing.
	Nsteps = number of steps used to follow the flow lines.  Default =
	  largest dimension of vx / 5.
	Blob = 1 to draw a blob at the beginning of each flow line and
	  suppress the arrows.
	Arrowsize = size of arrowheads, default = 0.05
 OUTPUTS:
	None.  Graphics are produced on the currently selected graphics
	device.
 CALLS: ***
	ARROW3, BLOB3, FLOW3
 COMMON BLOCKS:
	None.
 RESTRICTIONS:
	Works best with Z buffer output device.
 PROCEDURE:
	The 3D scaling system must be set before calling this procedure.
	For example:  scale3, xr=[0,nx-1], yr=[0,ny-1], zr = [0,nz-1]
	where nx, ny, and nz are the 1st, 2nd, and 3rd dimensions of
	VX, VY, and VZ.
 MODIFICATION HISTORY:
	DMS - RSI, Nov, 1991.


FUNCT $RSI/funct.pro
[Previous] [Next]
 NAME:
	FUNCT

 PURPOSE:
	Evaluate the sum of a Gaussian and a 2nd-order polynomial
	and optionally return the value of its partial derivatives.
	Normally, this function is used by CURVEFIT to fit the
	sum of a line and a varying background to actual data.

 CATEGORY:
	E2 - Curve and surface fitting.

 CALLING SEQUENCE:
	FUNCT, X, A, F [, Pder]

 INPUTS:
	X:	The values of the independent variable.
	A:	The parameters of the equation described in PROCEDURE below.

 OUTPUTS:
	F:	The value of the function at each X(i).

 OPTIONAL OUTPUT PARAMETERS:
	Pder:	An array of the size (N_ELEMENTS(X),6) that contains the
		partial derivatives.  Pder(i,j) represents the derivative
		at the i'th point with respect to j'th parameter.

 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	None.

 PROCEDURE:
	F = A(0)*EXP(-Z^2/2) + A(3) + A(4)*X + A(5)*X^2
	Z = (X-A(1))/A(2)

 MODIFICATION HISTORY:
	WRITTEN, DMS, RSI, SEPT, 1982.
	Modified, DMS, Oct 1990.  Avoids divide by 0 if A(2) is 0.


FV_TEST $RSI/fv_test.pro
[Previous] [Next]
 NAME:
       FV_TEST

 PURPOSE:
       This function computes the F-statistic and the probability that two
       vectors of sampled data have significantly different variances. This
       type of test is often refered to as the F-variances Test.

 CATEGORY:
       Statistics.

 CALLING SEQUENCE:
       Result = FV_TEST(X, Y)

 INPUTS:
       X:    An n-element vector of type integer, float or double.

       Y:    An m-element vector of type integer, float or double.

 EXAMPLE
       Define two n-element vectors of tabulated data.
         X = [257, 208, 296, 324, 240, 246, 267, 311, 324, 323, 263, 305, $
               270, 260, 251, 275, 288, 242, 304, 267]
         Y = [201, 56, 185, 221, 165, 161, 182, 239, 278, 243, 197, 271, $
               214, 216, 175, 192, 208, 150, 281, 196]
       Compute the F-statistic (of X and Y) and its significance.
       The result should be the two-element vector [2.48578, 0.0540116],
       indicating that X and Y have significantly different variances.
         result = fv_test(X, Y)

 CALLS: ***
	IBETA, MOMENT
 PROCEDURE:
       FV_TEST computes the F-statistic of X and Y as the ratio of variances
       and its significance. X and Y may be of different lengths. The result
       is a two-element vector containing the F-statistic and its
       significance. The significance is a value in the interval [0.0, 1.0];
       a small value (0.05 or 0.01) indicates that X and Y have significantly
       different variances.

 REFERENCE:
       Numerical Recipes, The Art of Scientific Computing (Second Edition)
       Cambridge University Press
       ISBN 0-521-43108-5

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, Aug 1994
                    FV_TEST is based on the routine: ftest.c described in
                    section 14.2 of Numerical Recipes, The Art of Scientific
                    Computing (Second Edition), and is used by permission.
       CT, RSI, March 2000: removed redundant betacf, ibeta functions


FX_ROOT $RSI/fx_root.pro
[Previous] [Next]
 NAME:
       FX_ROOT

 PURPOSE:
       This function computes real and complex roots (zeros) of
       a univariate nonlinear function.

 CATEGORY:
       Nonlinear Equations/Root Finding

 CALLING SEQUENCE:
       Result = FX_ROOT(X, Func)

 INPUTS:
       X :      A 3-element initial guess vector of type real or complex.
                Real initial guesses may result in real or complex roots.
                Complex initial guesses will result in complex roots.

       Func:    A scalar string specifying the name of a user-supplied IDL
                function that defines the univariate nonlinear function.
                This function must accept the vector argument X.

 KEYWORD PARAMETERS:
       DOUBLE:  If set to a non-zero value, computations are done in
                double precision arithmetic.

       ITMAX:   Set this keyword to specify the maximum number of iterations
                The default is 100.

       STOP:    Set this keyword to specify the stopping criterion used to
                judge the accuracy of a computed root, r(k).
                STOP = 0 implements an absolute error criterion between two
                successively-computed roots, |r(k) - r(k+1)|.
                STOP = 1 implements a functional error criterion at the
                current root, |Func(r(k))|. The default is 0.

       TOL:     Set this keyword to specify the stopping error tolerance.
                If the STOP keyword is set to 0, the algorithm stops when
                |x(k) - x(k+1)| < TOL.
                If the STOP keyword is set to 1, the algorithm stops when
                |Func(x(k))| < TOL. The default is 1.0e-4.

 EXAMPLE:
       Define an IDL function named FUNC.
         function FUNC, x
           return, exp(sin(x)^2 + cos(x)^2 - 1) - 1
         end

       Define a real 3-element initial guess vector.
         x = [0.0, -!pi/2, !pi]

       Compute a root of the function using double-precision arithmetic.
         root = FX_ROOT(x, 'FUNC', /double)

       Check the accuracy of the computed root.
         print, exp(sin(root)^2 + cos(root)^2 - 1) - 1

       Define a complex 3-element initial guess vector.
         x = [complex(-!pi/3, 0), complex(0, !pi), complex(0, -!pi/6)]

       Compute a root of the function.
         root = FX_ROOT(x, 'FUNC')

       Check the accuracy of the computed root.
         print, exp(sin(root)^2 + cos(root)^2 - 1) - 1

 PROCEDURE:
       FX_ROOT implements an optimal Muller's method using complex
       arithmetic only when necessary.

 REFERENCE:
       Numerical Recipes, The Art of Scientific Computing (Second Edition)
       Cambridge University Press
       ISBN 0-521-43108-5

 MODIFICATION HISTORY:
       Written by:  GGS, RSI, March 1994
       Modified:    GGS, RSI, September 1994
                    Added support for double-precision complex inputs.