IRAF help page for package noao.digiphot.daophot, program psf

from NOAO psf -- build the point spread function for an imageUSAGEPARAMETERSDESCRIPTIONCURSOR COMMANDSALGORITHMSGUIDE TO COMPUTING A PSF IN A CROWDED FIELDEXAMPLESTIME REQUIREMENTSBUGSSEE ALSO

psf -- build the point spread function for an image


USAGE

psf image photfile pstfile psfimage groupfile


PARAMETERS

image

The image for which to build the PSF.

photfile

The name of the input file or directory containing the input photometry. If photfile is "default", "dir$default" or a directory specification then PSF looks for a file called image.mag.? where ? is the highest existing version number. Photfile is usually the output of the DAOPHOT PHOT task but may also be the output groupfile produced by PSF itself, or the output of the GROUP, NSTAR, PEAK or ALLSTAR tasks. Photfile may be an APPHOT/DAOPHOT text database or an STSDAS table.

pstfile

The name of the input file or directory containing the ids from photfile of an initial list of psf stars. If pstfile is null (""), no psf star list is read in. If pstfile is "default", "dir$default" or a directory specification then PSF looks for a file called image.pst.? where ? is the highest existing version number. Pstfile is usually the output of the DAOPHOT PSTSELECT task but may also be the appropriately edited output groupfile produced by PSF itself, or the output of the GROUP, NSTAR, PEAK or ALLSTAR tasks. Photfile may be an APPHOT/DAOPHOT text database or an STSDAS table.

psfimage

The output image name or directory for the final PSF. If psfimage is "default", "dir$default" or a directory specification then PSF creates an image called image.psf.? where ? is the next available version number.

opstfile

The output psf star list file name or directory for storing the PSF stars actually used to compute the psf. If opstfile is "default", "dir$default" or a directory specification then PSF creates a file called image.pst.? where ? is the next available version number. If the DAOPHOT package parameter text is "yes" then an APPHOT/DAOPHOT text database is written, otherwise an STSDAS table database is written.

groupfile

The output group file name or directory for storing the PSF stars and their neighbors. If groupfile is "default", "dir$default" or a directory specification then PSF creates a file called image.psg.? where ? is the next available version number. If the DAOPHOT package parameter text is "yes" then an APPHOT/DAOPHOT text database is written, otherwise an STSDAS table database is written.

plotfile =

The name of the output file containing mesh, contour, or profile plots of the selected PSF stars. If plotfile is null ("") no plot file is created, otherwise a mesh, contour, or profile plot is written to this file for each PSF star selected. Plotfile is opened in append mode and can become very large.

datapars =

The name of the text file containing the data dependent parameters. If datapars is null ("") then the default parameter set in the user's uparm directory is used.

daopars =

The name of the text file containing the DAOPHOT fitting parameters. If daopars is null ("") then the default parameter set in the user's uparm directory is used.

matchbyid = yes

Match the stars in the psf star list(s) if any to the stars in the input photometry files using id numbers (matchbyid = yes) or x and y positions (matchbyid = no).

interactive = yes

Fit the PSF interactively? If interactive = yes and icommands is null (""), PSF will read in an initial list of PSF stars from pstfile and then wait for commands from the user. If interactive=no and icommands="", PSF reads in the candidate PSF stars in pstfile, computes the PSF, and writes it to psfimage without input from the user. If icommands is not "", then interactive is automatically set to "no", and commands are read from the image cursor command file.

showplots = yes

Show plots of the selected PSF stars? After each star is selected interactively by the user, a mesh, contour, or profile plot of the data subraster around the candidate star is displayed. At this point the user can accept or reject the star. In interactive mode when commands are being read from the image cursor parameter icommands the user can set showplots to "yes" or "no". In non-interactive mode when icommands is set to a cursor command file or when interactive = "no", showplots is always "no".

plottype = mesh

