NRAO Home > CASA > CASA Task Reference Manual

0.1.102 sdbaseline2old

Requires:

Synopsis
ASAP SD task [DEPRECATED]: Fit/subtract a spectral baseline

Description

### DEPRECATION WARNING ################################################# This task will be removed in CASA 5.1. To a very great extent, the functionality of this task with MeasurementSet format is replicated with sdbaseline. #########################################################################

Task sdbaseline2old performs baseline fitting/removal for single-dish spectra.

Arguments





Inputs

infile

name of input SD dataset

allowed:

string

Default:

antenna

select an antenna name or ID, e.g. ’PM03’ (only effective for MS input)

allowed:

any

Default:

variant 0

row

select data by row IDs, e.g. ’3,5,7’ (”=all)

allowed:

string

Default:

field

select data by field IDs and names, e.g. ’3C2*’ (”=all)

allowed:

string

Default:

spw

select data by IF IDs (spectral windows), e.g. ’3,5,7’ (”=all)

allowed:

string

Default:

restfreq

the rest frequency, e.g. ’1.41GHz’ (default unit: Hz) (see examples in help)

allowed:

any

Default:

variant

frame

frequency reference frame (”=current)

allowed:

string

Default:

doppler

doppler convention (”=current). Effective only when spw selection is in velocity unit.

allowed:

string

Default:

timerange

select data by time range, e.g. ’09:14:0~09:54:0’ (”=all) (see examples in help)

allowed:

string

Default:

scan

select data by scan numbers, e.g. ’21~23’ (”=all)

allowed:

string

Default:

pol

select data by polarization IDs, e.g. ’0,1’ (”=all)

allowed:

string

Default:

blmode

baselining mode (’subtract’ or ’apply’)

allowed:

string

Default:

subtract

blparam

per spectrum fit parameters

allowed:

any

Default:

variant

bltable

name of baseline table

allowed:

string

Default:

outfile

name of output file (See a WARNING in help)

allowed:

string

Default:

overwrite

overwrite the output file if already exists

allowed:

bool

Default:

False

keeprows

keep all rows of input scantable in output table [True, False]

allowed:

bool

Default:

False

Returns
void

Example

 
-----------------  
Keyword arguments  
-----------------  
infile -- name of input SD dataset  
antenna -- select an antenna name or ID  
        default: 0  
        example: ’PM03’  
        NOTE this parameter is effective only for MS input  
field -- select data by field IDs and names  
        default: ’’ (use all fields)  
        example: field=’3C2*’ (all names starting with 3C2)  
                 field=’0,4,5~7’ (field IDs 0,4,5,6,7)  
                 field=’0,3C273’ (field ID 0 or field named 3C273)  
        this selection is in addition to the other selections to data  
spw -- select data by IF IDs (spectral windows)/channels  
        default: ’’ (use all IFs and channels)  
        example: spw=’3,5,7’ (IF IDs 3,5,7; all channels)  
                 spw=’<2’ (IF IDs less than 2, i.e., 0,1; all channels)  
                 spw=’30~45GHz’ (IF IDs with the center frequencies in range 30-45GHz; all channels)  
                 spw=’0:5~61’ (IF ID 0; channels 5 to 61; all channels)  
                 spw=’3:10~20;50~60’ (select multiple channel ranges within IF ID 3)  
                 spw=’3:10~20,4:0~30’ (select different channel ranges for IF IDs 3 and 4)  
                 spw=’1~4;6:15~48’ (for channels 15 through 48 for IF IDs 1,2,3,4 and 6)  
        this selection is in addition to the other selections to data  
    >>> spw expandable parameter  
        restfreq -- the rest frequency  
                    available type includes float, int, string, list of float,  
                    list of int, list of string, and list of dictionary. the  
                    default unit of restfreq in case of float, int, or string  
                    without unit is Hz. string input can be a value only  
                    (treated as Hz) or a value followed by unit for which ’GHz’,  
                    ’MHz’,’kHz’,and ’Hz’ are available.  
                    a list can be used to set different rest frequencies for  
                    each IF. the length of list input must be number of IFs.  
                    dictionary input should be a pair of line name and  
                    frequency with keys of ’name’ and ’value’, respectively.  
                    values in the dictionary input follows the same manner as  
                    as for single float or string input.  
                example: 345.796  
                         ’1420MHz’  
                         [345.8, 347.0, 356.7]  
                         [’345.8MHz’, ’347.0MHz’, ’356.7MHz’]  
                         [{’name’:’CO’,’value’:345}]  
        frame -- frequency reference frame  
                options: ’LSRK’, ’TOPO’, ’LSRD’, ’BARY’, ’GALACTO’, ’LGROUP’, ’CMB’  
                default: ’’ (keep current frame in data)  
        doppler -- doppler convention (effective only when spw is in  
                   velocity unit)  
                options: ’RADIO’, ’OPTICAL’, ’Z’, ’BETA’, or ’GAMMA’  
                default: ’’ (keep current doppler setting in data)  
