There are three tasks and two verbs which estimate the position and intensity of a component on a two-dimensional image. The simplest and fastest methods are the verb IMCENTER and MAXFIT. The latter fits a two-dimensional parabola to the maximum within a few pixels of an image position, and gives the peak and its position. The tasks IMFIT and JMFIT are similar and fit an image subsection with up to four Gaussian components with error estimates. Task SAD attempts to automate the process of finding and fitting Gaussian components in an image. Additionally, in one dimension, the task SLFIT fits Gaussian components to slice data and the task XGAUS fits Gaussian components to each row of an image.
Beginning in 31DEC06, you may determine a centroid for a region in an image with the verb IMCENTER. Set the name parameters for the desired image and then define the region with adverbs BLC and TRC, perhaps using TVLOAD; TVWIN C R. Set FLUX if you wish to limit the computations to pixel values greater than FLUX. Then
MAXFIT’s speed makes it useful for simple regions. Type:
The inputs should be self-explanatory. The IMSIZE parameter can be important in crowded fields. MAXFIT can be used conveniently by first displaying the image on the TV and then typing:
First the cursor will appear on the TV. Move it close to a maximum, press the left mouse button, and hit button A,
B, C, or D. The fit will appear in your 


window. Adverb values PIXXY, PIXVAL, COORDINA, and ERROR will be
set appropriately.
A more sophisticated least-squares fit of an image is obtained with IMFIT, which fits an image with up to four Gaussian components and attempts to derive error estimates. A linear or curved, two-dimensional “baseline” may also be fitted. A sample set-up is as follows:
to set the area to be fitted as (n1,n2) to (m1,m2) — or use TVWIN with the cursor on the TV. |
> NGAUSS 2 C R | to set the number of components to be fitted to 2. |
> CTYPE 1, 1 C R | to have both components be Gaussians. |
> GMAX 0.34 0.20 C R | to give estimates of peak intensity in Jy. |
> GPOS 200, 100, 210, 110 C R | to give estimates of the pixel locations of each component. |
> GWID 6 4 20 6 4 20 C R | to give estimates of component sizes in pixels. In this case, each component has a FWHM of 6 by 4 pixels with the major axis at position angle 20 degrees. |
> DOWID FALSE C R | to hold all of the widths constant in the fitting process (if required). |
> INP C R | to review inputs. |
> GO C R | to run the task. |
To improve accuracy, include as small an area as possible in the fit. In some cases, it is useful to hold some of the parameters constant, particularly when fitting a complex clump of emission with several components. The parameters can interact. Error estimates are given for each component. IMFIT will sometimes fail to converge in complicated regions. When this happens, you might try using the task JMFIT, which is very similar in function, but uses a different mathematical method to minimize the rms. Comparison of the results of IMFIT and JMFIT will sometimes be instructive. The tasks will correct the results for the effects of the primary beam and bandwidth smearing if you wish. It is wise to treat the results of MAXFIT, IMFIT and JMFIT with caution. The estimates of the errors, in particular, are based on theory and on trials of deconvolution over a range of widths.
Use RUN INPFIT C R (see §12.2.1) to obtain a procedure which will help to supply input parameters to IMFIT. This RUN file loads a procedure called INPFIT into AIPS. To invoke it, load the image which you want to fit onto the TV with TVALL and type INPFIT ( 3 ) C R to specify three components. The procedure will prompt you to set the desired sub-image window with the TV cursor (it uses verb TVWINDOW) and then to point the TV cursor at the peaks of each of the Gaussians, click the left mouse button when the cursor is correctly placed, and push button A, B, C, or D. The inputs GMAX, GPOS, BLC, and TRC are set in this way.
The task SAD (§10.4.4) attempts to find all sources in a sub-image whose peaks are brighter than a given level. It
searches the sub-image specified by BLC and TRC for all points above this level and merges such points in contiguous
“islands.” For each island, initial estimates of the strength, size, and number of components are generated. Then the
fitting algorithm used in JMFIT is called to determine the least square Gaussian fit. Solutions which fail to meet
certain criteria can be retried as two components and, if they still fail, rejected. SAD is a task with many
adverbs, a full description of which would be beyond the scope of this
ook
ook. Enter EXPLAIN SAD
C R for a full description of this task and its parameters. The effects of bandwidth smearing and the
primary beam may be corrected. SAD produces a Model-Fit extension file which may be converted to a
stars file (§6.3.2) with MF2ST. The MF file may be printed with MFPRT in formats suitable for STARS
and in formats which may be used, with task BOXES, to prepare Clean boxes for input to the imaging
tasks.
You can generate a one-dimensional slice (profile) through any plane (characterized by the first two coordinates) of
an image file using the 