The default type of plot displayed when selecting PSF stars. The choices are "mesh", "contour", or "radial".

verify = )_.verify

Verify the critical PSF task parameters? Verify can be set to the default daophot package parameter value, "yes", or "no".

update = )_.update

Update the critical PSF task parameters if verify is "yes"? Verify can be set to the default daophot package parameter value, "yes", or "no".

graphics = )_.graphics

The default graphics device. Graphics can be set to the default daophot package parameter value, "yes", or "no".

display = )_.display

The default image display device. Display can be set to the default daophot package parameter value, "yes", or "no".

icommands =

The image display cursor.

gcommands =

The graphics cursor.


DESCRIPTION

The PSF task builds the point spread function for the IRAF image image using stars selected from the input photometry file photfile by the image cursor and/or their ids stored in the file pstfile, and writes the PSF out to the IRAF image psfimage, the final PSF star list to opstfile, and group membership information for the selected PSF stars to groupfile. If the DAOPHOT package parameter text is "yes" then groupfile is a text database, otherwise it is an STSDAS table database.

Suitable PSF stars are normally selected interactively using the image display and image cursor and matched with the stars in photfile using the cursor position and a tolerance specified by the matchrad parameter in the DAOPARS task. A star must be in the photometry file before it can be used as a PSF star. If a match is found, PSF checks that the candidate star is not too close to the edge of the image and that it contains no bad pixels as defined by datamin and datamax in the DATAPARS task. After selection a mesh, contour, or profile plot of the data subraster around the candidate star is displayed in the graphics window, PSF enters graphics cursor command mode and the user has the option to accept or reject the star. If the user accepts the star it is added to the PSF star list. Commands in the the graphics cursor menu permit the user to manipulate the floor and ceiling levels of the contour plot and viewing angles for the mesh plot interactively.

Users who know which stars they wish to use as PSF stars ahead of time or who are without access to an image display can also select PSF stars by id number. Mesh, contour, or radial profile plots will be displayed in the graphics window in the usual way.

Finally if the user does not wish to see any plots of the PSF stars or interact with the fitting process, the image cursor may be redirected to a text file containing cursor commands which specify the PSF stars to be used in the fit. Plots of the resulting contour, mesh, or profile plots can be saved in a metacode plot file if a name is supplied for the plotfile parameter.

In normal interactive mode, the PSF star list can be initialized by setting pstfile to the file created by the PSTSELECT task. If showplot = "yes" the user is asked to verify each star in the input list. Stars can also be added and deleted from this list at any time with the image cursor. If interactive=no or icommands is set, the PSF stars are read in from pstfile, and the PSF is computed and written out without input from the user.

The output PSF image psfimage is normally a 2D image containing the image header parameters, "XPSF", "YPSF", "PSFMAG" and "PSFRAD" which defines the centroid, magnitude and size of the PSF, the parameters "FUNCTION", "PSFHEIGH", "NPARS", and "PAR#" which define the analytic component of the PSF, and a single look-up table of residuals from the analytic fit, which has been subsampled by a factor of 2.

If the DAOPARS parameter varorder = -1, the PSF is fit by the analytic function only and psfimage has no pixel file.

If the DAOPARS parameter varorder = 1 or 2, then two or five additional lookup tables are computed and psfimage is a 3D image with 3 or 6 planes respectively. The first two additional look-up tables contain the first derivatives of the PSF wrt the x and y positions in the image (varorder = 1), and the next three contains the second derivatives with respect to x ** 2, xy, and y ** 2 (varorder = 2).

The magnitudes of each of the stars contributing to the PSF are also stored in the PSF image header.

Groupfile contains a list of the PSF stars, their nearest neighbours, and friends of the neighbours. A neighbor is defined to be any star within a distance of 1.5 * psfrad / scale + 2.0 * fitrad / scale + 1 pixels of the PSF star. Friends of the neighbours are defined to be any stars within 2.0 * fitrad / scale + 1.0 of a neighbour star. Fitrad and psfrad are respectively the fitting radius and psf radius parameters in the DAOPARS task. Scale is the scale factor defined in the DATAPARS task.


