IRAF help page for package noao.digiphot.apphot, program fitpsf

from NOAO fitpsf -- model the point spread function with an analytic functionUSAGEPARAMETERSDESCRIPTIONCURSOR COMMANDSALGORITHMSOUTPUTERRORSEXAMPLESBUGSSEE ALSO

fitpsf -- model the point spread function with an analytic function


USAGE

fitpsf image box


PARAMETERS

image

The list of images containing the objects to be measured.

box

The width of the fitting box in scale units.

coords =

The name of the text file(s) containing the coordinates of the objects to be modeled, 1 object per line with the x and y coordinates in columns 1 and 2 respectively. If coords is null (""), FITPSF will either read commands from the image cursor (default) or read commands from a cursor command file. In the latter case the image cursor parameter icommands must be set to the name of the cursor command file. If coords is defined, FITPSF will accept coordinate input from either the image cursor or coords (interactive mode), or read coordinates from coords or a cursor command file (batch mode). The number of coords files must be zero, one, or equal to the number of input images.

output = default

The name of the results file or results directory. If output is "default", "dir$default" or a directory specification then an output name of the form dir$root.extension.version is constructed, where dir is the directory, root is the root image name, extension is "psf" and version is the next available version of the file. If output is null (""), then no output file is created. If output is defined the number of output files must be one, or equal to the number of input images. In both interactive and batch mode full results are written to output. In interactive mode a subset of the results is printed on the standard output.

datapars =

The parameter file containing the data dependent parameters. If datapars is null (""), then the default parameter set in the user's uparm directory is used. The critical parameters fwhmpf, and sigma are located here.

function = radgauss

The function to be fit. The options are:

radgauss

A 2D radial Gaussian function is fit. The parameters of the fitting function are: x and y center, sigma of the Gaussian, amplitude of the Gaussian and the local sky value.

elgauss

A 2D elliptical Gaussian function is fit. The parameters of the fitting function are: x and y center, x and y sigma of the Gaussian, amplitude of the Gaussian and the local sky value.

moments

The 0th, 1st and 2nd order moments are computed and used to derive estimates of the x and y center values, radius of gyration, ellipticity and position angle of the object.

maxiter = 50

The maximum number of iterations that the non-linear fitting routines will perform in an attempt to find a satisfactory fit.

nreject = 0

The maximum number of rejection cycles performed after the fit. The default is no rejection.

kreject = 3.0

The k-sigma rejection limit in units of sigma.

interactive = yes

Interactive or batch mode.

Draw the fitting box on the image display?

mkbox = no

.ls verify = yes Verify the critical parameters in non-interactive mode.

update = no

Update the critical parameters in non-interactive mode.

verbose = no

Print messages on the terminal in non-interactive mode.

graphics = stdgraph

The default graphics device.

display = stdimage

The default image display device. Display can be set to "stdgraph" to enable FITPSF to work interactively from a contour plot.

icommands =

The image cursor.

gcommands =

The graphics cursor.


DESCRIPTION

FITPSF models the stellar brightness distribution of objects in the IRAF image image using non-linear least squares techniques and produces a list of model parameters and associated errors as output. Pixels in a subraster of width box * scale are extracted and used in the fit.

FITPSF can be run either interactively or in batch mode by setting the parameter interactive. In interactive mode starting x and y positions can either be read directly from the image cursor or read from the text file specified by coords. In batch mode the estimated positions can be read from the text file coords or the image cursor parameter icommands can be redirected to a text file containing a list of cursor commands.


CURSOR COMMANDS

The currently available cursor commands are listed below.

	       Interactive Keystroke Commands
?	Print help
:	Colon commands
v	Verify the critical parameters
w	Save the current parameters
d	Plot radial profile of current star 
i	Interactively set parameters using current star
f	Fit current star
spbar	Fit current star, output results
m	Move to next star in coordinate list
n	Fit next star in coordinate list, output results
l	Fit remaining stars in coordinate list, output results
e	Print error messages
r	Rewind the coordinate list
q	Exit task 
                 Colon Commands
:show	[data/fit]	List the parameters
:m [n]	Move to next [nth] star in coordinate list
:n [n]	Fit next [nth] star in coordinate list, output results
		Colon Parameter Editing Commands
