Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: dish.gbtsum - Function Up: dish - Tool Previous: dish.galactic - Function


dish.gauss - Function



Package dish
Module dish
Tool dish


Fit gaussian profiles.


Synopsis
gauss(ngauss, guess, prompt, pol, bchan, echan, plotfit, plotresid, ploteach, ret)


Description
This function is used to fit one or more gaussian curves to the spectrum in the globalscan1 array. The gaussian fit function must have initial guesses for the center, width and height of the features being fit. You can allow the function to guess these parameters on its own, you can enter initial guesses as a parameter, or you can enter guesses interactively using the mouse cursor. You can also restrict the range of the spectrum to be fit.

The ngauss parameter specifies the number of gaussians to be fit simultaneously. The guess parameter is an optional array specifying initial guesses for the height, center and width of each component to be fit. See the example below to get a feel for the format required to enter initial guesses using this parameter. The most convenient way to provide initial guesses for the gaussian parameters, though, is via the mouse cursor. To enter initial guesses in this way, set the parameter prompt to T when calling the gauss function. You will then be prompted in the plotter message area to click on the plot to specify the range of values to be fit and the locations of the features.

If your spectrum has more than one polarization shown, use the pol parameter to specify which polarization to fit. Only one is fit at a time. The bchan and echan parameters are used to restrict the range of data used for the fit. These are useful for fitting components which are not dominant in a spectrum. The units for the bchan and echan values must be specified in pixels, but the plot should not be shown in pixels when the function is called. Range limits can alternatively be specified interactively by setting the parameter prompt to T.

The remaining parameters are flags. Set plotfit to T (the default) if you want to see the fit plotted on the data. Set plotresid to T to see residuals. Set ploteach to T if you have a multicomponent fit (that is, ngauss > 1) and you want to see each component's fit plotted individually. Finally, set ret to T if you want the function to return a glish record containing the results of the fit.



Arguments

ngauss   number of gaussians to fit
    Allowed: integer
    Default: no default
guess   array with the guesses for height,center, and width
    Allowed: float
    Default: function will guess if none given
prompt   prompt for mouse entry of limits and initial guesses
    Allowed: boolean
    Default: F
pol   polarization number to use
    Allowed: integer
    Default: 1
bchan   beginning channel number (pixel) of range to be fit
    Allowed: integer
    Default: 1
echan   ending channel number (pixel) of range to be fit
    Allowed: integer
    Default: full range
plotfit   flag to show fit on plot
    Allowed: boolean
    Default: T
plotresid   flag to show residuals on plot
    Allowed: boolean
    Default: F
ploteach   flag to show plots of individual components on plot
    Allowed: boolean
    Default: F
ret   return fit components as a glish array?
    Allowed: boolean
    Default: F


Returns
boolean (if ret=F) or a glish record (if ret=T)


Example
- d.gauss(1);	# fit a single gaussian using auto-guess values



Example
- # fit a gaussian using an initial guess and restricting the channel range
- myguess:=array(0,2,3)   # initialize an array which will contain the guesses
- myguess[1,1]:= 1.2      # height of component 1
- myguess[1,2]:= 110.2    # center of component 1
- myguess[1,3]:= 0.2      # width of component 1
- myguess[2,1]:= 0.6      # height of component 2
- myguess[2,2]:= 114.8    # center of component 2
- myguess[2,3]:= 0.2      # width of component 2
- d.gauss(1,myguess,bchan=1100,echan=1300);



Example
- d.gauss(1,prompt=T);	# prompt for interactive entry of range limits and
-                       # initial guesses



Example
- result := d.gauss(2,ret=T)
Gauss:  1
Center: 2.216355e+01   Height: 1.116988e-02    Width: 1.457546e-04
C-err : 1.172879e-06   H-err : 1.840365e-04    W-err: 2.926720e-06
Gauss:  2
Center: 2.216288e+01   Height: 3.880797e-03    Width: 7.887906e-04
C-err : 8.028110e-06   H-err : 8.039411e-05    W-err: 2.059391e-05
- print result.h
[0.011169876 0.00388079719] 
- print result.c
[22.1635453 22.1628813] 
- print result.w
[0.000145754649 0.000788790639] 
- print result.herr
[0.000184036544 8.03941075e-05] 
- print result.cerr
[1.17287918e-06 8.02811046e-06] 
- print result.werr
[2.92671975e-06 2.05939141e-05]





next up previous contents index
Next: dish.gbtsum - Function Up: dish - Tool Previous: dish.galactic - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01