CURSOR COMMANDS

The following cursor commands are available once the image cursor has been activated.

	Keystroke Commands 
?	Print help
p	Print photometry for star nearest the cursor
l	List the current psf stars
a	Add star nearest cursor to psf star list
f	Fit the psf
r	Review the fit for all the psf stars
s	Subtract fitted psf from psf star nearest cursor
d	Delete psf star nearest cursor from psf star list
w	Write the psf to the psf image
z	Rebuild the psf from scratch
q	Quit task
	Colon Commands
:p [n]	Print photometry for star n
:a [n]	Add star n to psf star list
:d [n]	Delete star n from psf star list
:s [n]  Subtract fitted psf from psf star n   
	Colon Parameter Editing Commands
# Data dependent parameters which affect the psf computation 
:scale	   [value]	Show/set the image scale (units / pixel)
:fwhmpsf   [value]	Show/set the fwhm of psf (scale units)
:datamin   [value]	Show/set the minimum good data value (counts)
:datamax   [value]	Show/set the maximum good data value (counts)
:matchrad  [value]	Show/set matching radius (scale units)
# Psf computation parameters
:psfimage   [name,name]	Show/set the psf image and groupfile
:function   [string]	Show/set the analytic psf function
:varorder   [integer]	Show/set order of psf function variability
:nclean	    [integer]	Show/set number of cleaning iterations
:saturated  [y/n]	Show/set the use saturated star flag
:psfrad	    [value]	Show/set the psf radius (scale units)
:fitrad	    [value]	Show/set the fitting radius (scale units)
The following cursor commands are available once a star has been selected 
and the graphics cursor has been activated.
	Interactive Graphics Keystroke Commands
?    	Print help
p	Print the photometry for this star
t	Print the plot parameters and data minimum and maximum
a	Accept star and proceed
d	Reject star and select another with image cursor
m	Plot the default mesh plot for this star
n	Increase vertical angle by 15 degrees (mesh plot only)
s	Decrease vertical angle by 15 degrees (mesh plot only)
w	Decrease horizontal angle by 15 degrees (mesh plot only)
e	Increase horizontal angle by 15 degrees (mesh plot only)
c	Plot the default contour plot for this star
r	Plot the radial profile for this star
	Colon Graphics Commands
:m [val] [val]	Set the mesh plot vertical and horizontal viewing angles
:v [val]        Set the mesh plot vertical viewing angle
:h [val]        Set the mesh plot horizontal viewing angle
:c [val] [val]  Set the contour plot floor and ceiling levels
:l [value]	Set the contour plot floor level
:u [value]	Set the contour plot ceiling level


ALGORITHMS

The PSF is determined from the actual observed brightness values as a function of x and y for one or more stars in the frame and stored as a two-component model. The first component is an analytic function which approximates the light distribution in the cores of the PSF stars. There are currently 6 choices for the analytic component of the model: "gauss", "moffat15", "moffat25", "lorentz", "penny1", and "penny2". The parameters of the analytic component of the psf model are stored in the psf image header parameters "FUNCTION", "PSFHEIGH", "NPARS", and "PARN". The magnitude, size, and centroid of the PSF are stored in the image header parameters "PSFMAG", "PSFRAD", "XPSF", "and "YPSF". "PSFMAG" is always the magnitude of the first PSF star and "XPSF" and "YPSF" are the center of the image. If varorder >= 0, the residuals from this fit are stored as a lookup table with twice the sampling interval of the original image. This lookup table is used as additive corrections from the integrated analytic function to actual observed empirical PSF. The parameters of the analytic function are computed by fitting all the stars weighted by their signal-to-noise. so that the signal-to-noise ratio in the PSF does not deteriorate as fainter stars are added in. The more crowded the field the more PSF stars are required to lower the noise generated by neighbour subtraction.

