NRAO Home > CASA > CASA Toolkit Reference Manual
sd.scantable.auto_poly_baseline - Function

5.1.2 Perform automatic line finding and baseline subtraction using polynomial function
Description

Return a scan which has been baselined (all rows) by a polynomial. Spectral lines are detected first using linefinder and masked out to avoid them affecting the baseline solution.

The edge argument is an optional number of channel to drop at the edge of spectrum. If only one value is specified, the same number will be dropped from both sides of the spectrum. Default is to keep all channels. Nested tuples represent individual edge selection for different IFs (a number of spectral channels can be different).

The threshold and chan_avg_limit arguments are linefinder options. The former is the threshold used by line finder. It is better to keep it large as only strong lines affect the baseline solution. The later is a maximum number of consequtive spectral channels to average during the search of weak and broad lines. The default is no averaging (and no search for weak lines). If such lines can affect the fitted baseline (e.g. a high order polynomial is fitted), increase this parameter (usually values up to 8 are reasonable). Most users of this method should find the default value sufficient. See linefinder for more details on these options.

You can verify and decide whether you apply the fit result or not, if plot argument is True. In that case, you have to answer ’y’ or ’n’ for each spectra so that setting True is not recommended for large dataset.

Note: The best-fit parameter values output in logger and/or blfile are now based on specunit of ’channel’.

Arguments





Inputs

mask

An optional mask retreived from scantable

allowed:

bool array

Default:

None (no mask)

order

The order of the polynomial

allowed:

integer

Default:

0

edge

An optional number of channel to drop at the edge of spectrum

allowed:

integer, integer array

Default:

(0,0)

threshold

The threshold used by line finder

allowed:

float

Default:

3

chan_avg_limit

A maximum number of consequtive spectral channels to average during the search

allowed:

int

Default:

1

plot

Plot the fit and the residual.

allowed:

bool

Default:

False

insitu

If False a new scantable is returned

allowed:

bool

Default:

None (use default value)

getresidual

If False, return best-fit value instead of residual

allowed:

bool

Default:

True

showprogress

Show progress status for large data

allowed:

bool

Default:

True

minnrow

Minimum number of spectra to show progress status

allowed:

integer

Default:

1000

outlog

Output the coefficients of the best-fit function to logger

allowed:

bool

Default:

False

blfile

Name of text file in which the best-fit parameter values to be written

allowed:

string

Default:





Returns
scantable

Example

        scan = sd.scantable(’OrionS_rawACSmod_cal’,average=False)  
        scan2 = scan.auto_poly_baseline(order=7, insitu=False)


More information about CASA may be found at the CASA web page

Copyright © 2016 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