ISOPHOT Interactive Analysis (PIA): Astrolib

DAOPHOT


List of Routines


Routine Descriptions

APER

[Next Routine] [List of Routines]
 NAME:
	APER
 PURPOSE:
	Procedure (adapted from DAOPHOT) to compute concentric aperture 
	photometry.   A separate sky value is determined for each source 
	using  specified inner and outer sky radii.

 CALLING SEQUENCE:
	aper, image, xc, yc, [ mags, errap, sky, skyerr, phpadu, apr, skyrad, 
			badpix, TEXTOUT = , SILENT = ]
 INPUTS:
	IMAGE -  input image array
	XC     - vector of x coordinates.  COORDINATE VALUES
		MUST BE IN IDL CONVENTION! (First pixel is 0 not 1!)
	YC     - vector of y coordinates

 OPTIONAL INPUTS:
	PHPADU - Photons per Analog Digital Units, numeric scalar.  Converts
		the data numbers in IMAGE to photon units.  (APER assumes
		Poisson statistics.)  
	APR    - Vector of up to 12 REAL photometry aperture radii.
	SKYRAD - Two element vector giving the inner and outer radii
		to be used for the sky annulus
	BADPIX - Two element vector giving the minimum and maximum value
		of a good pix (Default [-32765,32767])

 OPTIONAL KEYWORD INPUTS:
	TEXTOUT - Determines output device (see TEXTOPEN)
		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)
	SILENT -  If supplied and non-zero then no output is displayed to the
		terminal.

 OUTPUTS:
	MAGS   -  NAPER by NSTAR array giving the magnitude for each star in
		each aperture.  (NAPER is the number of apertures, and NSTAR
		is the number of stars).   A flux of 1 digital unit is assigned
		a zero point magnitude of 25.
	ERRAP  -  NAPER by NSTAR array giving error in magnitude
		for each star.  If a magnitude could not be deter-
		mined then ERRAP = 9.99.
	SKY  -  NSTAR element vector giving sky value for each star
	SKYERR -  NSTAR element vector giving error in sky values

 SYSTEM VARIABLES:
	If keyword textout is not used, the non-standard system variable 
	!TEXTOUT will be used to determine the output device.
 PROCEDURES USED:
	MMM, TEXTOPEN, STRN
 REVISON HISTORY:
	Adapted to IDL from DAOPHOT June, 1989   B. Pfarr, STX
	Adapted for IDL Version 2,               J. Isensee, July, 1990
	Code, documentation spiffed up           W. Landsman   August 1991

(See /usr/local/idl/lib/zastron/daophot/aper.pro)


CNTRD

[Previous Routine] [Next Routine] [List of Routines]
  NAME: 
	CNTRD
  PURPOSE:
	Compute centroid coordinates of a stellar object using the
	algorithm in the DAOPHOT FIND subroutine.

  CALLING SEQUENCE: 
	CNTRD, img, x, y, xcen, ycen, [ fwhm , /SILENT, /DEBUG]

  INPUTS:     
	IMG - Two dimensional image array
	X,Y - Scalar or vector integers giving approximate stellar center

  OPTIONAL INPUT:
	FWHM - floating scalar; Centroid is computed using a box of half
		width equal to 1.5 sigma = 0.637* FWHM.  CNTRD will prompt
		for FWHM if not supplied

  OUTPUTS:   
	XCEN - the computed X centroid position, same number of points as X
	YCEN - computed Y centroid position, same number of points as Y

	Values for XCEN and YCEN will not be computed if the computed
	centroid falls outside of the box, or if the computed derivatives
	are non-decreasing.   If the centroid cannot be computed, then a 
	message is displayed and XCEN and YCEN are set to -1.

  OPTIONAL OUTPUT KEYWORDS:
	SILENT - Normally CNTRD prints an error message if it is unable
		to compute the centroid.   Set /SILENT to suppress this.
	DEBUG - If this keyword is set, then CNTRD will display the subarray
		it is using to compute the centroid.

  PROCEDURE: 
	Maximum pixel within distance from input pixel X, Y  determined 
	from FHWM is found and used as the center of a square, within 
	which the centroid is computed as the value (XCEN,YCEN) at which 
	the derivatives of the partial sums of the input image over (y,x)
	with respect to (x,y) = 0.

  MODIFICATION HISTORY:
	Written 2/25/86, by J. K. Hill, S.A.S.C., following
	algorithm used by P. Stetson in DAOPHOT.
	Improved error checking      W. Landsman       August, 1991
	Allowed input vectors        G. Hennessy       April,  1992
	Fixed to prevent wrong answer if floating pt. X & Y supplied
		W. Landsman        March, 1993

