NRAO Home > CASA > CASA Task Reference Manual

0.1.112 sdplotold

Requires:

Synopsis
ASAP SD task [DEPRECATED]: plot spectra

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 plotms. #########################################################################

Task sdplotold displays single-dish spectra, total power, or pointing direction of input data. It assumes that the spectra have been calibrated. It does allow selection of scans, spectral windows, polarizations, and some time and channel averaging/smoothing options also, but does not write out this data.

This task adds an additional toolbar to Matplotlib plotter. See the cookbook for details of its capability.

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

fluxunit

units of the flux (”=current)

allowed:

string

Default:

telescopeparam

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

allowed:

any

Default:

variant

specunit

units for spectral axis

allowed:

string

Default:

restfreq

rest frequency (default unit: Hz)

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:

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:

beam

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

allowed:

string

Default:

rastermode

mode of raster selection [’row’, ’raster’]

allowed:

string

Default:

row

raster

select data by raster scan row or map iteration e.g. ’0~2’ (”=all)

allowed:

string

Default:

timeaverage

average spectra over time [True, False] (see examples in help)

allowed:

bool

Default:

False

tweight

weighting for time averaging

allowed:

string

Default:

tintsys

scanaverage

average spectra within a scan number [True, False] (see examples in help)

allowed:

bool

Default:

False

polaverage

average spectra over polarizations [True, False]

allowed:

bool

Default:

False

pweight

weighting for polarization averaging

allowed:

string

Default:

tsys

kernel

type of spectral smoothing

allowed:

string

Default:

kwidth

width of spectral kernel in channels

allowed:

int

Default:

5

plottype

type of plot

allowed:

string

Default:

spectra

stack

code for stacking on single plot for spectral plotting

allowed:

string

Default:

p

panel

code for splitting into multiple panels for spectral plotting

allowed:

string

Default:

i

flrange

range for flux axis of plot for spectral plotting

allowed:

doubleArray

Default:

sprange

range for spectral axis of plot

allowed:

any

Default:

variant

linecat

control for line catalog plotting for spectral plotting

allowed:

string

Default:

none

linedop

doppler offset for line catalog plotting (spectral plotting)

allowed:

double

Default:

0.0

subplot

number of subplots (row and column)

allowed:

int

Default:

-1

colormap

the colours to be used for plot lines

allowed:

string

Default:

none

linestyles

the linestyles to be used for plot lines

allowed:

string

Default:

none

linewidth

width of plotted lines

allowed:

any

Default:

variant 1

histogram

plot histogram

allowed:

bool

Default:

False

center

the central direction of gridding. (default: map center)

allowed:

string

Default:

cell

x and y cell size, e.g., [”1arcmin”,”1arcmin”]. (default map extent/subplot number)

allowed:

doubleArray

Default:

scanpattern

plot scan patterns.

allowed:

bool

Default:

False

header

print header information on the plot

allowed:

bool

Default:

True

headsize

header fontsize

allowed:

int

Default:

9

plotstyle

customize plot settings

allowed:

bool

Default:

False

margin

subplot margins in figure coordinate

allowed:

doubleArray

Default:

legendloc

legend location

allowed:

int

Default:

1

outfile

file name for hardcopy output

allowed:

string

Default:

overwrite

overwrite the output file if already exists

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  
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  
specunit -- units for spectral axis  
        options: (str) ’channel’,’km/s’,’GHz’,’MHz’,’kHz’,’Hz’  
        default: ’’ (=current)  
        example: this will be the units for masklist  
    >>> specunit 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)  
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  
beam -- select data by beam IDs  
        default: ’’ (use all beams)  
        example: beam=’0,1’ (beam IDs 0,1)  
        this selection is in addition to the other selections to data  
rastermode -- mode of raster selection  
        options: ’row’, ’raster’  
        default: ’row’  
    >>> rasterrow expandable parameter  
        raster -- select data by raster scan row or map iteration  
        default: ’’ (use all data)  
        example: raster=’0~2’  
timeaverage -- average spectra over time  
        options: (bool) True, False  
        default: False  
    >>>timeaverage expandable parameter  
        tweight -- weighting for time averaging  
                options: ’var’     (1/var(spec) weighted)  
                         ’tsys’    (1/Tsys**2 weighted)  
                         ’tint’    (integration time weighted)  
                         ’tintsys’ (Tint/Tsys**2)  
                         ’median’  (median averaging)  
                default: ’tintsys’  
        scanaverage -- average spectra within a scan number  
                       when True, spectra are NOT averaged over  
                       different scan numbers.  
                options: (bool) True, False  
                default: False  
polaverage -- average spectra over polarizations  
        options: (bool) True, False  
        default: False  
    >>>polaverage expandable parameter  
        pweight -- weighting for polarization average  
                options: ’var’  (1/var(spec) weighted)  
                         ’tsys’ (1/Tsys**2 weighted)  
                default: ’tsys’  
