idlastro / FITS I/O: PSF_GAUSSIAN

[Source code]

NAME
PSF_GAUSSIAN
PURPOSE
Create a 1-d, 2-d, or 3-d Gaussian with specified FWHM, center 
EXPLANATION
Return a point spread function having Gaussian profiles,
as either a 1D vector, a 2D image, or 3D volumetric-data.
CALLING SEQUENCE
psf = psf_Gaussian( NPIXEL=, FWHM= , CENTROID = 
              [ /DOUBLE, /NORMALIZE, ST_DEV=,  NDIMEN= ] ) 
or
psf = psf_Gaussian( parameters, NPIXEL = ,NDIMEN = )
REQUIRED INPUT KEYWORD
NPIXEL = number pixels for each dimension, specify as an array,
        or just one number to make all sizes equal.
OPTIONAL KEYWORDS
CENTROID = floating scalar or vector giving position of  PSF center.    
        default is exact center of requested vector/image/volume.
        The number of elements in CENTROID should equal the number of
        dimensions.    **The definition of Centroid was changed in
        March 2002, and now an integer defines the center of a pixel.**
/DOUBLE  = If set, then the output array is computed in double precision
        the default is to return a floating point array.
FWHM = the desired Full-Width Half-Max (pixels) in each dimension,
        specify as an array, or single number to make all the same.
NDIMEN = integer dimension of result: either 1 (vector), 2 (image), or 
         3 (volume), default = 2 (an image result).
/NORMALIZE causes resulting PSF to be normalized so Total( psf ) = 1.
ST_DEV = optional way to specify width by standard deviation param.
         Ignored if FWHM is specified.
XY_CORREL = scalar between 0 and 1 specifying correlation coefficient
        Use this keyword, for example, to specify an elliptical 
        Gaussian oriented at an angle to the X,Y axis.   Only valid
        for 2-dimensional case.
INPUTS (optional)
parameters = an NDIMEN by 3 array giving for each dimension:
                [ maxval, center, st_dev ],  overrides other keywords.
EXAMPLE
(1) Create a 31 x 31 array containing a normalized centered Gaussian 
with an X FWHM = 4.3 and a Y FWHM = 3.6
IDL> array = PSF_GAUSSIAN( Npixel=31, FWHM=[4.3,3.6], /NORMAL )
(2) Create a 50 pixel 1-d Gaussian vector with a maximum of 12, 
   centered at  pixel 23 with a sigma of 19.2
IDL> psf = psf_gaussian([12,23,19.2],npixel=50)
EXTERNAL CALLS
function Gaussian()
NOTES
To improve speed, floating underflow exceptions are suppressed (using 
the MASK=32  keyword of CHECK_MATH() rather than being flagged.
HISTORY
Written, Frank Varosi NASA/GSFC 1991.
Suppress underflow messages, add DOUBLE keyword. **Modified centroid
definition so integer position is pixel center** W. Landsman March 2002
Allow use of the ST_DEV (not STDEV) keyword W. Landsman Nov. 2002
Do not modify NPIXEL input keyword   W. Landsman