casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
Functions
sdplot Namespace Reference

Functions

def sdplot

Function Documentation

def sdplot.sdplot (   infile = '',
  antenna = 0,
  fluxunit = '',
  telescopeparm = '',
  specunit = '',
  restfreq = '',
  frame = '',
  doppler = '',
  scanlist = [],
  field = '',
  iflist = [],
  pollist = [],
  beamlist = [],
  scanaverage = False,
  timeaverage = False,
  tweight = 'tintsys',
  polaverage = False,
  pweight = 'tsys',
  kernel = 'none',
  kwidth = 5,
  plottype = 'spectra',
  stack = 'p',
  panel = 'i',
  flrange = [],
  sprange = [],
  linecat = 'none',
  linedop = 0.0,
  subplot = -1,
  colormap = 'none',
  linestyles = 'none',
  linewidth = 1,
  histogram = False,
  center = '',
  cell = [],
  header = True,
  headsize = 9,
  plotstyle = False,
  margin = [],
  legendloc = 1,
  outfile = '',
  overwrite = False 
)
ASAP SD plotting task 
  Keyword arguments:
infile -- name of input SD dataset
antenna -- antenna name or id (only effective for MS input). 
fluxunit -- units for line flux
        options: 'K','Jy',''
        default: '' (keep current fluxunit)
        WARNING: For GBT data, see description below.
    >>> fluxunit expandable parameter
         telescopeparm -- the telescope characteristics
                options: (str) name or (list) list of gain info
                default: '' (none set)
                example: if telescopeparm='', 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.
                         telescopeparm=[104.9,0.43] diameter(m), ap.eff.
                         telescopeparm=[0.743] gain in Jy/K
                         telescopeparm='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 -- rest frequency
                 default: '' (use current setting)
                 example: 4.6e10 (float value in Hz),
                          '46GHz' (string with unit),
                          ['345.8GHz', 347.0e9, 356.7e9] (for each IF)
                          [{'name':'CO','value':345e9}] (a value with name)
frame -- frequency frame for spectral axis
        options: (str) 'LSRK','REST','TOPO','LSRD','BARY',
                 'GEO','GALACTO','LGROUP','CMB'
        default: currently set frame in scantable
        WARNING: frame='REST' not yet implemented
doppler -- doppler mode
        options: (str) 'RADIO','OPTICAL','Z','BETA','GAMMA'
        default: currently set doppler in scantable
scanlist -- list or string of scan numbers to process
        default: [] (use all scans)
        example: [21,22,23,24], or "21~24"
        this selection is in addition to field, iflist, pollist,
        and beamlist
field -- selection string for selecting scans by name
        default: '' (no name selection)
        example: 'FLS3a*'
        this selection is in addition to scanlist, iflist, pollist,
        and beamlist
iflist -- list or string of IF id numbers to select
        default: [] (use all IFs)
        example: [15]
        this selection is in addition to scanlist, field, pollist,
        and beamlist
pollist -- list or string of polarization id numbers to select
        default: [] (use all polarizations)
        example: [1]
        this selection is in addition to scanlist, field, iflist,
        and beamlist
beamlist -- list or string of beam id numbers to select
        default: [] (use all beams)
        example: [1]
        this selection is in addition to scanlist, field, iflist,
        and pollist
scanaverage -- average integs within scans
        options: (bool) True,False
        default: False
timeaverage -- average times for multiple scan cycles
        options: (bool) True,False
        default: False
        example: if True, this happens after calibration
        >>>timeaverage expandable parameter
         tweight -- weighting for time average
                 options: 'var'   (1/var(spec) weighted)
                          'tsys'  (1/Tsys**2 weighted)
                          'tint'  (integration time weighted)
                          'tintsys'  (Tint/Tsys**2)
                          'median'  ( median averaging)
                 default: 'tintsys'
polaverage -- average 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: 'none'
        >>>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'.
        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
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 sdplot 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 either by a list
of IDs or by a CASA type selection syntax using a string of 
comma separated numbers with operaters, i.e., '~', '>', '>=',
'<', and '<='.
For example, the following two selections are equivalent:
scanlist = [0, 1, 2, 7, 8, 9, 15]
scanlist = "<3,7~9,15"

*** 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.

*** 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.

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 telescopeparm='',
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 telescopeparm 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.  

Definition at line 13 of file sdplot.py.