kernel -- type of spectral smoothing  
        options: ’hanning’,’gaussian’,’boxcar’, ’none’  
        default: ’’ (= no smoothing)  
    >>>kernel expandable parameter  
        kwidth -- width of spectral smoothing kernel  
                options: (int) in channels  
                default: 5  
                example: 5 or 10 seem to be popular for boxcar  
                         ignored for hanning (fixed at 5 chans)  
                         (0 will turn off gaussian or boxcar)  
plottype -- type of plot  
        options: ’spectra’,’totalpower’,’pointing’,’azel’,’grid’  
        default: ’spectra’  
    >>> plottype expandable parameters  
        stack -- code for stacking on single plot for spectral plotting  
                options: ’p’,’b’,’i’,’t’,’s’,’r’ or  
                         ’pol’, ’beam’, ’if’, ’time’, ’scan’, ’row’  
                default: ’p’  
                example: maximum of 16 stacked spectra  
                         stack by pol, beam, if, time, scan  
                Note stack selection is ignored when panel=’r’.  
                Note behavior of stack=’t’ depends on plottype:  
                   * stack by time in plottype=’spectra’  
                   * stack by source type in plottype=’totalpower’ and ’pointing’  
        panel -- code for splitting into multiple panels for spectral plotting  
                options: ’p’,’b’,’i’,’t’,’s’,’r’ or  
                         ’pol’, ’beam’, ’if’, ’time’, ’scan’, ’row’  
                default: ’i’  
                example: maximum of 16 panels  
                         panel by pol, beam, if, time, scan  
                Note panel selection is ignored when stack=’r’.  
        flrange -- range for flux axis of plot for spectral plotting  
                options: (list) [min,max]  
                default: [] (full range)  
                example: flrange=[-0.1,2.0] if ’K’  
                         assumes current fluxunit  
        sprange -- range for spectral axis of plot  
                options: (list) [min,max]  
                default: [] (full range)  
                example: sprange=[42.1,42.5] if ’GHz’  
                         assumes current specunit  
        linecat -- control for line catalog plotting for spectral plotting  
                options: (str) ’all’,’none’ or by molecule  
                default: ’none’ (no lines plotted)  
                example: linecat=’SiO’ for SiO lines  
                         linecat=’*OH’ for alcohols  
                         uses sprange to limit catalog  
                WARNING: specunit must be in frequency (*Hz)  
                         to plot from the line catalog!  
                         and must be ’GHz’ or ’MHz’ to use  
                         sprange to limit catalog  
        linedop -- doppler offset for line catalog plotting (spectral plotting)  
                options: (float) doppler velocity (km/s)  
                default: 0.0  
                example: linedop=-30.0  
        center -- the central direction of gridding  
                default: ’’ (map center)  
                example: ’J2000 19h30m00 -40d00m00’  
                Note currently only supports ’J2000’ as direction frame  
        cell -- x and y cell size of gridding  
                default: [] (map extent devided by # of subplots in x and y)  
                example: cell=[’1.0arcmin’,’1.0arcmin’]  
                         cell=’1.0arcmin’ (equivalent to the example above)  
                Note default number of subplots is 1 x 1 in plottype=’grid’.  
        subplot -- number of subplots (row and column) on a page  
                NOTICE plotter will slow down when a large number is specified  
                default: -1 (auto. for plottype=’spectra’, 1x1 for plottype=’grid’)  
                example: 23 (2 rows by 3 columns)  
        colormap -- the colours to be used for plot lines.  
                default: None  
                example: colormap="green red black cyan magenta" (html standard)  
                         colormap="g r k c m" (abbreviation)  
                         colormap="#008000 #00FFFF #FF0090" (RGB tuple)  
                         The plotter will cycle through these colours  
                         when lines are overlaid (stacking mode).  
        linestyles -- the linestyles to be used for plot lines.  
                default: None  
                example: linestyles="line dashed dotted dashdot dashdotdot dashdashdot".  
                         The plotter will cycle through these linestyles  
                         when lines are overlaid (stacking mode).  
                WARNING: Linestyles can be specified only one color has been set.  
        linewidth -- width of plotted lines.  
                default: 1  
                example: linewidth=1 (integer)  
                         linewidth=0.75 (double)  
        histogram -- plot histogram  
                options: (bool) True, False  
                default: False  
        scanpattern -- plot additional lines on the plot to indicate scan patterns  
                       when plottype=’pointing’  
                options: (bool) True, False  
                default: False  
header -- print header information on the plot  
        options: (bool) True, False  
        default: True  
        The header information is printed only on the logger when  
        plottype = ’azel’ and ’pointing’.  
    >>> header expandable parameter  
        headsize -- header font size  
                options: (int)  
                default: 9  
plotstyle -- customise plot settings  
        options: (bool) True, False  
        default: False  
    >>> plotstyle expandable parameter  
        margin -- a list of subplot margins in figure coordinate (0-1),  
                  i.e., fraction of the figure width or height.  
                  The order of elements should be:  
                  [left, bottom, right, top, horizontal space btw panels,  
                  vertical space btw panels]  
                example: margin = [0.125, 0.1, 0.9, 0.9, 0.2, 0.2]  
        legendloc -- legend location on the axes (0-10)  
                options: (integer) 0 -10  
                         see help of "sd.plotter.set_legend" for  
                         the detail of location. Note that 0 (’best’)  
                         is very slow.  
                default: 1 (’upper right’)  
outfile -- file name for hardcopy output  
        options: (str) filename.eps,.ps,.png  
        default: ’’ (no hardcopy)  
        example: ’specplot.eps’,’specplot.png’  
        Note this autodetects the format from the suffix (.eps,.ps,.png).  
overwrite -- overwrite the output file if already exists  
        options: (bool) True,False  
        default: False  
 
 
DESCRIPTION:  
 
Task sdplotold displays single-dish spectra, total power,  
or pointing direction of input data.  
It assumes that the spectra have been calibrated.  
It does allow selection of scans, IFs, polarizations, and  
some time and channel averaging/smoothing options also,  
but does not write out this data.  
 
This task adds an additional toolbar to Matplotlib plotter.  
See the cookbook for details of its capability.  
 
*** Data selection ***  
This task allows data selection via field name, scan, IF,  
polarization and beam IDs. Selection of field allows pattern  
matching using asterisk, e.g., ’FLS3a*’. Selection of scans,  
IFs, polarizations, and beams, is possible by a CASA type  
selection syntax using a string of comma separated numbers  
with operaters, i.e., ’~’, ’>’, and ’<’.  
For example, the following selection  
scan = "<3,7~9,15"  
is to select scan IDs 0, 1, 2, 7, 8, 9, and 15.  
 
-------------------------------------  
AVERAGING OF SPECTRA  
-------------------------------------  
Task sdplotold has two averaging modes, i.e., time and polarization average.  
 
When timeaverage=True, spectra are averaged over time for each IF  
(spectral window), polarization, and beam, independently. Note that,  
by default (scanaverage=False), timeaverage=True averages spectra  
irrespective of scan IDs.  
It is possible to average spectra separately for each scan ID by setting  
a sub-parameter scanaverage=True.  
For example, the combination of parameters: scan=’0~2’, timeaverage=True, and  
scanaverage=False: averages spectra in scan ID 0 through 2 all together  
                   to a spectrum,  
scanaverage=True : averages spectra per scan ID and end up with three  
                   spectra from scan 0, 1, and 2.  
 
When polaverage=True, spectra are averaged over polarization for  
each IF (spectral window) and beam. Note that, so far, time averaging is  
automatically switched on when polaverage is set to True. This behavior  
is not desirable and will be discarded in future.  
 
 
*** available plottypes ***  
* plottype = ’spectra’ plots single dish spectra. Multiple scans,  
  IFs, polarizations, and beams can be handles through stacking  
  and panelling.  
  This task uses the JPL line catalog as supplied by ASAP.  
  If you wish to use a different catalog, or have it plot  
  the line IDs from top or bottom (rather than alternating),  
  then you will need to explore the sd toolkit also.  
* plottype = ’grid’ plots spectra based on their pointing direction.  
  The spectra are gridded by direction before plotting.  
  Multiple IFs and polarizations are not handled in this mode. Only  
  the first IF and polarizaion is gridded and plotted if data  
  includes multiple IDs after selections are applied. Hence, over  
  plotting is not available  
 
Currently most of the parameters are ignored in the following modes.  
 
* plottype=’totalpower’ is used to plot the total power data.  
  and only plot option is amplitude versus data row number.  
* plottype=’azel’ plots azimuth and elevation tracks of the source.  
* plottype=’pointing’ plots antenna poinitings.  
 
*** control of plot lines in ’spectra’ and ’grid’ plottype ***  
Note that colormap and linestyles cannot be controlled at a time.  
The ’linestyles’ is ignored if both of them are specified.  
Some plot options, like changing titles, legends, fonts,  
and the like are not supported in this task.  You should use  
sd.plotter from the ASAP toolkit directly for this.  
 
ASAP recognizes the data of the "AT" telescopes, but currently  
does not know about the GBT or any other telescope. This task  
does know about GBT. Telescope name is obtained from the data.  
If you wish to change the fluxunit (see below), and telescopeparam=’’,  
for the AT telescopes it will use internal telescope parameters for  
flux conversion. For GBT, it will use an approximate aperture  
efficiency conversion.  If you give telescopeparam a list,  
then if the list has a single float it is assumed to  
be the gain in Jy/K, if two or more elements they are assumed  
to be telescope diameter (m) and aperture efficiency  
respectively.  
 
WARNING: be careful plotting otf data with lots of fields!  
 
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.  


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