# Image and file name parameters
:image		[string]	Image name
:coords		[string]	Coordinate file name
:output		[string]	Output file name
# Data dependent parameters
:scale		[value]		Image scale (units per pixel)
:fwhmpsf	[value]		Scale factor (scale units)		
:emission	[y/n]		Emission feature (y), absorption (n)
:sigma		[value]		Standard deviation of sky (counts)
:datamin	[value]		Minimum good data value (counts)
:datamax	[value]		Maximum good data value (counts)
# Noise description parameters
:noise		[string]	Noise model (constant|poisson)
:gain		[string]	Gain image header keyword
:ccdread	[string]	Readout noise image header keyword
:epadu		[value]		Gain (electrons  per adu)
:readnoise	[value]		Readnoise (electrons)
# Observation parameters
:exposure	[string]	Exposure time image header keyword
:airmass	[string]	Airmass image header keyword
:filter		[string]	Filter image header keyword
:obstime	[string]        Time of observation image header keyword
:itime		[value]		Exposure time (time units)
:xairmass	[value]		Airmass value (number)
:ifilter	[string]	Filter id string
:otime		[string]	Time of observation (time units)
# Fitting parameters
:function	[string]	PSF model (radgauss|elgauss|moments)
:box		[value]		Width of the fitting box (scale units)
:maxiter	[value]		Maximum number of iterations
:nreject	[value]		Maximum number of rejection cycles
:kreject	[value]		Rejection limit (sigma)
# Plotting and marking functions
:mkbox		[y/n]		Mark the fitting box on the display
The following command are availalble from within the interactive setup menu.
                    Interactive Fitpsf Setup Menu
	v	Mark and verify the critical fitpsf parameters (f,s,b)
	f	Mark and verify the full-width half-maximum of the psf
	s	Mark and verify the standard deviation of the background
	l	Mark and verify the minimum good data value
	u	Mark and verify the maximum good data value
	b	Mark and verify the half-width of the fitting box


ALGORITHMS

The fitting parameters are function, the functional form of the model to be fit, maxiter, the maximum number of iterations per fit, kreject, the K-sigma rejection limit and nreject, the maximum number of rejection cycles. The currently available functions are a 2D moments analysis "moments", a 2D radial Gaussian "radgauss", and a 2D elliptical Gaussian "elgauss".

The weighting of the fit is determined by the parameter noise in the datapars file. The two options are constant, in which all the weights are set to 1 and poisson in which the weights are equal to the inverse of the counts divided by the image gain read from the datapars gain or epadu parameters plus the square of the readout noise determined from the datapars parameters ccdread or readnoise. If function is either "radgauss" or "ellgauss" then the datapars parameter fwhmpsf is used to determine the initial guess for the Gaussian sigma. The datapars parameter threshold determines the intensity threshold above which the moment analysis is performed.


OUTPUT

In interactive mode the following quantities are printed on the terminal as shown below, for the radial Gaussian, elliptical Gaussian and moments functions respectively.

    image  xcenter  ycenter  rsigma  amplitude  sky  err
    image  xcenter  ycenter  xsigma  ysigma rot  amplitude  sky  err
    image  xcenter  ycenter  rgyrat  ellip  pa amplitude  sky  err

In both interactive and batch mode the full output is written to the text file output. At the beginning of each file is a header listing the values of the parameters when the first stellar record was written. These parameters can be subsequently altered. For each star measured the following record is written for the radial Gaussian, elliptical Gaussian, and moments functions respectively.

        image  xinit  yinit  id  coords  lid
    	    xcenter  ycenter  rsigma  amplitude  sky
	    excenter eycenter ersigma eamplitude esky  ier  error
        image  xinit  yinit  id  coords  lid
    	    xcenter  ycenter  xsigma  ysigma  rot  amplitude  sky
	    excenter eycenter exsigma eysigma erot eamplitude esky  ier
	    error
        image  xinit  yinit  id  coords  lid
	    xcenter  ycenter  rgyrat  ellip  pa amplitude  sky
	    excenter eycenter ergyrat eellip epa eamplitude esky  ier
	    error

Image and coords are the name of the image and coordinate files respectively. Id and lid are the sequence numbers of stars in the output and coordinate files respectively and xinit and yinit are the initial positions. Xcenter and ycenter are the computed x and y positions of the object. Rsigma, xsigma and ysigma are the distance from the center of the Gaussian at which the Gaussian is equal to exp (-0.5) of its central value. Xsigma and ysigma refer to those values along the x and y axes respectively. The amplitude and sky refer to the amplitude of the Gaussian function and a constant background value respectively. If function = "moments" amplitude and sky refer to the total intensity above threshold and sky is the threshold value. Rot and pa are position angles of the major axis measured counter-clockwise with respect to the x axis. Rgyrat is the radius of gyration of the object and ellip its ellipticity. Quantities prefixed by an e represent the errors in the corresponding fitted parameters.


ERRORS

If all went well in the fitting process the error code stored in the ier field described above is 0. Non-zero values of ier flag the following error conditions.

          0     # No error
	401     # The fitting box is off the image
	402     # The fitting box is partially off the image
	403     # There are too few points to fit the function
	404     # The fit is singular
	405     # The fit did not converge


EXAMPLES

