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


next up previous contents index
Next: image.getchunk - Function Up: image - Tool Previous: image.fitpolynomial - Function


image.fitsky - Function



Package general
Module images
Tool image


Fit 2-dimensional models to the sky


Synopsis
fitsky(pixels, pixelmask, converged, region, mask, models, estimate, fixed, includepix, excludepix, fit, deconvolve, list)


Arguments

pixels out Output residual pixels
    Allowed: Numeric Glish array
pixelmask out Output mask of region
    Allowed: Boolean Glish array
converged out Did the fit converge ?
    Allowed: T or F
region in The 2-D region of interest to fit
    Allowed: Region tool
    Default: Whole image
mask in OTF mask
    Allowed: Boolean LEL expression or mask region
    Default: None
models in The model types to fit simultaneously
    Allowed: Vector of strings from `gaussian'
    Default: gaussian
estimate in Initial estimate for the model
    Allowed: Componentlist tool
    Default: Internal estimate made
fixed in Parameters to hold fixed per model
    Allowed: String or vector of strings, one per model. Choose from ``fxyabp''
    Default: All parameters vary
includepix in Range of pixel values to include
    Allowed: Vector of 1 or 2 Floats
    Default: See below
excludepix in Range of pixel values to exclude
    Allowed: Vector of 1 of 2 Floats
    Default: See below
fit in Do fit or get estimate
    Allowed: T or F
    Default: T
deconvolve in Deconvolve from restoring beam
    Allowed: T or F
    Default: F
list in List informative messages to the logger
    Allowed: T or F
    Default: T


Returns
Componentlist tool or fail



Description

This function fits 2-dimensional models to regions of the sky. You can fit multiple models simulataneously, although only Gaussian models are currently implemented. The fit is returned as a Componentlist tool. See also the imagefitter tool which is an interactive high-level tool based around this function.

  • If fit=T the fit is done and returned. If fit=F the fit is not done. Instead, the initial auto-determined estimate is returned (this is used as the starting guess of the actual fit); in this case, arguments pixels, pixelmask, converged, estimate and fixed are ignored. The auto-fit can only be determined for a single model.

  • The pixels array is returned to you with the residual of the fit. The pixelmask array is returned to you with the pixel mask of the specified region (this reflects both the underlying pixel mask that you applied [if any] as well as the shape of the region).

  • If the fit converged, converged=T on return.

  • The region-of-interest must be 2-dimensional and it must hold a region of the sky. Any degenerate trailing dimensions in the region are discarded.

  • The models argument specifies the simultaneous model types you would like to fit to the specified region. Currently you can only choose from `gaussian' (minimum match). Specify the models argument as a vector of strings, or a string with comma or space delimiters. Thus, to fit 3 simultaneous gaussians, you would give models='gaussian gaussian gaussian'.

  • An initial automatically determined estimate of the parameters of the model can be made for you (only for single model fits). However, if this turns out to be poor, or if you want to hold some parameters fixed, then you can enter your estimate with the estimate argument to which you supply a Componentlist tool (the same type of tool that is returned by this function). The estimate doesn't have to be the same type as the model you are fitting. For example you can give a Point model estimate for a Gaussian fit. The other parameter estimates will be filled in for you. The function findsources can be used to get rough point source estimates. You must supply one estimate component for every model component that you wish to fit when fitting multiple simultaneous models.

  • When you fit a model, you can choose which parameters you hold fixed in the fit and which you solve for. The fixed argument enables you to specify which parameters of the fit you hold fixed. It is entered as a vector of strings, one string for each model specifying which parameters of the fit are fixed.

    For gaussian models, that string should contain letters chosen from

    • `f' - hold the flux (intensity) of the model fixed
    • `x' - hold the X location of the model fixed
    • `y' - hold the Y location of the model fixed
    • `a' - hold the major axis width fixed
    • `b' - hold the minor axis width fixed
    • `p' - hold the position angle fixed

    If you hold any parameters fixed, you may need to specify an input estimate.

  • Often when fitting, it is advisable to exclude noise pixels. The includepix (pixel value range to include) or excludepix (pixel value range to exclude) arguments (you can't specify them both) allow you to select a subset of the pixels for the fit. If you only give one value for either of these vectors, say includepix=[b], then this is interpreted as includepix=[-abs(b),abs(b)].

    For total intensity (Stokes I) images, if neither of these are specified and the peak in the region is positive, then all pixels below zero are discarded. If the peak is negative (a negative source), all pixels above zero are discarded. For other Stokes parameters all pixels are included by default.



Example
- myim := image('gc.small')
- local pixels, pixelmask, converged
- cl1 := myim.fitsky(pixels, pixelmask, converged, models="gaussian")
- if (!is_fail(cl1) && converged) {
  myim2 := image('gc.big')
  cl2 := myim2.fitsky(pixels, pixelmask, converged, models="gaussian", estimate=cl1)
}

In this example we assume the image is 2-dimensional. We fit the first image using the internal starting estimate for the model parameters. We fit the second image using the result of the first fit as the starting estimate.





next up previous contents index
Next: image.getchunk - Function Up: image - Tool Previous: image.fitpolynomial - 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