(See /usr/local/idl/lib/zastron/daophot/cntrd.pro)


DAOERF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DAOERF
 PURPOSE:         
	Calulates the intensity of a 2 dimensional gaussian PSF at a pixel 
	position x, by integrating between x-0.5 and x+0.5.  It differs from
	ERF in 2 ways (to agree with DAOPHOT calls):

	(1)  The number of output elements in F and PDER is identical with
		the number of elements in X and Y
	(2)  The order of the parameter vector A is different

 CALLING SEQUENCE:
	DAOERF, XIN, YIN, A, F, [ PDER ] 

 INPUTS:
	XIN - input scalar, vector or array, giving X coordinate values
	YIN - input scalar, vector or array, giving Y coordinate values, must 
		have same number of elements as XIN.
	A - 5 element parameter array describing the gaussian
		A(0) - peak intensity
		A(1) - X position of peak intensity (centroid)
		A(2) - Y position of peak intensity (centroid)
		A(3) - X sigma of the gaussian (=FWHM/2.345)         
		A(4) - Y sigma of gaussian

 OUTPUTS:
	F - array containing value of the function at each (XIN,YIN) 

 OPTIONAL OUTPUTS:
	PDER - 2 dimensional array of size (NPTS,5) giving the analytic
		derivative at each value of F with respect to each parameter A.

 REVISION HISTORY:
	Written: W. Landsman                October, 1987

(See /usr/local/idl/lib/zastron/daophot/daoerf.pro)


DAO_VALUE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	DAO_VALUE
 PURPOSE:
	This function returns the value of a point-spread function at a
	given point.  The value of the point-spread function is the sum of a
	two-dimensional integral under a bivariate Gaussian function, and 
	a value obtained by interpolation in a look-up table.  DAO_VALUE will
	optionally compute the derivatives wrt X and Y

 CALLING SEQUENCE:
	Result = DAO_VALUE( xx, yy, gauss, psf, [ dvdx, dvdy ] )

 INPUTS:
	XX,YY   - the real coordinates of the desired point relative 
		to the centroid of the point-spread function.
	GAUSS  -  5 element vector describing the bivariate Gaussian
	GAUSS(0)- the peak height of the best-fitting Gaussian profile.
	GAUSS(1,2) - x and y offsets from the centroid of the point-spread 
		function to the center of the best-fitting Gaussian.
	GAUSS(3,4) - the x and y sigmas of the best-fitting Gaussian.
	PSF  -  a NPSF by NPSF array containing the look-up table.

 OUTPUTS:
    RESULT - the computed value of the point-spread function at
             a position XX, YY relative to its centroid (which 
             coincides with the center of the central pixel of the
             look-up table).

 OPTIONAL OUTPUTS:
       DVDX,DVDY - the first derivatives of the composite point-spread
             function with respect to x and y.

 NOTES
 	although the arguments XX,YY of the function DAO_VALUE
	are relative to the centroid of the PSF, the function RINTER which
	DAO_VALUE calls requires coordinates relative to the corner of the 
	array (see code).

 REVISON HISTORY:
	Adapted to IDL by B. Pfarr, STX, 11/17/87 from 1986 STSDAS version
	of DAOPHOT

(See /usr/local/idl/lib/zastron/daophot/dao_value.pro)


FIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	FIND
 PURPOSE:
	Find positive brightness perturbations (i.e stars) in a 
	2 dimensional image and compute centroids, and shape parameters,
	Adapted from 1986 STSDAS version of DAOPHOT.

 CALLING SEQUENCE:
	find, image, [ x, y, flux, sharp, round, hmin, fwhm, roundlim, sharplim 
		TEXTOUT = , /SILENT ]

 INPUTS:
	image - 2 dimensional image array (integer or real) for which one
		wishes to identify the stars present

 OPTIONAL INPUTS:
	FIND will prompt for these parameters if not supplied

	hmin -  Threshold intensity for a point source - should generally 
		be 3 or 4 sigma above background
	fwhm  - FWHM to be used in the convolve filter
	sharplim - 2 element vector giving low and high cutoff for the
		sharpness statistic (Default: [0.2,1.0] )
	roundlim - 2 element vector giving low and high cutoff for the
		roundness statistic (Default: [-1.0,1.0] )

 OPTIONAL INPUT KEYWORDS:
	SILENT - Normally, FIND will write out each star that meets all
		selection criteria.   If the SILENT keyword is set and 
		non-zero, then this printout is suppressed.
	TEXTOUT - Controls output device (see the procedure TEXTOPEN)
		textout=1	TERMINAL using /more option
		textout=2	TERMINAL without /more option
		textout=3	.prt
		textout=4	laser.tmp
		textout=5      user must open file
		textout = filename (default extension of .prt)

 OPTIONAL OUTPUTS:
	x - vector containing x position of all stars identified by FIND
	y-  vector containing y position of all stars identified by FIND
	flux - vector containing flux of identified stars as determined
		by a gaussian fit.  Fluxes are NOT converted to magnitudes.
	sharp - vector containing sharpness statistic for identified stars
	round - vector containing roundness statistic for identified stars

 SYSTEM VARIABLES:
	The non-standard system variable TEXTOUT determines the output device
	if the keyword TEXTOUT is not supplied.   See TEXTOPEN for more info.

 REVISION HISTORY:
	Written W. Landsman, STX  February, 1987
	Keyword textout added, J. Isensee, July, 1990
	ROUND now an internal function in V3.1   W. Landsman July 1993

(See /usr/local/idl/lib/zastron/daophot/find.pro)


GETPSF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GETPSF
 PURPOSE:
	To generate a point-spread function (PSF) from one or the sum of 
	several stars.  The PSF is represented as a 2-dimensional gaussian
	(integrated over each pixel) and a lookup table of residuals.
	The lookup table and gaussian parameters are output as an STSDAS
	(modified FITS) image file.   The PSF file created by GETPSF can
	be read with the procedure RDPSF.      Adapted from 1986 STSDAS 
	version of DAOPHOT

 CALLING SEQUENCE:
	getpsf, image, xc, yc, apmag, sky, $
		[ronois, phpadu, gauss, psf, idpsf, psfrad, fitrad, psfname]

 INPUTS:
	IMAGE  - input image array
	XC     - input vector of x coordinates (from FIND), these should be
		IDL (first pixel is (0,0)) convention.
	YC     - input vector of y coordinates (from FIND)
	APMAG  - vector of magnitudes (from APER), used for initial estimate
		of gaussian intensity.  If APMAG is multidimensional, (more
		than 1 aperture was used in APER) then the first aperture
		is used.
	SKY    - vector of sky values (from APER)                

 OPTIONAL INPUTS:
	The user will be prompted for the following parameters if not supplied.

	RONOIS - readout noise per pixel, (in electrons, or equivalent photons)
	PHPADU - photons per analog digital unit, used to scale the data
		numbers in IMAGE into photon units
	IDPSF  - vector of star id numbers from the list created by 
		APER which will be used to define the PSF.   Stars whose
		centroid does not fall within PSFRAD of the edge of the frame,
		or for which a gaussian fit requires more than 25 iterations,
		will be ignored when creating the final PSF.
	PSFRAD - the scalar radius, in pixels, of the circular area within
		which the PSF will be defined.   This should be slightly larger
		than the radius of the brightest star that one will be
		interested in.
	FITRAD - the scalar radius, in pixels of the circular area used in the
		least-square star fits.  Stetson suggest that FITRAD should
		approximately equal to the FWHM, slightly less for crowded
		fields.  (FITRAD must be smaller than PSFRAD.)
	PSFNAME- Name of the STSDAS-disk file (modified FITS) that will contain 
		the table of residuals, and the best-fit gaussian parameters.
		This file is subsequently required for use by NSTAR.  

 OPTIONAL OUTPUTS:
	GAUSS  - 5 element vector giving parameters of gaussian fit to the 
		first PSF star
		GAUSS(0) - height of the gaussian (above sky)
		GAUSS(1) - the offset (in pixels) of the best fitting gaussian
			and the original X centroid
		GAUSS(2) - similiar offset from the Y centroid 
		GAUSS(3) - Gaussian sigma in X
		GAUSS(4) - Gaussian sigma in Y
	PSF    - 2-d array of PSF residuals after a gaussian fit.

 PROCEDURE:
	GETPSF fits a Gaussian profile to the core of the first PSF star 
	and generates a look-up table of the residuals of the
	actual image data from the Gaussian fit.  If desired, it will then
	fit this PSF to another star (using PKFIT) to determine its precise 
	centroid, scale the same Gaussian to the new star's core, and add the
	differences between the actual data and the scaled Gaussian to the
	table of residuals.   (In other words, the gaussian fit is performed
	only on the first star.)

 SYSTEM VARIABLES:
	Set !DEBUG = 1 to view each iteration of the least squares fit

 Subroutines called:
	RINTER, PKFIT, MAKE_2D, DAOERF, STRNUMBER, STRN

 REVISON HISTORY:
	Adapted from the 1986 version of DAOPHOT in STSDAS
	IDL Version 2  W Landsman           November 1988

