NRAO Home > CASA > CASA Task Reference Manual

0.1.110 sdmathold

Requires:

Synopsis
ASAP SD task for simple arithmetic of spectra

Description

Task sdmathold execute a simple arithmetic (i.e., subtraction, addition, multiplication, and division) expression for single dish spectra. The spectral data file can be any of the formats supported by ASAP (scantable, MS, rpfits, and SDFITS). In the expression, these file names should be put inside of single or double quotes.

You can use variables in the expression. If you want to use, you must define varnames dictionary. Name of variables should be simple, e.g. V0, V1, etc., to avoid unexpected error. Keys of varnames must be name of variables that you used in the expression, and their values will be substituted for variables in the expression. Allowed type for the value is numerical values, one- or two-dimensional lists (Python list or numpy.ndarray), and filename strings that indicate spectral data or ASCII text, which is space-separated list of numerical values consisting of adequate number of rows and columns. In case you give a list of file names in infiles, they are automatically referred to as IN0, IN1, etc. in expr and you can not use IN0, IN1, etc. as variable names in varnames.

Arguments





Inputs

infiles

a list of names of input SD datasets

allowed:

stringArray

Default:

expr

mathematical expression using spectra

allowed:

string

Default:

varnames

dictionary of variables and their values used in expr

allowed:

any

Default:

variant

antenna

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

allowed:

any

Default:

variant 0

fluxunit

units of the flux (”=current)

allowed:

string

Default:

telescopeparam

parameters of telescope for flux conversion (see examples in help)

allowed:

any

Default:

variant

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:

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:

outfile

name of output file (must be specified)

allowed:

string

Default:

outform

output file format (See a WARNING in help)

allowed:

string

Default:

ASAP

overwrite

overwrite the output file if already exists [True, False]

allowed:

bool

Default:

False

Returns
void

Example

 
Keyword arguments:  
infiles -- a list of names of input SD datasets  
        The file names will automatically replace the phrases  
        IN0, IN1, ... in expr parameter.  
expr -- mathematical expression using scantables  
varnames -- a python dictionary of variables in expr and their values.  
        Keys must be coincide with variables used in expr.  
        Values are substituted in each value in expr.  
antenna -- select an antenna name or ID  
        default: 0  
        example: ’PM03’  
        NOTE this parameter is effective only for MS input  
fluxunit -- units for line flux  
        options: ’K’,’Jy’,’’  
        default: ’’ (keep current fluxunit in data)  
        WARNING: For GBT data, see description below.  
    >>> fluxunit expandable parameter  
         telescopeparam -- parameters of telescope for flux conversion  
                 options: (str) name or (list) list of gain info  
                 default: ’’ (none set)  
                 example: if telescopeparam=’’, it tries to get the telescope  
                          name from the data.  
                          Full antenna parameters (diameter,ap.eff.) known  
                          to ASAP are  
                          ’ATPKSMB’, ’ATPKSHOH’, ’ATMOPRA’, ’DSS-43’,  
                          ’CEDUNA’,’HOBART’. For GBT, it fixes default fluxunit  
                          to ’K’ first then convert to a new fluxunit.  
                          telescopeparam=[104.9,0.43] diameter(m), ap.eff.  
                          telescopeparam=[0.743] gain in Jy/K  
                          telescopeparam=’FIX’ to change default fluxunit  
                          see description below  
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)  
       NOTE this task only supports IF ID selction and ignores channel  
       selection.  
        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)  
        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  
outfile -- name of output file  
        default: ’’ (must be specified)  
outform -- output file format  
        options: ’ASAP’,’MS2’, ’ASCII’,’SDFITS’  
        default: ’ASAP’  
        NOTE the ASAP format is easiest for further sd  
        processing; use MS2 for CASA imaging.  
        If ASCII, then will append some stuff to  
        the outfile name  
overwrite -- overwrite the output file if already exists  
        options: (bool) True,False  
        default: False  
        NOTE this parameter is ignored when outform=’ASCII’  
 
 
DESCRIPTION:  
 
Task sdmathold execute a simple arithmetic (i.e., subtraction, addition,  
multiplication, and division) expression for single dish spectra.  
The spectral data file can be any of the formats supported by  
ASAP (scantable, MS, rpfits, and SDFITS). In the expression,  
these file names should be put inside of single or double quotes.  
 
You can use variables in the expression. If you want to use, you  
must define varnames dictionary. Name of variables should be simple,  
e.g. V0, V1, etc., to avoid unexpected error. Keys of varnames must  
be name of variables that you used in the expression, and their  
values will be substituted for variables in the expression. Allowed  
type for the value is numerical values, one- or two-dimensional lists  
(Python list or numpy.ndarray), and filename strings that indicate  
spectral data or ASCII text, which is space-separated list of  
numerical values consisting of adequate number of rows and columns.  
In case you give a list of file names in infiles, they are  
automatically referred to as IN0, IN1, etc. in expr and you can not  
use IN0, IN1, etc. as variable names in varnames.  
 
The fluxunit can be set, otherwise, the current settings of the first  
spectral data in the expression are used.  
Other selections (e.g. scan No, . IF, Pol) also apply to all  
the spectral data in the expression, so if any of the data does  
not contains selection, the task will produce no output.  
 
WARNING for the GBT raw SDFITS format data as input:  
SDtasks are able to handle GBT raw SDFITS format data since the  
data filler is available. However, the functionality is not well  
tested yet, so that there may be unknown bugs.  
 
Example:  
# do on-off/off calculation  
expr=’("orion_on_data.asap"-"orion_off_data.asap")/"orion_off_data.asap"  
outfile=’orion_cal.asap’  
sdmathold()  
 
# do on-off/off calculation (using infiles)  
infiles = ["orion_on_data.asap", "orion_off_data.asap"]  
expr=’(IN0-IN1)/IN1’  
outfile=’orion_cal.asap’  
sdmathold()  
 
# do on-off/off calculation using varnames  
varnames={} (this can be skipped if you executed inp(sdmathold) or  
             default(sdmathold).)  
varnames[’V0’]="orion_on_data.asap"  
varnames[’V1’]="orion_off_data.asap"  
varnames[’V2’]=1.0  
expr=’V0/V1-V2’  
outfile=’orion_cal.asap’  
sdmathold()  
 
# do on-off/off calculation using varnames (in pythonic way)  
sdmathold(varnames={’V0’:’orion_on_data.asap’,’V1’:’orion_off_data.asap’,  
        ’V2’:1.0}, expr=’V0/V1-V2’, outfile=’orion_cal.asap’)  
 
# interpretation of ASCII file value for varnames  
If the contents of input ASCII file is shown as,  
 
   0.5 0.3 0.2  
   1.0 0.2 0.9  
 
it is interpreted as a list [[0.5, 0.3, 0.2],[1.0, 0.2, 0.9]].  
 


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