timerange -- select data by time range  
        default: ’’ (use all)  
        example: timerange = ’YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss’  
                 Note: YYYY/MM/DD can be dropped as needed:  
                 timerange=’09:14:00~09:54:00’ # this time range  
                 timerange=’09:44:00’ # data within one integration of time  
                 timerange=’>10:24:00’ # data after this time  
                 timerange=’09:44:00+00:13:00’ #data 13 minutes after time  
        this selection is in addition to the other selections to data  
scan -- select data by scan numbers  
        default: ’’ (use all scans)  
        example: scan=’21~23’ (scan IDs 21,22,23)  
        this selection is in addition to the other selections to data  
pol -- select data by polarization IDs  
        default: ’’ (use all polarizations)  
        example: pol=’0,1’ (polarization IDs 0,1)  
        this selection is in addition to the other selections to data  
blmode -- ’subtract’ or ’apply’  
        default: ’subtract’  
    >>> blmode expandable parameter  
        blparam -- per spectrum fit parameters. it must be a list of  
                   dictionary. Each dictionary corresponds to each  
                   spectrum and must contain the following keys and values:  
                     ’row’: row number,  
                     ’blfunc’: function name. available ones include  
                               ’poly’, ’chebyshev’, ’cspline’ and ’sinusoid’,  
                     ’order’: maximum order of polynomial. needed when  
                              blfunc=’poly’ or ’chebyshev’,  
                     ’npiece’: number or piecewise polynomial.  
                               needed when blfunc=’cspline’ and  
                     ’nwave’: a list of sinusoidal wave numbers.  
                              needed when blfunc=’sinusoid’.  
                example: [{’row’:0,’blfunc’:’poly’,’order’:5},  
                          {’row’:1,’blfunc’:’chebyshev’,’order’:10},  
                          {’row’:2,’blfunc’:’cspline’,’npiece’:4},  
                          {’row’:3,’blfunc’:’sinusoid’,’nwave’:[0,1,2,3]}, ...]  
bltable -- the name of baseline table (bltable=’’ would subtract baseline without  
        creating bltable. mandatory when blmode=’apply’)  
        default: ’’  
outfile -- name of output file  
        default: ’’ (<infile>_bs)  
overwrite -- overwrite existing outfile and bltable or not  
        options: (bool) True, False  
        default: False  
 
-----------  
DESCRIPTION  
-----------  
 
Task sdbaseline2old performs baseline fitting/removal for single-dish spectra.  
 
-----------------------  
BASELINE MODEL FUNCTION  
-----------------------  
The list of available model functions are shown above (see Keyword arguments  
section). In general ’cspline’ or ’chebyshev’ are recommended since they are  
more stable than others. ’poly’ will work for lower order but will be unstable  
for higher order fitting. ’sinusoid’ is kind of special mode that will be  
useful for the data that clearly shows standing wave in the spectral baseline.  
 
----------------------------------  
SIGMA CLIPPING (ITERATIVE FITTING)  
----------------------------------  
In general least square fitting is strongly affected by an extreme data  
so that the resulting fit makes worse. Sigma clipping is an iterative  
baseline fitting with data clipping based on a certain threshold. Threshold  
is set as a certain factor times rms of the resulting (baseline subtracted)  
spectra. If sigma clipping is on, baseline fit/removal is performed several  
times. After each baseline subtraction, the data whose absolute value is  
above threshold are detected and those data are excluded from the next round  
of fitting. By using sigma clipping, extreme data are excluded from the  
fit so that resulting fit is more robust.  
 
The user is able to control a multiplication factor using parameter  
clipthresh for clipping threshold based on rms. Actual threshold for sigma  
clipping will be (clipthresh) x (rms of spectra). Also, the user can specify  
number of maximum iteration to the parameter clipniter.  
 
In general, sigma clipping will lower the performance since it increases  
number of fits per spectra. However, it is strongly recommended to turn  
on sigma clipping unless you are sure that the data is free from any kind  
of extreme values that may affect the fit.  
 


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