(See /usr/local/idl/lib/zastron/daophot/getpsf.pro)


GROUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	GROUP
 PURPOSE:
	Procedure in DAOPHOT sequence to place stars with non-overlapping PSF 
	profiles into distinct groups

 CALLING SEQUENCE:
	GROUP, X, Y, RCRIT, NGROUP

 INPUTS:
	X - vector, giving X coordinates of a set of stars.
	Y - vector, giving Y coordinates of a set of stars.
	RCRIT - scalar, giving minimum distance between stars of two
		distinct groups.  Stars less than this distance from
		each other are always in the same group.    Stetson suggests
		setting the critical distance equal to the PSF radius +
		the Fitting radius.

 OUTPUTS:
	NGROUP - integer vector, same number of elements as X and Y,
		giving a group number for each star position.  Group
		numbering begins with 0.

 METHOD:
	Each position is initially given a unique group number.  The distance
	of each star is computed against every other star.   Those distances
	less than RCRIT are assigned the minimum group number of the set.   A
	check is then made to see if any groups have merged together.

 PROCEDURES USED:
	REM_DUP

 REVISION HISTORY:
	Written W. Landsman  STX                  April, 1988
	Major revision to properly merge groups together  W. Landsman   Sep 1991

(See /usr/local/idl/lib/zastron/daophot/group.pro)


MMM

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	MMM
 PURPOSE: 
	Estimate the sky background, assuming that contaminated sky pixel
	values overwhelmingly display POSITIVE departures from the true
	value.  Adapted from DAOPHOT routine of the same name.

 CALLING SEQUENCE:
	MMM, sky, [ skymde, sigma, skew, HIGHBAD = , DEBUG =  ]

 INPUTS:
	SKY - Array or Vector containing sky values.  This version of
		MMM does not require SKY to be sorted beforehand.  SKY
		is unaltered by this program.

 OPTIONAL OUTPUTS:
	SKYMDE - Scalar giving estimated mode of the sky values
	SIGMA -  Scalar giving standard deviation of the peak in the sky
		histogram.  If for some reason it is impossible to derive
		SKYMDE, then SIGMA = -1.0
	SKEW -   Scalar giving skewness of the peak in the sky histogram
		If no output variables are supplied or if /DEBUG is set
		then the values of SKYMDE, SIGMA and SKEW will be printed.

 OPTIONAL KEYWORD INPUTS:
	HIGHBAD - scalar value of the high "bad" pixel level (e.g. cosmic rays)
		If not supplied, then there is assumed to be no high bad
		pixels.
	DEBUG - If this keyword is set and non-zero, then additional information
		is displayed at the terminal.

 RESTRICTIONS:
	Program assumes that low "bad" pixels (e.g. bad CCD columns) have
	already been deleted from the SKY vector.

 METHOD:
	The algorithm used by MMM consists of roughly two parts:
	(1) The average and sigma of the sky pixels is computed.   These values
	are used to eliminate outliers, i.e. values with a low probability
	given a gaussian with specified average and sigma.   The average
	and sigma are then recomputed and the process repeated up to 20
	iterations:
	(2) The amount of contamination by stars is estimated by comparing the 
	mean and median of the remaining sky pixels.   If the mean is larger
	than the median then the true sky value is estimated by
	3*median - 2*mean
         
 REVISION HISTORY:
	Adapted to IDL from 1986 version of DAOPHOT in STSDAS, 
	W. Landsman, STX Feb 1987
	Adapted for IDL Version 2, J. Isensee, STX, Sept 1990
	Added HIGHBAD keyword, W. Landsman January, 1991
	Fixed occasional problem with integer inputs    W. Landsman  Feb, 1994

(See /usr/local/idl/lib/zastron/daophot/mmm.pro)


NSTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	NSTAR
 PURPOSE:
	Simultaneous point spread function fitting (adapted from DAOPHOT)
 CALLING SEQUENCE:
	nstar, image, id, xc, yc, mags, sky, group, [ phpadu, readns, psfname,
		magerr, iter, chisq, peak, PRINT= , SILENT= ]

 INPUTS:
	image - image array
	id    - vector of stellar ID numbers given by FIND
	xc    - vector containing X position centroids of stars (e.g. as found
		by FIND)
	yc    - vector of Y position centroids
	mags  - vector of aperture magnitudes (e.g. as found by APER)
		If 9 or more parameters are supplied then, upon output
		ID,XC,YC, and MAGS will be modified to contain the new
		values of these parameters as determined by NSTAR.
		Note that the number of output stars may be less than 
		the number of input stars since stars may converge, or 
		"disappear" because they are too faint.
	sky   - vector of sky background values (e.g. as found by APER)
	group - vector containing group id's of stars as found by GROUP

 OPTIONAL INPUT:
	phpadu - numeric scalar giving number of photons per digital unit.  
		Needed for computing Poisson error statistics.   
	readns - readout noise per pixel, numeric scalar.   If not supplied, 
		NSTAR will try to read the values of READNS and PHPADU from
		the PSF header.  If still not found, user will be prompted.
	psfname - name of of SDAS-type file containing point spread
		function as determined by GETPSF, scalar string.  If omitted, 
		NSTAR will prompt for PSFNAME.

 OPTIONAL OUTPUTS:
	MAGERR - vector of errors in the magnitudes found by NSTAR
	ITER - vector containing the number of iterations required for
		each output star.  
	CHISQ- vector containing the chi square of the PSF fit for each
		output star.
	PEAK - vector containing the difference of the mean residual of
		the pixels in the outer half of the fitting circle and
		the mean residual of pixels in the inner half of the
		fitting circle

 OPTIONAL KEYWORD INPUTS:
	SILENT - if set and non-zero, then NSTAR will not display its results
		at the terminal
	PRINT - if set and non-zero then NSTAR will also write its results to
		a file NSTAR.PRT.   One can specify the output file name by
		setting PRINT = 'filename'.

 PROCEDURES USED:
	DAO_VALUE, STRN, SXOPEN, SXREAD, SXPAR

 SYSTEM VARIABLES:
   Set !DEBUG=1 to see the results of each fitting iteration.
 REVISION HISTORY
   W. Landsman                 ST Systems Co.       May, 1988
   Adapted for IDL Version 2, J. Isensee, September, 1990

(See /usr/local/idl/lib/zastron/daophot/nstar.pro)


PKFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	PKFIT
 PURPOSE:
	This procedure is called by GETPSF to perform the one-star 
	least-squares fit in the DAOPHOT sequence
 CALLING SEQUENCE:
	PKFIT, f, scale, x, y, sky, radius, ronois, phpadu, gauss, psf, 
				errmag, chi, sharp, Niter 
 INPUTS:
	F      - NX by NY array containing actual picture data.           
	SCALE  - the initial estimate of the brightness of the star,
		expressed as a fraction of the brightness of the PSF.
		Upon return, the final computed value of SCALE will be
		passed back to the calling routine.
	X, Y   - the initial estimates of the centroid of the star relative
		to the corner (0,0) of the subarray.  Upon return, the
		final computed values of X and Y will be passed back to the
		calling routine.
	SKY  -   the local sky brightness value, as obtained from APER
	RADIUS-  the fitting radius-- only pixels within RADIUS of the
		instantaneous estimate of the star's centroid will be
		included in the fit, scalar
	RONOIS - readout noise per pixel, scalar
	PHPADU - photons per analog digital unit, scalar
	GAUSS -  vector containing the values of the five parameters defining
		the analytic Gaussian which approximates the core of the PSF.
	PSF   -  an NPSF by NPSF look-up table containing corrections from
		the Gaussian approximation of the PSF to the true PSF.

 OUTPUTS:
	ERRMAG - the estimated standard error of the value of SCALE
		returned by this routine.
	CHI    - the estimated goodness-of-fit statistic:  the ratio
		of the observed pixel-to-pixel mean absolute deviation from
		the profile fit, to the value expected on the basis of the
		noise as determined from Poisson statistics and the 
		readout noise.
	SHARP  - a goodness-of-fit statistic describing how much broader  
		the actual profile of the object appears than the
		profile of the PSF.
	NITER -  the number of iterations the solution required to achieve
		convergence.  If NITER = 25, the solution did not converge.
		If for some reason a singular matrix occurs during the least-
		squares solution, this will be flagged by setting NITER = -1.

 RESTRICTIONS:
	No parameter checking is performed
 REVISON HISTORY:
	Adapted from the official DAO version of 1985 January 25
	Version 2.0 W. Landsman STX             November 1988