1. Compute the radial Gaussian function parameters for a few stars in N4147 using the display and the image cursor. Setup the task parameters using the interactive setup menu defined by the i key command.

	ap> set stdimcur = stdimage
	... define the image cursor
	ap> display n4147 1 fi+
	... display the image
	ap> fitpsf n4147
	... type ? to get a short help page on the screen
	... move the image cursor to a star
	... type i to enter the interactive setup menu
	... enter maximum radius in pixels of the radial profile
	... set the fitting box width, fwhmpsf, and sigma using the graphics
	    cursor and the stellar radial profile plot
	... typing  leaves everything at the default value
	... type the v key to verify the parameters
	... type the w key to save the parameters in the parameter files
	... move the image cursor to the stars of interest and tap
	    the space bar
	... a one line summary of the fitted parameters will appear on the
	    standard output for each star measured
	... the full output will appear in n4147.psf.1

2. Compute the radial Gaussian function parameters for a few stars in M92 using the contour plot and the graphics cursor. Setup the task parameters using the interactive setup menu defined by the i key command.

	ap> set stdimcur = stdgraph
	... define the image cursor to be the graphics cursor
	ap> contour m92 >G m92.plot1
	... store the contour plot of m92 in the file m92.plot
	ap> fitpsf m92 display=stdgraph
	... type ? to get a short help page on the screen
	... type :.read m92.plot1 to load the contour plot on the screen
	... move the graphics cursor to a star
	... type i to enter the interactive setup menu
	... enter the maximum radius in pixels of the radial profile
	... set the fitting box width, fwhmpsf, and sigma using the graphics
	    cursor and the stellar radial profile plot
	... typing  leaves everything at the default value
	... type the v key to verify critical parameters
	... type the w key to save the parameters in the parameter files
	... retype :.read m92.plot1 to reload the contour plot
	... move the graphics cursor to the stars of interest and tap
	    the space bar
	... a one line summary of the fitted parameters will appear on the
	    standard output for each star measured
	... full output will appear in the text file m92.psf.1 

3. Setup and run FITPSF interactively on a list of objects, using a contour plot as the image display and the parameters defined and saved in example 2.

	ap> set stdimcur = stdgraph
	... define the image cursor to be the graphics cursor
	ap> contour m92
	... adjust plot parameters until the contour plot is satisfactory
	ap> =gcur
	... enter cursor mode
	... type :.write m92.plot2 to save the plot in a metacode file
	... type any key to quit cursor mode
	ap> daofind m92
	... make a coordinate list by searching for objects with  the
	    fwhmpsf and threshold defined in example 2
	... the output will appear in the text file m92.coo.1
	ap> fitpsf m92 coords=m92.coo.1 display=stdgraph
	... type ? for optional help
	... type :.read m92.plot2 to read in the contour plot
	... move the graphics cursor to the stars and tap space bar
				or
	... use m, :m and/or n, :n, l, r commands to measure objects in the
	    coordinate list
	... a one line summary of results will appear on the standard output
	    for each star measured
	... the output will appear in m92.psf.2 ...

4. Run FITPSF in batch mode using the coordinate file and the previously saved parameters. Verify the critical parameters.

	ap> fitpsf m92 coords=m92.coo.1 verify+ inter-
	... output will appear in m92.psf.3 ...

5. Run FITPSF in batch mode using the coordinate file and the previously saved parameters. The task can be submitted to the background by appending an ampersand to the command line listed below.

	ap> fitpsf m92 coords=m92.coo.1 verify- inter-
	... output will appear in m92.psf.4

6. Run FITPSF interactively on the Sun workstation without the use of the IMTOOL window using only a coordinate list and the current set of parameters as input.

	ap> set stdimcur = text
	... set the image cursor to the standard input
	ap> fitpsf m92 coords=m92.coo.1
	... type ? for optional help
	... type :m 3 to set the initial coordinates to those of the
	    third star in the list
	... type i to enter the interactive setup menu followed by v to
	    get the default menu
	... enter maximum radius in pixels of the radial profile
	... set the fwhmpsf, sigma, and fitting box half-width
	    using the graphics cursor and the stellar radial profile plot,
	    typing  after the prompt leaves the parameter at its default
	    value
	... type r to rewind the coordinate list
	... type l to measure all the stars in the coordinate list
	... a one line summary of the answers will appear on the standard
	    output for each star measured
	... full output will appear in the text file m92.psf.5 

BUGS

BUGS

In interactive mode the user should not change the type function to be fit after the first record is written to the output file. In this case the file header and record structure will not match.

It is currently the responsibility of the user to make sure that the image displayed in the frame is the same as that specified by the image parameter.

Commands which draw to the image display are currently disabled. The TVMARK task in the proto package can be used to draw simple marks on the display. All the APPHOT marking commands will however function if a contour plot is used in lieu of the image display.

Users should not be confused by the normally enabled markcur option in the SUN/IMTOOL setup window. This feature is under the control of the IMTOOL window and the APPHOT package has no control over it.


SEE ALSO

datapars, radprof,


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