If the varorder parameter in the DAOPARS task is set to 1 or 2, two or five additional lookup tables containing the first derivatives of the PSF in x and y and the second order derivatives of the image with respect to x ** 2, x * y, and y ** 2 are also written. This model permits the PSF fitting process to take account of smooth linear or quadratic changes in the PSF across the frame caused for example by a tilt in the detector with respect to the optical axis or low order optical aberrations. Users of this option should ensure that the PSF varies in a systematic way across the frame and that the chosen PSF stars span the entire region of interest in the frame. To avoid mistaking neighbour stars for variations in the PSF it is recommended that the first few iterations of PSF be run with a constant PSF. Only after neighbour stars have been subtracted reasonably cleanly should the variable PSF option be enabled.

The brightness of any hypothetical pixel at any arbitrary point within the PSF is computed as follows. The analytic function is integrated over the area of the pixel, a correction is determined by bicubic interpolation within the lookup table and added to the integral. Since the values in the table of residuals differ by smaller amounts between adjacent grid points than the original brightness data would have, the errors in the interpolation are much less than they would have been if one had tried to interpolate directly within the original data.


GUIDE TO COMPUTING A PSF IN A CROWDED FIELD

The following is a rough guide to the methodology of computing the PSF in a crowded field. The procedure outlined below assumes that the user can either make use of the IRAF display facilities or has access to a local display program. At a minimum the display program should be able to display an image, read back the coordinates of objects in the image, and mark objects in the image.

The crowded field PSF fitting procedure makes use of many of the DAOPHOT tasks. Details on the setup and operation of each task can be found in the appropriate manual pages.

[1]

RUN THE DAOFIND and PHOT TASKS ON THE IMAGE OF INTEREST.

[2]

EXAMINE THE IMAGE. Load the image on the display with the IRAF display task. Using the display itself, the DAOEDIT task, or the IRAF IMEXAMINE task, estimate the radius at which the stellar light distribution disappears into the noise for the brightest candidate PSF star. Call this parameter psfrad and record it. Mark the objects detected by DAOFIND with dots on the image display using the IRAF TVMARK task. Users at sites with display devices not currently supported by IRAF should substitute their local versions of DISPLAY and TVMARK.

[3]

SELECT CANDIDATE PSF STARS. Good PSF stars should have no neighbours within the fitting radius stored in the DAOPARS task parameter fitrad. In addition all stars within 1.5 times the psf radius, (stored in the DAOPARS task parameter psfrad), should be significantly fainter than the candidate star. There should be no bad columns, bad rows or blemishes near the candidate star. A sufficient number of stars should be selected in order to reduce the increased noise resulting from the neighbour subtraction process. Users of the variable PSF option should take care that the list of PSF stars span the area of interest on the image. Twenty-five to thirty stars is not unreasonable in this case.

The task PSTSELECT can be used to preselect candidate PSF stars. These candidate PSF stars can be marked on the image display using the PDUMP, and TVMARK tasks. Be sure to mark the PSF stars in another color from the stars found by DAOFIND. Stars can be added to or subtracted from this list interactively when PSF is run.

[4]

EXAMINE THE PSF STARS FOR NEIGHBOURS MISSED BY DAOFIND AND ADD THESE TO THE PHOT FILE. Examine the vicinity of the PSF stars on the display checking for neighbour stars which do not have dots on them indicating that they were missed by DAOFIND. If IRAF supports the local display device simply run PHOT interactively selecting the missing stars with the image cursor. Be sure to use the same set of PHOT parameters used in step [1] with the exception of the CENTERPARS task parameter calgorithm which should be temporarily set to "centroid". If IRAF does not support the local display generate a list of the approximate coordinates of the missing stars. Run PHOT in batch mode with this coordinate list as input and with the parameters set as described above. Create a new PHOT file by using PCONCAT to add the new PHOT output to the PHOT output from [1] and renumber using PRENUMBER. Do not resort.