task SLICE. The output file is appended to the image file as an SL extension file.
Slices are computed along lines in the two-dimensional image joining any valid pair of points selected by BLC and
TRC. The set of software dealing with slice file analysis and display can be obtained on your terminal by typing
ABOUT ONED C R. The list is also given in Chapter 13.
To generate a slice:
Use INDISK and GETNAME to select the input image. The beginning (BLC) and ending (TRC) points for the slice can be specified conveniently using the TV cursor if the image to be sliced is first displayed on the TV with TVLOD or TVALL. To set these points with the TV, type:
> SETSLICE C R |
|
then set the TV cursor to the desired beginning point for the slice, press the left mouse button, and repeat for the ending point for the slice. Note that, for slices, BLC need not be below or to the left of TRC. Finally:
> GO C R | to generate the slice file. |
Slice files may be output as ASCII text files using the OUTFILE adverb. Slice files are archived in your disk catalog as SL extensions to the image file from which they were derived. Running SLICE again with new parameters does not overwrite the slice file, but makes another with a higher “version” number. To review and/or delete slice files, follow the instructions for EXTLIST and EXTDEST of plot files in §6.3 above, but use INEXT ’SL’ C R in place of INEXT ’PL’ C R.
When SLICE has terminated, the file may be plotted in the TV display on your workstation using:
The default scales will plot all slice points on a vertical scale from the slice minimum to the slice maximum. You can alter the part of the slice that is plotted and the vertical scale by specifying, for example:
to drop 100 points from the beginning and 225 points from the end of the plotted portion of the slice. |
> PIXRANGE -0.001 0.004 C R | to set the range of the vertical axis to be -1 to 4 mJy/beam. |
> TVSLICE C R | to plot the slice in the TV window. |
Note: several slices may be put on one TV plot. Use TVASLICE C R for the additional ones. Multiple colors may be achieved by using different graphics channels (GRCHAN).
Slice files may be converted into plot files by:
The resulting plot files may then be output by:
The task SLFIT fits Gaussian components to one-dimensional data in slice files. Assuming that the usual GETNAME step has been done, a typical session would go like:
> INVERS m C R | to select the mth file for analysis. |
> TVSLICE C R | to plot the slice in the TV window. |
> TVSLICE C R | to re-plot just the subsection. |
> NGAUSS 2 C R | to fit 2 Gaussians. |
> TVSET C R |
|
This verb will prompt you to POSITION CURSOR AT CENTER & HEIGHT OF GAUSSIAN COMP 1. Move the cursor to the requested position and hit any button. Then you are asked to POSITION CURSOR AT HALFWIDTH OF GAUSSIAN COMP 1. Move the cursor to the half-intensity point of the component and click any button. Continue until all components have been entered. (Note: these operations are also available on the TEK device with verbs beginning with TK. We recommend the TV versions since cursor reading in X-Windows emulations of TEK devices appears to be unreliable.) Then type:
> TVAGUESS C R | to plot the guess on top of the slice plot. |
If everything looks ok, then:
When the task gets an answer, the solution will be displayed as 


messages, recorded in the message file, and
recorded in the slice file itself. To get a hard copy of the results:
and, to display the results in the TV window, enter:
> TVSLICE C R | to re-plot the slice. |
> TVAMODEL C R | to add the model results to the plot. |
> TVARESID C R | to add the residuals (data – model) to the plot. |
To get a higher quality plot of the results, an example of which is shown in §6.3.2.1, type:
> DOSLICE FALSE C R | to leave the slice data out of the plot. |
XGAUS is an interactive task which can fit up to four Gaussians and a linear baseline to each row of an image. It writes its results as a set of n - 1 dimensional image files. Although XGAUS was designed for use primarily on transposed spectral-line cubes (see §8.5.2), it has a wide variety of other applications. The interaction is optional and uses the TV or TEK window on your workstation. The data, initial guess, model fit, and the residual for each row may be plotted on the TV or TEK screen. If the number of Gaussians being fit is larger than one, you may choose for each row to enter a revised initial guess using the cursor in the TV or TEK window. This process is similar to that of TVSET described above (§7.5.4). This task has too many options to do them justice here. Enter EXPLAIN XGAUS C R for details.