Go back
psf_phot combines the main steps to perform a PSF photometry on a list of images.

The following steps are performed by the procedure. Read also carefully the psf_phot parameters description by using lpar psf_phot (listed below)

## PSF photometry : Building the PSF.
   The 1st pass is to create the PSF models (i.e. psfsel+, redo_psf+, run_alst-, checkals-).
   The 1st added star to the PSF list has to be the best faintest star, so that the PSF
   model magnitude is scaled to the magnitude of such star for which we want excellent PSF photometry.
   After PSF stars have been selected fit the PSF model with 'f', point the mouse to that
   star and push 's' to see the residual. It should be close to the noise. Ideally, selected
   PSF stars should have the same postion of the central pixel, i.e. the location of the
   peak in the radial plot has to be the same, just to the right of the 0 mark.
   
The following boolean switches:
re_find+, psfsel+, redo_psf+, run_alst+, checkals+
will lead to
1) find stars
2) select best stars (merr<0.1) and circle them on the ds9 display.
3) you will have to select the best PSF stars 4) perform PSF photometry with allstar and
4) will ask to examine the result (see the text in the terminal window)
5) will ask for YES or no input after quitting 4).
6) if 5) is no, you will rebuild the PSF from new selection of more PSF stars
   from the popup graph based on low merr and close to 0 sharp value (follow terminal window instructions)
7) will send you back to 4 and 5.
8) if at 4) you say YES, you're done.

###############
Useful sequence if working on a big list of images to let it run some parts non interactively:

re_find+, psfsel-, redo_psf-, run_alst-, checkals-
non interactively it will perform only finding stars with the respective detection parameters

re_find-, redo_psf+, psfsel+, run_alst+, checkals-
interactively it will walk you through basic PSF star selection and building the PSF model for the 1st iteration

re_find-, redo_psf+, psfsel+, run_alst-, checkals+
interactively, it will use the above als.1 files from which to improve the PSF star list and model (based on merr and sharp)

re_find-, redo_psf-, psfsel-, run_alst+, checkals-
non interactively will use the PSF model and perform the PSF photometry on the latest re_find+ star list

#############
daophot> lpar psf_phot
       images = ""              Input images
     (re_find = yes)            Run daofind? If no, existing *.mag.1 files will be used
     (fwhmpsf = 5)              FWHM of the PSF (for detectionf)
       (sigma = "20")           Standard deviation of background in counts (or header keyword: !STDDEV)
   (threshold = 100)            Threshold in sigma for detecting stars
     (datamax = 65000)          Maximum good value\n
      (psfsel = yes)            Interactive PSF star selection? If no, uses existing "default".pst.1 file
   (apertures = "12")           Aperture radus for PSF stars (same as psfrad)
        (zmag = 0)              Zero point of magnitude scale
     (annulus = 12)             Inner radius of sky annulus
    (dannulus = 5)              Width of sky annulus
    (datapars = "")             Modify other data parameters
    (findpars = "")             Modify other detection parameters\n
  (salgorithm = "mode")         Sky fitting algorithm
  (calgorithm = "centroid")     Centering algorithm
     (ccdread = "RDNOISE")      Readout noise image header keyword
        (gain = "GAIN")         Gain image header keyword
    (exposure = "EXPTIME")      Exposure time image header keyword
      (filter = "FILTERS")      Filter image header keyword
     (airmass = "AIRMASS")      Airmass image header keyword\n
    (redo_psf = yes)            Rebuild the psf?
    (run_alst = yes)            Run allstar?
    (function = "auto")         Form of analytic component of psf model
    (varorder = 0)              Order of empirical component of psf model
      (psfrad = 12.)            Radius of psf model in scale units
    (sannulus = 5.)             Inner radius of sky fitting annulus in scale units
   (wsannulus = 5.)             Width of sky fitting annulus in scale units
    (recenter = yes)            Recenter stars during fit ?
    (groupsky = no)             Use group rather than individual sky values ?
    (checkals = yes)            See the PSF model subtracted image from allstar?\n(If YES, you go back to rebuild the PSF)
        (mode = "ql")          
##################

## DEMO
## The IRAF native PSF task can not be nested in a loop. Therefore all lines has to be executed as below for each list.
task psf_phot="/path/to/script/psf_phot.cl"
unlearn psf_phot

page IMG_whiting1_pointing01_cmb_long_lst
 Whiting-1_IMG_whiting1_pointing01_725_Q1_B_cmb.fits
 Whiting-1_IMG_whiting1_pointing01_727_Q1_V_cmb.fits
 Whiting-1_IMG_whiting1_pointing01_729_Q1_I_cmb.fits
Whiting-1_IMG_whiting1_pointing01_725_Q2_B_cmb.fits
Whiting-1_IMG_whiting1_pointing01_727_Q2_V_cmb.fits
Whiting-1_IMG_whiting1_pointing01_729_Q2_I_cmb.fits
Whiting-1_IMG_whiting1_pointing01_725_Q3_B_cmb.fits
Whiting-1_IMG_whiting1_pointing01_727_Q3_V_cmb.fits
Whiting-1_IMG_whiting1_pointing01_729_Q3_I_cmb.fits
Whiting-1_IMG_whiting1_pointing01_725_Q4_B_cmb.fits
Whiting-1_IMG_whiting1_pointing01_727_Q4_V_cmb.fits
Whiting-1_IMG_whiting1_pointing01_729_Q4_I_cmb.fits

