nraonrao
 
 NRAO Home > CASA > CasaDocument
image.fitpolynomial - Function

1.1.1 Fit 1-dimensional polynomials to profiles
Description

This function fits 1-dimensional polynomials to profiles and subtracts the fits. You specify the order of the polynomial via the order argument. The returned on-the-fly Image tool holds the residual image. You can optionally also write out the fitted image.

The output mask is a copy of the default input pixel mask (if any); the OTF mask does not contribute to the output mask. Any other input pixel masks will not be copied. Use function maskhandler if you need to copy other masks too. Use function calcmask if you need to apply the OTF mask to the output.

"""  
#  
print "\t----\t fitpolynomial Ex 1 \t----"  
ia.maketestimage(’hcn’,overwrite=true)  
myim = ia.fitpolynomial(order=2, axis=1)  # OTF Image tool is virtual  
print myim.summary()  
myim.done()  
ia.close()  
#  
"""

"""  
#  
print "\t----\t fitpolynomial Ex 2 \t----"  
ia.fromshape(shape=[128,128,64,4])                  # RA/DEC/FREQ/STOKES  
# Specify pixels to fit via mask  
mask = ’indexin(3, [1:20, 30, 35, 50:60, 90:128])’  # LEL’s are 1-rel!  
myim = ia.fitpolynomial(order=2, mask=mask, axis=2) # axis 3 (0-rel)  
print myim.summary()  
myim.done()  
ia.close()  
#  
"""

This example can be thought of as an image-based continuum substraction. You specify the axis and the pixels where the spectrum is line free (continuum), do the fit and create an on-the-fly image tool attached to the residual (continuum subtracted) image.

Arguments





Inputs

residfile

Output fitted residuals image file name. Default is unset.

allowed:

string

Default:

fitfile

Output fitted image file name. Default is unset.

allowed:

string

Default:

sigmafile

Input weights image for fitting. Default is unset.

allowed:

string

Default:

axis

The profile axis to fit, Default is spectral axis if it exists else last axis.

allowed:

int

Default:

-1

order

The order of the polynomial

allowed:

int

Default:

0

region

The region of interest. Default is whole image.

allowed:

any

Default:

record

mask

OTF mask, Boolean LEL expression or mask region. Default is none.

allowed:

any

Default:

variant

overwrite

Overwrite (unprompted) pre-existing output files?

allowed:

bool

Default:

false

Returns
casaimage

Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu

Copyright © 2007 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search

Updated daily during alpha development.