(See /usr/local/idl/lib/zastron/daophot/pkfit.pro)


RDPSF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	RDPSF
 PURPOSE:
	Read the STSDAS file created by GETPSF in the DAOPHOT sequence; combine 
	the gaussian with the residuals to create an output PSF array.

 CALLING SEQUENCE:
	RDPSF, PSF, HPSF, [ PSFNAME]

 OPTIONAL INPUTS
	psfname - string giving the name of the SDAS file containing the PSF
		residuals

 OUTPUTS
	psf - array containing the actual PSF
	hpsf - header associated with psf

 REVISION HISTORY:
	Written W. Landsman              December, 1988
	Checked for IDL Version 2, J. Isensee & J. Hill, December, 1990

(See /usr/local/idl/lib/zastron/daophot/rdpsf.pro)


SKY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SKY
 PURPOSE:
	Determine the sky level in an image by applying the procedure MMM
	to approximately 4000 uniformly spaced pixels.  Adapted from the
	DAOPHOT routine of the same name.

 CALLING SEQUENCE:
	SKY, image, [ skymode, skysig, CIRCLE = ,/SILENT ]

 INPUTS:
	IMAGE - One or two dimensional array

 OPTIONAL OUTPUT ARRAYS:
	SKYMODE - Scalar, giving the mode of the sky pixel values of the 
		array IMAGE, as determined by the procedure MMM.
	SKYSIG -  Scalar, giving standard deviation of sky brightness

 INPUT KEYWORD PARAMETERS:
	CIRCLERAD - Use the keyword to have SKY only select pixels within
		specified pixel radius of the center of the image.  If 
		CIRCLERAD = 1, then the radius is set equal to half the image
		width.   For example, 

	SILENT - If this keyword is supplied and non-zero, then SKY will not
		display the sky value and sigma at the terminal

 PROCEDURE:
	A regular grid of points, not exceeding 4000 in number, is extracted
	from the image array.  The mode of these pixel values is determined
	by the procedure MMM.

 REVISION HISTORY:
	Written, W. Landsman   STX Co.            September, 1987     
	Changed INDGEN to LINDGEN                 January, 1994
	Fixed display of # of points used         March, 1994

(See /usr/local/idl/lib/zastron/daophot/sky.pro)


SUBSTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	SUBSTAR
 PURPOSE:
	DAOPHOT procedure to subtract a scaled point spread function at specified 
	star position(s).

 CALLING SEQUENCE:
	SUBSTAR, image, x, y, mag, [ id, psfname, /VERBOSE] 

 INPUT-OUTPUT:
	IMAGE -  On input, IMAGE is the original image array.  A scaled
		PSF will be subtracted from IMAGE at specified star positions.
		Make a copy of IMAGE before calling SUBSTAR, if you want to
		keep a copy of the unsubtracted image array

 INPUTS:
	X -   REAL Vector of X positions found by NSTAR (or FIND)
	Y -   REAL Vector of Y positions found by NSTAR (or FIND)        
	MAG - REAL Vector of stellar magnitudes found by NSTAR (or APER)
		Used to scale the PSF to match intensity at star position.

 OPTIONAL INPUTS:
	ID -  Index vector indicating which stars are to be subtracted.  If
		omitted, (or set equal to -1), then stars will be subtracted 
		at all positions specified by the X and Y vectors.

	PSFNAME - Name of the STSDAS (modified FITS) file containing the PSF
		generated by GETPSF.  SUBSTAR will prompt for this parameter
		if not supplied.      

 OPTIONAL INPUT KEYWORD:
	VERBOSE - If this keyword is set and nonzero, then SUBSTAR will 
		display the star that it is currently processing      

 COMMON BLOCKS:
	The RINTER common block is used (see RINTER.PRO) to save time in the
	PSF calculations

 REVISION HISTORY:
	Written, W. Landsman                      August, 1988
	Added VERBOSE keyword                     January, 1992

(See /usr/local/idl/lib/zastron/daophot/substar.pro)