# Non interactive star finding
psf_phot("@IMG_whiting1_pointing01_cmb_long_lst", fwhmpsf=4., sigma="!STDDEV", threshold=3, datamax=50000,\
apertures="7", annulus=7, zmag=0, psfrad=12, varorde=0, sannulus=12, wsannulus=5,\
re_find+, psfsel-, redo_psf-, run_alst-, checkals-)

# Interactive 1st iteration of modelling the PSF
psf_phot("@IMG_whiting1_pointing01_cmb_long_lst", fwhmpsf=4., sigma="!STDDEV", threshold=3, datamax=50000,\
apertures="7", annulus=7, zmag=0, psfrad=12, varorde=0, sannulus=12, wsannulus=5,\
re_find-, redo_psf+, psfsel+, run_alst+, checkals-)

# Interactive 2nd iteration for improving the PSF model
psf_phot("@IMG_whiting1_pointing01_cmb_long_lst", fwhmpsf=4., sigma="!STDDEV", threshold=3, datamax=50000,\
apertures="7", annulus=7, zmag=0, psfrad=12, varorde=0, sannulus=12, wsannulus=5,\
re_find-, redo_psf+, psfsel-, run_alst+, checkals+)

# Non interactive star finding with much lower threshold to detect "everything"
psf_phot("@IMG_whiting1_pointing01_cmb_long_lst", fwhmpsf=4., sigma="!STDDEV", threshold=3, datamax=50000,\
apertures="7", annulus=7, zmag=0, psfrad=12, varorde=0, sannulus=12, wsannulus=5,\
re_find+, psfsel-, redo_psf-, run_alst-, checkals-)

# Non interactive final allstar psf photometry using the improved in 2nd iteration PSF model
psf_phot("@IMG_whiting1_pointing01_cmb_long_lst", fwhmpsf=4., sigma="!STDDEV", threshold=3, datamax=50000,\
apertures="7", annulus=7, zmag=0, psfrad=12, varorde=0, sannulus=12, wsannulus=5,\
re_find-, redo_psf-, psfsel-, run_alst+, checkals-)

############################################
OBSOLETE (but may contain useful tips)
############################################


1. daofind is called to find and pre-select PSF stars above the specified 'threshold' for PSF stars with a given 'fwhm' and image 'sigma' level. Those preselected stars are marked with circles on the ds9 display window (see tip 1).

2. The IRAF psf task is called, i.e. it is assumed that the user is familiar with its interactive commands.
At this point, by pressing 'a' for add or 'd' for delete, one respectively adds or deletes stars from the list from which the PSF models will be computed. Pressing 'a' gives a radial plot of the stellar profile. If it is a good star, then push again 'a', otherwise 'd' to delete it from the PSF star list. When finished press 'w' to fit and save the model and 'q' to proceed with next step. (Recommended for this step: see tip 2).

3. allstar is called to perform the psf photometry. The residual image is displayed and the PSF stars are circled. See the text in the  terminal window. If you are happy with the result, press 'q' and type YES (case sensitive) in the terminal window to finish. Type NO to go back to Step 1 and repeat everything.

There are two ways to execute this procedure. First, is to set the threshold very high so that you save time with waiting for the detection of all possible objects before you proceed to the PSF selection and modelling. When done with the PSF step, set the detection threshold accordingly and run the procedure again, but with the 'repsfsel-' to disable the PSF step and directly use the model PSFs for the allstar photometry.


Tips and details:

1. The initial daofind setup may not give you the optimal guess for the PSF star list. If you are not happy with the preselected stars marked on the ds9 window, just push 'q' few times to Interrupt. Delete temporarily created files, adjust the threshold and fwhm and execute again.

2. Selecting PSF stars.
2.1 Examine first the radial profiles of the marked stars in the ds9 window by adding ('a') and deleting them ('d') from the list. You should add as first star in yor PSF star list the best PSF star, i.e. with no neighbours, good radial profile and of magnitude/brightness comparable to the brightness of the objects you want to do PSF photometry for. That is because the first selected PSF star in the list will be used for the magnitude scale of the PSF model.
2.2. Mark in ds9 with the mouse button with circles the stars added to the PSF list. This will be come handy for the next tip.
2.3. When finished with selecting PSF stars, press 'f' to perform the PSF profile fitting (observe the terminal window). When finished, point the mouse over a selected PSF star and press 's' to see the residual radial plot (PSF model - star), press 'a' to keep the star or 'd' to remove it from the list. First examine all stars (with 's' followed by 'a') before deleting, because you will have to update the PSF model, i.e. push 'f'). You can point and add 'a' a new star to the list as well. A handy tip is to mark with different ds9 circles the stars which you want to delete, and then actually delete them with 's' followed by 'd'. When done, press 'f' to redo the fit. You can repeat this tep as many times as you want until you are satisfied with the residuals' plot. Star will never be perfectly subtracted, but it is important that the residuals are simetric and as small as possible. When happy, press 'w' to finally write the PSF model (default naming is assumed).