idlastro / DAOPHOT-Type Photometry Procedures: PKFIT

[Source code]

NAME
PKFIT
PURPOSE
Subroutine of  GETPSF to perform a one-star least-squares fit 
EXPLANATION
Part of the DAOPHOT PSF photometry sequence
CALLING SEQUENCE
PKFIT, f, scale, x, y, sky, radius, ronois, phpadu, gauss, psf, 
                        errmag, chi, sharp, Niter, /DEBUG 
INPUTS
F      - NX by NY array containing actual picture data.           
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.
INPUT-OUTPUT
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.
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
Converted to IDL V5.0   W. Landsman   September 1997