; SLFIT ;--------------------------------------------------------------- ;! Task to fit gaussians to slice data. ;# TASK ANALYSIS ONED MODELING ;----------------------------------------------------------------------- ;; Copyright (C) 1995, 2000, 2009 ;; Associated Universities, Inc. Washington DC, USA. ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2 of ;; the License, or (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public ;; License along with this program; if not, write to the Free ;; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, ;; MA 02139, USA. ;; ;; Correspondence concerning AIPS should be addressed as follows: ;; Internet email: aipsmail@nrao.edu. ;; Postal address: AIPS Project Office ;; National Radio Astronomy Observatory ;; 520 Edgemont Road ;; Charlottesville, VA 22903-2475 USA ;----------------------------------------------------------------------- SLFIT LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC SLFIT: Task to fit gaussians to slice data. INNAME Image name (name) INCLASS Image name (class) INSEQ 0.0 9999.0 Image name (seq. #) INDISK 0.0 9.0 Disk drive # INVERS 0.0 46655.0 Version # of SL file. 0=>last BDROP 0.0 9999.0 Drop slice pts from beginning EDROP 0.0 9999.0 Drop slice pts from end NGAUSS 0.0 4.0 No of gaussian components. LTYPE Units to use for GPOS values. See HELP LTYPE GMAX Initial guess of max values. GPOS Initial guess of positions. GWIDTH Initial guess of halfwidths. @ Fit model parameters FMAX @ Peak of component (JY) @ 0-> Use maximum value FPOS @ (X,Y) position (pixels) @ 0-> Use position of max FWIDTH @ (BMAJ, BMIN, PA) of comp. @ (pixels,pixels,deg) @ 0->Use clean beam DOMAX $ Solve for GMAX? >0 -> yes $ returns the error DOPOS $ Solve for GPOS? >0 -> yes $ returns the error DOWIDTH $ Solve for GWIDTH? >0-> yes $ returns the error ---------------------------------------------------------------- SLFIT Type: Task Use: Accept an initial guess of the parameters of up to 4 Gaussian components of a curve and produce new values of the parameters corresponding to a least squares fit of slice file data points. Adverbs: INNAME......Image name (name). Standard defaults. INCLASS.....Image name (class). Standard defaults. INSEQ.......Image name (seq. #). 0 => highest. INDISK......Disk unit #. 0 => any. INVERS......Version # of SL file. 0 => highest version # BDROP.......No of slice pts to omit from beginning of slice. EDROP.......No of slice points to omit from end of slice. NGAUSS......No of gaussian components. LTYPE.......Labeling type normally. Here it is used to tell the program what units are used for the GPOS, GMAX, and GWIDTH. Don't change this after doing TKSET and/or TK1SET. GMAX........Initial guess of maximum amplitudes. GPOS........Initial guess of positions of the components in GPOS(1,i). GPOS(2,i) not used. GWIDTH......Initial guess of widths at 1/2 max amplitude in GWIDTH(1,i). GWIDTH(2,i) and GWIDTH(3,i) are not used. Note that the units of GMAX, GPOS, and GWIDTH are those in the plot (e.g. mJy, arc sec or Jy, degrees or ??). FMAX........The peak value fit for each component is returned. FPOS........The position (X,0) fit for components is returned. The values are in pixels in the order (X1,0, X2,0, X3,0, X4,0). FWIDTH......The full width at half maximum fit for components are returned. FWIDTH(2,i) and FWIDTH(3,i) are not used. Note that the units of FMAX, FPOS, and FWIDTH are those in the plot (e.g. mJy, arc sec or Jy, degrees or ??). DOMAX.......Flags for GMAX: if > 0 fit this parameter, else hold fixed. Returned value is uncertainty in the fit parameter. DOPOS.......Flags for GPOS: if > 0 fit this parameter, else hold fixed. Returned value is uncertainty in the fit parameter. DOWIDTH.....Flags for GWIDTH: if > 0 fit this parameter, else hold fixed. Returned value is uncertainty in the fit parameter. ---------------------------------------------------------------- SLFIT: Task to fit Gaussian components to a 1D slice. DOCUMENTOR: G. A. Fickling, Eric Greisen NRAO/Charlottesville RELATED PROGRAMS: SETSLICE, SLICE, TKSLICE, TKSET, TK1SET, TKGUESS, TKASLICE, TVSLICE, TVASLICE, TVGUESS, TVAGUESS, TVMODEL, TVAMODEL, TVRESID, TVARESID PURPOSE SLFIT fits up to four Gaussian-shaped components to a selected part of a one dimensional slice. An initial guess must be provided for the parameters. Because of the many different units that can be used, the only practical way to do this is interactively using the Tektronics screen with verb TKGUESS or the TV screen with TVGUESS as described below. Solution and error estimates are generated and the solution and residuals can be plotted on the Tektronics, TV. or line-printer. An arbitrary selection of parameters may be held constant in the solution. The fitting algorithm is based on the subroutine LMDER in the Argonne National Laboratory Subroutine Package. It uses a linearized least-square solution to obtain the parameters. It assumes a baseline at zero intensity across the slice. Assuming that the usual GETNAME step has been done, a typical session would go like: INEXT 'SL'; EXTL to list the parameters of the slice files. INVERS n to select the n th file for analysis. TKSLICE to plot the slice on the Tektronix. EDROP 840; BDROP 700 to select a subsection to fit. TKSLICE to replot just the subsection. NGAUS 2 to fit 2 Gaussians. TKSET to set the initial guess of the solution The last verb will prompt you to POSITION CURSOR AT CENTER & HEIGHT OF GAUSSIAN COMP 1 and will turn on the Tektronix crosshairs. Move the crosshairs with the thumbwheels to the required position and press any key EXCEPT on the Tektronix 4012 keyboard. The terminal then requests you to POSITION CURSOR AT HALFWIDTH OF GAUSSIAN COMPONENT 1 and turns the crosshairs back on. Move the crosshairs until they are at the half-intensity point of the component and press any key except . The process continues until all components have been entered. Then type: TKAGUESS to plot the guess on top of the slice plot. If everything looks ok, then type: GO SLFIT to run the task. The TK cursor reading sometimes does not work well on X windows screens. There are TVxxxxx verbs which do exactly the same things as the TKxxxxx verbs. When the task gets an answer, it will be displayed on the AIPS monitor, recorded in the message file, and recorded in the slice file itself. You may therefore wish to print out your message file before running SLFIT (see PRTMSG), to separate the SLFIT results from earlier work. The current display of the fitted peak, position of the peak, halfwidth, and errors is one of the parts of the program that needs improvement. The units of the answers are not displayed. The answers will be in the units that were displayed on the Tektronix screen when TKSLICE was executed. You must not change adverb LTYPE between executing TKSLICE, TKSET, and SLFIT or the answers will be in different units from the display. To get a hard copy of the answers: PRTMSG to print the message file. To display the results on the Tektronix 4012, enter: TKSLICE to replot the slice. TKAMODEL to add the model results to the plot. TKARESID to add the residuals (data - model) to the plot. To get a higher quality plot of the results: DORES TRUE; DOMOD TRUE to request the model and the residuals. DOSLICE FALSE to leave the slice data out of the plot. TASK 'SL2PL' ; GO to make a plot file. INVERS 0 to select the latest plot file. GO PRTPL to display it on the printer/plotter.