GAUFIT

Performs a 2-D Gaussian fit of multiple sources

Description:

Uses a minimisation routine to determine the 2-D Gaussian profiles of multiple sources on an NDF format image. This will be especially useful for those using JCMT data (see also JCMTDR).

Source locations can be specified using a cursor or by text file. The user is allowed to restrain the extent to which each minimisation iteration is allowed to modify the location, breadth or position angle of the sources. This is essential when the package is used with overlapping sources.

Input text files must contain the x and y coordinates of the source in the Current co-ordinates of the NDF, and may in addition contain estimates for the position angle, Sa, Sb (std deviation of the Gaussian functions in 2 directions - major axis then minor) and the peak value.

Output image options are for the generation of the complete whole image model or an image containing the residuals in the regions surrounding the sources.

There are two separate fitting algorithms within GAUFIT, a non-linear least-squares routine (selectable with parameter LSQFIT=true) or the original parameter-search routine. Some of the parameters below have slightly different behaviour in the two modes, or are only available in one mode or the other. These are indicated by prefacing the variant descriptions with either [PS:] for parameter-search mode (lsqfit=false) or [LSQ:] for least-squares (lsqfit=true)

Usage:

GAUFIT IN INFILE OUT MODE MODEL IMGDEV MODTYPE COLOUR ANGCON ANGOFF FWHM PSIZE BACK SIGMA NSIGMA LSQFIT=false AUTOL XINC YINC SAINC SBINC PINC ANGINC NITER

GAUFIT IN INFILE OUT MODE MODEL IMGDEV MODTYPE COLOUR ANGCON ANGOFF FWHM PSIZE BACK SIGMA NSIGMA LSQFIT=true CALCSD MAXITER

Parameters:

ANGCON = _LOGICAL (Read)
Angle rotation convention. Defines if clockwise or anticlockwise is considered positive. TRUE=Clockwise.
ANGINC = _REAL (Read)
[PS:] The amount by which the angle of a source may vary. Arbitrary range 0 to 1. 1 = free to move as required. 0 = unable to move.
ANGOFF = _REAL (Read)
Angular offset for position angles generated. Units degrees.
AUTOL = _LOGICAL (Read)
[PS:] Is the source origin provided to be refined?
BACK = _REAL (Read)
The background value for the image. [LSQ:] You may give this as a negative number, to have the routine obtain and report the best-fit background; in this case, the SIGMA and NSIGMA parameters are ignored.
CALCSD = _LOGICAL (Read)
[LSQ:] Should we calculate and display parameter uncertainties? A significant part of the calculation is taken up with this calculation, so if you do not want the uncertainties, you will save time by opting not to calculate them.
COLOUR = _INTEGER (Read)
Colour of the pen used to mark source centres.
FWHM = _LOGICAL (Read)
Are the gaussian widths to be read and written as FWHM or standard deviations?
IMGDEV = _DEVICE (Read)
Name of the graphics device on which the results graph should be displayed.
INFILE = _CHAR (Read)
Name of a text file containing the co-ordinates of sources to be profiled. Co-ordinates are in the Current co-ordinate system of the WCS component of IN.
IN = _NDF (Read)
The name of the source NDF data structure/file.
LSQFIT = _LOGICAL (Read)
Is the application to use the least-squares fitting routine, or the older parameter-search method?
MAXITER = _INTEGER (Read)
[LSQ:] Upper-bound on the iteration count within the least-squares method (-1 indicates that you are happy with the default limit). The default maximum count is large, and intended as an upper bound on the iteration count, to stop it spinning its wheels uselessly on some pathological dataset. You should not need to change this unless you suspect that the limit is genuinely being reached by a correct calculation.
MODE = _LOGICAL (Read)
Whether the application is to run in file input mode or interactively. Interactive MODE=TRUE. File mode=FALSE.
MODEL = _NDF (Read)
The output NDF.
MODTYP=_CHAR (Read)
The type of output NDF file to be created. MODTYP=R gives residuals near the sources. MODTYP=W gives the whole image model.
NITER = _INTEGER (Read)
[PS:] The number of iterations performed by the parameter-search routine.
NSIGMA = _REAL (Read)
Number of sigma above sky at which pixels are considered to be significant. [LSQ:] If you give back=-1, then this is ignored.
OUT = _CHAR (Read)
File name for the output text file containing the profile data.
PINC = _REAL (Read)
[PS:] The amount by which the peak of a source may vary. 1 = free to move as required. 0 = unable to move.
PSIZE = _REAL (Read)
The size of each pixel in arc seconds. If the image contains a SKY co-ordinate frame this value will be determined automatically.
SAINC = _REAL (Read)
[PS:] The amount by which the standard deviation of a source may vary per iteration. Largest axis. 1 = free to move as required. 0 = unable to move.
SBINC = _REAL (Read)
[PS:] The amount by which the standard deviation of a source may vary per iteration. Smallest axis.
SIGMA = _REAL (Read)
Standard deviation of the sky count. [LSQ:] If you give back=-1, then this is ignored.
XINC = _REAL (Read)
[PS:] The amount by which the x coordinate of a source may vary per iteration. 1 = free to move as required. 0 = unable to move.
YINC = _REAL (Read)
[PS:] The amount by which the x coordinate of a source may vary per iteration. 1 = free to move as required. 0 = unable to move.

Examples:

gaufit mode=false infile=coords.dat in=image out=sources modtyp=w model=imodel

Will read source coordinates from the text file coords.dat. The image on which these appear is image, the output image containing the model for each pixel will be imodel. The coordinates provided by the file are in the Current coordinate system of the WCS component of the NDF image.

gaufit mode=true out=test1 modtyp=r angoff=90
The sources will be identified by cursor. The output image test1 will only show the residual (discrepancy between the models and the source image in the vicinity of the sources. The resultant position angles will be modified by 90 degrees.
gaufit mode=true lsqfit=true back=-1 out=test1 angoff=90
The sources will be identified by cursor. The resultant position angles will be modified by 90 degrees. The source positions will be identified using a least-squares fitting technique, which will also fit the background.