T_APER

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	T_APER
 PURPOSE:
	Driver procedure (for APER) to compute concentric aperture photometry,
	with I/O to FITS ASCII tables.   Adapted from DAOPHOT.

 CALLING SEQUENCE:
	T_APER, image, h, tab, [ apr, skyrad, badpix, TEXTOUT=, SILENT = ]

 INPUTS:
	DATA   - input data array
	H,TAB  - disk FITS table and header (from T_FIND).  Must contain
		the keywords 'X' and 'Y' giving the centroid of the source
		positions in FORTRAN (first pixel is 1) convention.

 OPTIONAL INPUTS:
	User will be prompted for the following parameters if not supplied.

	APR    -  Vector of up to 12 REAL photometry aperture radii.
	SKYRAD  - Two element vector giving the inner and outer radii
		to be used for the sky annulus
	BADPIX  - Two element vector giving the minimum and maximum
		value of a good pixel (Default [-32765,32767])

 OPTIONAL KEYWORDS INPUTS:
	TEXTOUT - If textout is set equal to 3 output will go to file aper.prt
		If textout is not used, output will default to the screen.
	SILENT - If this keyword is set and non-zero, then APER will not
		display photometry results at the screen, and the results 
		will be automatically incorporated in the FITS table without
		prompting the user

 OUTPUTS:
    H,TAB  - FITS ASCII header and table array will be optionally updated 
		with photometry results from APER.  

 REVISON HISTORY:
	Written   W. Landsman   ST Systems Co.            May 1988
	Store results as flux or magnitude                August 1988
	Added textout  keywords, J. Isensee, October, 1990
	Added SILENT keyword  W. Landsman                 Sep. 1991

(See /usr/local/idl/lib/zastron/daophot/t_aper.pro)


T_FIND

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	T_FIND
 PURPOSE:
	Finds positive brightness perturbations (i.e stars) in a 
	2 dimensional image.  Input and output are to FITS ASCII tables

 CALLING SEQUENCE:
	t_find, image, im_hdr, h, tab, [ hmin, fwhm, sharplim, roundlim, 
					TEXTOUT = , SILENT = ]
 INPUTS:
	image - 2 dimensional image array (integer or real) for which one
		wishes to identify the stars present
	im_hdr - FITS or STSDAS header associated with image array

 OPTIONAL INPUTS: 
	T_FIND will prompt for these parameters if not supplied

	fwhm - FWHM to be used in the convolving filter
	hmin - Threshold intensity for a point source - should generally
		be 3 or 4 sigma above background level
	sharplim - 2 element vector giving low and high limit for 
		sharpness statistic (Default: [0.2,1.0] )
	roundlim - 2 element vector giving low and high limit for
		roundness statistic (Default: [-1.0,1.0] )

 OPTIONAL INPUT KEYWORD:
	TEXTOUT -  Optional keyword to control output.  See the procedure
		TEXTOPEN for more info.   If not set, then the system
		variable TEXTOUT is used (default =1 ==> output to the
		screen.)
	SILENT -   If this keyword is set and non-zero, then FIND will work
		silently, and not display each star found

 OUTPUTS:
	h - output FITS table header array
	tab - output FITS table array

 REVISION HISTORY:
	Written W. Landsman, STX  May, 1988
	Added detector and textout keywords, J. Isensee, STX, October, 1990
	Added phpadu, J. Hill, STX, October, 1990

(See /usr/local/idl/lib/zastron/daophot/t_find.pro)


T_GETPSF

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	T_GETPSF
 PURPOSE:
	Generate a point-spread function from one or the sum
	of several isolated stars using FITS table I/O.  Residuals
	are written to an STSDAS image file.

 CALLING SEQUENCE:
	t_getpsf, image, h, tab, [ idpsf, psfrad, fitrad, psfname ]

 INPUTS:
	IMAGE - image array
	H     - header of FITS ASCII table created by T_APER
	TAB   - FITS ASCII table array created by T_APER

 OPTIONAL INPUTS (GETPSF will prompt for these if not supplied.)
	IDPSF - vector of stellar ID numbers indicating which stars
		are to be used to create the PSF.  Should be in IDL
		convention (first star number is 0.)
	PSFRAD - the radius for which the PSF will be defined
	FITRAD - fitting radius, always smaller than PSFRAD
	PSFNAME - name of STSDAS image file to contain PSF residuals,
		scalar string
 OUTPUTS:
	H,TAB - the field "PSF CODE" in the FITS ASCII table will be updated
		to indicate which stars were used for the PSF

 REVISION HISTORY:
	Written  W. Landsman     STX           May, 1988

(See /usr/local/idl/lib/zastron/daophot/t_getpsf.pro)