[5]

ESTIMATE OF THE PSF. Run PSF using the combined PHOT output from [4] and the list of candidate stars from [3]. Write out the PSF image (extension .psf.#) and the psf group file (extension .psg.#). The PSF image is the current estimate of the PSF.

[6]

FIT ALL THE STARS IN EACH PSF STAR GROUP IN THE ORIGINAL IMAGE. Run NSTAR on the image using the output group file (extension .psg.#) of [5] as the input photometry list. To help prevent the bumps in the initial PSF from interfering with the profile fits in NSTAR, it may be necessary to temporarily set the psf radius, psfrad in the DAOPARS task, to about one pixel greater than the separation of the nearest neighbour to a PSF star. The fitting radius, fitrad in the DAOPARS task, should be sufficiently large to include enough pixels for a good fit but not so large as to include any neighbours inside the fitting radius.

[7]

SUBTRACT ALL THE FITTED STARS FROM THE ORIGINAL IMAGE. Run SUBSTAR to subtract the NSTAR results from the original image. Use the IRAF DISPLAY task or the local display program to display the subtracted image. If you decreased the value of psfrad in [6] use this smaller value when you subtract as well.

[8]

CHECK FOR PREVIOUSLY INVISIBLE FAINT COMPANIONS. Check to see whether the PSF stars and neighbours subtracted cleanly or whether there are faint companions that were not previously visible before.

[9]

APPEND THESE COMPANIONS TO THE PHOT FILE. Run PHOT on the faint companions in the subtracted image and append the results to the PHOT file created in [4] using PCONCAT. Renumber the stars using PRENUMBER.

[10]

SUBTRACT ALL THE PSF NEIGHBOR STARS FROM THE ORIGINAL IMAGE. Edit the nstar output file (extension .nst.#) removing all the PSF stars from the file. The PSF stars is the first one in each group. In the near future this will be done with the PEXAMINE task but at the moment the text editor can be used for text databases and the TTOOLS package task TEDIT can be used for tables. PSELECT can also be used to remove stars with specific id numbers. Run SUBSTAR using the edited nstar output file as input.

[11]

RECOMPUTE THE PSF. Run PSF on the subtracted image from [10] using the PHOT file from [9] as the input stellar photometry file. Temporarily set the minimum good data value, the datamin parameter in the DATAPARS task to a large negative number, to avoid the enhanced noise where the stars were subtracted from triggering the bad pixel detector in PSF. A new psf (extension .psf.#) and new psf group file (extension .psg.#) will be created. Be sure to increase the psfrad value to the original large value found in [2].

[12]

RERUN NSTAR. Rerun NSTAR on the original image with the newly created group file (extension .psg.#) as the input stellar photometry file and the newly computed PSF image (extension .psf.#). It should not be necessary to reduce the psf radius as in [6] but the fitting radius should be left at a generous number.

[13]

REPEAT STEPS [7-12] UNTIL THE PSF FIT IS ACCEPTABLE. If any neighbours are still visible iterate on this process by repeating steps [7] to [12] until the neighbours completely disappear. The main point to remember is that each time through the loop the PSF is obtained from an image in which the neighbours but not the PSF stars have been subtracted out while NSTAR and SUBSTAR should be run on the original picture with all the stars still in it.


EXAMPLES

1. Compute the PSF for a field near the cluster ngc4147. Select stars using the display and the image cursor and show plots of the data and the residuals from the fit for each star.

	da> set stdimcur = stdimage
	... define the image cursor
	da> display n4147 1 fi+
	... display the image
	da> epar psf
	... edit the psf parameters
	... move to the datapars line and type :e
            edit the data dependent parameters
	    type :q to quit the datapars menu
	... move to the daopars line and type :e
            edit the daophot fitting parameters
	    type :q to quit the daopars menu
	... finish editing the psf parameters
	da> psf n4147 n4147.mag.1 "" "default" "default" "default"
	... verify the critical parameters
	... move the image cursor to a candidate star and hit the a key
	    a plot of the stellar data appears
	... type ? for a listing of the graphics cursor menu
	... type a to accept the star, d to reject it
	... move to the next candidate star repeat the above steps
	... type l to list all the psf stars
	... type f to fit the psf
	... move cursor to first psf star and type s to see residuals
	... type w to save the PSF
	... type q to quit the program
	... the output will appear in n4147.psf.1.imh and n4147.psg.1

2. Compute the PSF for a field near M92. Select stars using a contour plot and the graphics cursor as the image display and image cursor. Show plots of the data and the residuals from the fit for each star.

	da> set stdimcur = stdgraph
	... define the image cursor to be the graphics cursor
	da> contour m92 >G m92.plot
	... store the contour plot of m92 in the file m92.plot
	da> epar psf
	... edit the psf parameters
	... move to the datapars line and type :e
            edit the data dependent parameters
	    type :q to quit the datapars menu
	... move to the daopars line and type :e
            edit the daophot fitting parameters
	    type :q to quit the daopars menu
	... finish editing the psf parameters
	da> psf m92 m92.mag.1 "" "default" "default" "default"
	... verify the critical parameters
	.... type :.read m92.plot to display the contour plot
	... move the image cursor to a candidate star and hit the a key
	    a plot of the stellar data appears
	... type a to accept the star, d to reject it
	... type :.read m92.plot to redisplay the contour plot
	... move the cursor to another candidate star and repeat
	    the above steps
	... type f to fit the psf
	... type l to list the psf stars
	... move cursor to first psf star and type s to see residuals
	... type w to save the PSF
	... type q to quit the program
	... the output will appear in m92.psf.1.imh and m92.psg.1

3. Setup and run PSF interactively without an image display by aliasing the image cursor to the standard input. Before running PSF in this manner the user should have a list of the id numbers of candidate PSF stars.

	da> set stdimcur = text
	... define the image cursor to be the standard input
	da> epar psf
	... edit the psf parameters
	... move to the datapars line and type :e
            edit the data dependent parameters
	    type :q to quit the datapars menu
	... move to the daopars line and type :e
            edit the daophot fitting parameters
	    type :q to quit the daopars menu
	... finish editing the psf parameters
	da> psf orionk orionk.mag.1 "" "default" "default" default
	... the user is asked to verify critical parameters
	... verify the critical parameters
	... type :a # where # stands for the id number of the star
	    a plot of the stellar data appears
	... type a to accept the star, d to reject it
	... repeat for all the PSF stars
	... type f to fit the PSF
	... type l to list the psf stars
	... move cursor to first psf star and type s to see residuals
	... type w to save the PSF
	... type q to quit the PSF
	... the output will appear in orionk.psf.1.imh and orionk.psg.1

4. Run PSF in batch mode using a command file of cursor instructions called cmds.

	da> psf orionh orionh.mag.1 "" "default" "default" "default"
	    verify+ icommands=cmds
	... the file cmds contains the following lines of text
	    :a 37
	    :a 132
	    :a 203
	    :a 273
	    :a 300
	    :a 506
	    f
	    w
	    q
	... verify the critical parameters
	... the PSF will be constructed from star 37, 132, 203, 273, 300
	    and 506
	... the output will appear in orionh.psf.1.imh and orionh.psg.1

5. Run PSF in non-interactive mode using the 25 candidate psf stars selected by the PSTSELECT task.

	da> pstselect m33 default default default 25
	da> psf m33 default default default default default interac-


TIME REQUIREMENTS


BUGS


SEE ALSO

datapars, daopars,


This page automatically generated from the iraf .hlp file. If you would like your local iraf package .hlp files converted into HTML please contact Dave Mills at NOAO.

dmills@noao.edu