Simultaneous point spread function fitting (adapted from DAOPHOT)
This PSF fitting algorithm is based on a very old (~1987) version of
DAOPHOT, and much better algorithms (e.g. ALLSTAR) are now available
-- though not in IDL.
NSTAR, image, id, xc, yc, mags, sky, group, [ phpadu, readns, psfname,
magerr, iter, chisq, peak, /PRINT , /SILENT, /VARSKY, /DEBUG ]
image - image array
id - vector of stellar ID numbers given by FIND
xc - vector containing X position centroids of stars (e.g. as found
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
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 FITS image file containing the point spread
function residuals as determined by GETPSF, scalar string.
If omitted, then NSTAR will prompt for this parameter.
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
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
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 also can specify the output file name
by setting PRINT = 'filename'.
/VARSKY - if this keyword is set and non-zero, then the sky level of
each group is set as a free parameter.
/DEBUG - if this keyword is set and non-zero, then the result of each
fitting iteration will be displayed.
DAO_VALUE(), READFITS(), REMOVE, SPEC_DIR(), STRN(), SXPAR()
RINTER - contains pre-tabulated values for cubic interpolation
W. Landsman ST Systems Co. May, 1988
Adapted for IDL Version 2, J. Isensee, September, 1990
Minor fixes so that PRINT='filename' really prints to 'filename', and
it really silent if SILENT is set. J.Wm.Parker HSTX 1995-Oct-31
Added /VARSKY option W. Landsman HSTX May 1996
Converted to IDL V5.0 W. Landsman September 1997
Replace DATATYPE() with size(/TNAME) W. Landsman November 2001
Assume since V5.5, remove VMS calls W. Landsman September 2006