T_GROUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	T_GROUP
 PURPOSE:
	Procedure to place stars with non-overlapping PSF profiles into
	distinct groups.  Input and output are to disk FITS tables

 CALLING SEQUENCE:
	t_group, h, tab, [ rmax, XPAR = , YPAR = ]

 INPUTS:
	h -   header array for output table created by T_APER
	tab - table array created by T_APER

 OPTIONAL INPUTS:
	rmax - maximum allowable distance between stars in a single group

 OPTIONAL INPUT KEYWORDS:
	XPAR, YPAR - scalar strings giving the field name in the output table
		containing the X and Y coordinates.   If not supplied,
		then the fields 'X' and 'Y' are read.

 REVISION HISTORY:
	Written, W. Landsman        ST Sytems Co.      May, 1988
	Keyword variables xpar, ypar added by J. Hill Hughes STX April, 1992

(See /usr/local/idl/lib/zastron/daophot/t_group.pro)


T_NSTAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	T_NSTAR
 PURPOSE:
	Simultaneous point spread function fitting.  Input and output are to
	FITS ASCII tables.

 CALLING SEQUENCE:
	T_NSTAR,IMAGE,H,TAB,[PSFNAME,GROUPSEL]
 INPUTS:
	IMAGE - image array
	H     - FITS ASCII table header from T_APER
	TAB   - FITS ASCII table array from  T_APER

 OPTIONAL INPUTS:
	PSFNAME - Name of SDAS file created by T_GETPSF containing
		PSF residuals
	GROUPSEL - Scalar or vector listing the groups to process.  For
		example, to process stars in groups 2 and 5 set
		GROUPSEL = [2,5].  If omitted, or set equal to -1,
		then NSTAR will process all groups.

 OUTPUTS:
	H,TAB - will be updated to contain the output of NSTAR

 OPTIONAL KEYWORD INPUTS:
	SILENT - if set and non-zero, then NSTAR will not display its results
		at the terminal
	PRINT - if set and non-zero then NSTAR will also write its results to
		a file NSTAR.PRT.   One can specify the output file name by
		setting PRINT = 'filename'.

 REVISION HISTORY:
	Written        W. Landsman         STX Co.    May, 1988

(See /usr/local/idl/lib/zastron/daophot/t_nstar.pro)


UIT_FIND

[Previous Routine] [List of Routines]
 NAME:
	UIT_FIND
 PURPOSE:
	Find positive brightness perturbations (i.e stars) in a 
	2 dimensional image and compute centroids, and shape parameters,
	Adapted from DAOPHOT.

 CALLING SEQUENCE:
      	UIT_FIND, image, [ x, y, flux, sharp, round, hmin, fwhm, roundlim, 
			sharplim, TEXTOUT = ,HMAX = , RCRIT = ]

 INPUTS:
	image - 2 dimensional image array (integer or real) for which one
		wishes to identify the stars present

 OPTIONAL INPUTS:
	UIT_FIND will prompt for these parameters if not supplied

	hmin -  Threshold intensity for a point source - should generally 
		be 3 or 4 sigma above background
	fwhm  - FWHM to be used in the convolve filter
	sharplim - 2 element vector giving low and high cutoff for the
		sharpness statistic (Default: [0.2,1.0] )
	roundlim - 2 element vector giving low and high cutoff for the
		roundness statistic (Default: [-1.0,1.0] )

 OPTIONAL OUTPUTS:
	x - vector containing x position of all stars identified by UIT_FIND
	y-  vector containing y position of all stars identified by UIT_FIND
	flux - vector containing flux of identified stars as determined
		by a gaussian fit.  Fluxes are NOT converted to magnitudes.
	sharp - vector containing sharpness statistic for identified stars
	round - vector containing roundness statistic for identified stars

 OPTIONAL KEYWORD INPUTS:

	TEXTOUT - Determines where output results will be printed (see
		TEXTOPEN ) If not used, defaults to !TEXTOUT value. 

	HMAX - Maximum allowed intensity value for a valid source.  If not
		suppied, then hmax = 20000 to agree with BDR.

	RCRIT - Scalar giving the maximum distance from the image center for 
		valid source.   To agree with BDR the default value of RCRIT is
		990 for 2048 x 2048 UIT images.

 SYSTEM VARIABLES:
	If !TEXTOUT=3 then an output file UIT_FIND.PRT will be created which
	will contain a table of information on identified stars

 REVISION HISTORY:
	Written W. Landsman, STX  February, 1987
	Adapted for IDL Version 2, J. Isensee, STX, October, 1990
	Added HMAX keyword   W. Landsman     STX     August, 1991

(See /usr/local/idl/lib/zastron/daophot/uit_find.pro)