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

Functions

def plotxy

Function Documentation

def plotxy.plotxy (   vis = '',
  xaxis = 'time',
  yaxis = 'amp',
  datacolumn = 'data',
  iteration = '',
  selectdata = True,
  antenna = '',
  spw = '',
  field = '',
  uvrange = '',
  timerange = '',
  correlation = '',
  scan = '',
  feed = '',
  array = '',
  averagemode = '',
  width = '1',
  timebin = '0',
  crossscans = False,
  crossbls = False,
  crossarrays = False,
  stackspw = False,
  restfreq = '',
  frame = '',
  doppler = '',
  extendflag = False,
  extendcorr = '',
  extendchan = '',
  extendspw = '',
  extendant = '',
  extendtime = '',
  subplot = 111,
  plotsymbol = '.',
  plotcolor = 'darkcyn',
  markersize = 5.0,
  linewidth = 1.0,
  plotrange = [-1,
  multicolor = 'corr',
  selectplot = False,
  overplot = False,
  newplot = False,
  clearpanel = 'Auto',
  skipnrows = 0,
  title = '',
  xlabels = '',
  ylabels = '',
  fontsize = 10.0,
  windowsize = 1.0,
  showflags = False,
  interactive = True,
  figfile = '',
  end = False 
)
An X-Y plotter/interactive flagger for visibility data.

An X-Y plotter/interactive flagger for visibility data. 

     Selected data can be flexibly plotted with a wide variety
     of axes and averaging options, including iteration over
     antennas and fields.  Data may be listed, flagged or
     unflagged interactively.  The plots can be zoomed and
     also saved to a file.  

     It is advisable to run flagmanager before using plotxy to
     flag data in order to save the current flag state before
     altering:
     flagmanager(vis='vis_name',mode='save',versionname='before_plotxy',
     comment=versionname)

     See hints on using plotxy at the end.

     
     Keyword arguments:
     vis -- Name of input visibility file
     default: none.  example: vis='ngc5921.ms'
     xaxis -- Visibility data to plot along the x-axis
     default: 'time'

     Options for BOTH x-axis and y-axis
        'time','uvdist','chan', 'corr','freq','velo', 'u','v','w',
        'azimuth','elevation','baseline','hourangle','parallacticangle'
        'amp','phase','real','imag','weight'.  'x' gives antenna array
     
     yaxis -- Visibility data to plot along the y-axis
     default: 'amp'
     Options: same as on xaxis:

       >>> yaxis expandable parameter
 datacolumn -- Visibility file data column
     Note: this parameter is automatically shown whenever the
     chosen yaxis is a data quantity (i.e. amp)
     default: 'data'; example: datacolumn='model'
     Options: 'data' (raw),'corrected','model','residual'(corrected-model)

      --- Data Selection (see help par.selectdata for more detailed information)

     field -- Select field using field id(s) or field name(s).
      ['go listobs' to obtain the list id's or names]
    default: ''=all fields
    If field string is a non-negative integer, it is assumed to
       be a field index otherwise, it is assumed to be a field name
    field='0~2'; field ids 0,1,2
    field='0,4,5~7'; field ids 0,4,5,6,7
    field='3C286,3C295'; field named 3C286 and 3C295
    field = '3,4C*'; field id 3, all names starting with 4C
     spw -- Select spectral window/channels 
     spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
     spw='<2';  spectral windows less than 2 (i.e. 0,1)
     spw='0:5~61'; spw 0, channels 5 to 61, INCLUSIVE
     spw='*:5~61'; all spw with channels 5 to 61
     spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45.
     spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
     spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60
               NOTE ';' to separate channel selections
     spw='0:0~10^2,1:20~30^5'; spw 0, channels 0,2,4,6,8,10,
           spw 1, channels 20,25,30
     selectdata -- Other data selection parameters
    default: True
       >>> selectdata expandable parameters
 timerange  -- Select data based on time range:
    default = '' (all); examples,
    timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
    Note: if YYYY/MM/DD is missing date defaults to first day in data set
    timerange='09:14:0~09:54:0' picks 40 min on first day
    timerange= '25:00:00~27:30:00' picks 1 hr to 3 hr 30min on next day
    timerange='09:44:00' data within one integration of time
    timerange='>10:24:00' data after this time
 antenna -- Select data based on antenna/baseline
    default: ''=all
    If antenna string is a non-negative integer, it is assumed
      to be an antenna index, otherwise it is assumed to be an
      antenna name
    antenna='5&6'; baseline between antenna index 5 and index 6.
    antenna='VA05&VA06'; baseline between VLA antenna 5 and 6.
    antenna='5&6;7&8'; baseline 5-6 and 7-8
    antenna='5'; all baselines with antenna index 5
    antenna= '05'; all baselines with antenna named 05
    antenna='5,6,9'; all baselines with antennas indices 5,6 and 9
 correlation -- Select correlations:
    default: '' = all correlations. Other options are any combination
                  of values from one of the valid lists:
                  'RR','LL','RL','LR','RR LL','RL LR',
                  'XX','YY','XY','YX','XX YY','XY YX'
 uvrange -- Select data within uvrange (default units meters)
    default: ''=all; example:
    uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda
    uvrange='>4klambda';uvranges greater than 4 kilo-lambda
    uvrange='0~1000km'; uvrange in kilometers
 scan -- Scan number range
 array -- (Sub)-array number range - under development
 feed -- Multi-feed number range - under development
 
     averagemode -- Select average mode
    default: 'vector' 
    Options: 'vector' = average over real and image part separately.
             'scalar' = scalar average of amplitude, vector
                            average of the phase.
             ''       = no averaging
       >>> averagemode expandable parameters
 timebin -- length of time intervals to average
          default: '0'= no time averaging
          example: timebin='60' (average over 60 second interval).
          example: timebin='all' (all times obeying other selection
                 parameters, i.e. timerange and crossscans)
 crossscans -- Have time averaging cross scan boundaries? 
      default: False=time averaging does not cross scan boundaries 
 crossbls -- Have averaging cross baseline boundaries? 
      default: False= averaging does not cross baseline boundaries 
 crossarrays -- Have averaging cross array boundaries? 
      default: False=averaging does not cross array boundaries 
 stackspw -- Stack multiple spw on top of each other?
      default: False= layout spws side-by-side for xaxis='channel'
 width -- number of channels to average
      default: '1'= no channel averaging
      example: width='32' (average 32 channels together).
      example: width='all' (all channels within each selected spw)
      example: width='allspw' (all channels and all spw averaged.)
     restfreq -- Set rest frequency or transition name
      options: (str) '' a frequency quanta or transition name
      default: currently set rest frequency and frame in MS
             see measures for known lines, e.g.
             me.linelist() to list lines
             me.me.spectralline to get frequency
      example: restfreq='1420405751.786Hz' 21cm HI frequency
             restfreq='HI'               21cm HI transition name
             restfreq='115.2712GHz'      CO line
       >>> restfreq expandable parameters
 frame -- frequency frame for spectral axis
      options: (str) 'LSRK','REST','TOPO','LSRD','BARY',
               'GEO','GALACTO','LGROUP','CMB'
      default: currently set frequency frame in MS
               see measures (me.frequency) for description
 doppler -- doppler mode
      options: (str) 'RADIO','Z','RATIO','BETA','GAMMA',
               'OPTICAL','TRUE','RELATIVISTIC'
      default: currently set doppler system in MS
               see measures (me.doppler) for description
     extendflag -- flagging extension parameters
 default: False= no extension, only flag selected data; 
 example: extendflag=True 
       >>> extendflag expandable parameters
 extendcorr  -- Extend flagging based on correlation:
    default: ''= no correlation based extension
    examples:
    extendcorr = 'all'
    extendcorr = 'half' flags RR and LL
 extendchan -- Extend flagging based on channel:
    default: ''= no channel based extension
    example:
    extendchan = 'all'
 extendspw -- Extend flagging based on spectral window:
    default: '' = no spectral window based extension
    example:
    extendspw = 'all'
 extendant -- Extend flagging based on antenna (baseline):
    default: ''= no antenna based extension
    example:
    extendant = 'all'
 extendtime -- Extend flagging based on time:
    default: ''= no time based extension
    example:
    extendant = 'all'
     subplot -- Panel number on the display screen
    default: 111 (full screen display); example:
    if iteration is non-blank, then
       subplot=yx1 window will produce y by x plots in the window.
    if iteration = '', then
       subplot=yxn; means the window will have y rows, and x columns
       with the present execution placing the plot in location n
       n = 1,..., xy, in order upper left to right, then down.  An
       example is the plotting of four fields on one frame
       field='0'; subplot=221; plotxy()
       field='1'; subplot=222; plotxy()
       field='2'; subplot=223; plotxy()
       field='3'; subplot=224; plotxy()
     overplot -- Overplot on current plot (if possible)
    default: False; example: overplot= True
     showflags -- Show the flagged and unflagged data.
    default: False; example: showflags=True
     iteration -- Iterate plots:
    default: ''; no iteration
    Options: 'field', 'antenna', 'baseline'.
    Use the 'NEXT' button on gui to iterate through values.
    To abort an iteration, close the gui window.
     plotsymbol -- plot symbol. (Options include .:,o^v><s+xDd234hH|_ or
           optionally preceded by one of color code k, r, g, b, c, y) 
    default: '.': points, medium-sized dots
    example: plotsymbol='bo' (blue points, large-sized dots
      r=red, b=blue, g=green, y=yellow
      ',' = small points
      '.' = medium points
      'o' = large points
     plotcolor -- color.  Overrides plotsymbol color settings.
    default: 'darkcyan'
    example: plotcolor='g' (green)
             plotcolor='slateblue'
             plotcolor='#7FFF34' (RGB tuple)
     multicolor -- Multi-color plotting of channels and correlations
     options: 'none','both','chan','corr'
     default: 'corr'; example: multicolor='chan'
     plotrange -- Specifies the size of the plot [xmin, xmax, ymin, ymax]
    default: [0,0,0,0];  Range is self-selected
    example: [0,0,0.00,0.20]  only y axis is specified 
    To use a time range (NOTE: somewhat different sytax from timerange
       ['22:23:24, 23:42:20', 0.02, 0.20]
       The day must be included if the visibility data span more than one day
       ['1997/05/09/22:02:00, 1997/05/09/23:00:00', 0.02, 0.20]
     selectplot -- Additional plot control parameters
    default: False; example: selectplot=true
       >>> selectplot expandable parameters
 markersize -- Size of the plotted marks
    default: 5.0; example: markersize=10.0
 linewidth -- Width of plotted lines.
    default: 1; example: linewidth=2.0
 skipnrows -- # of points to skip
    default: 0
    example: skipnrows=100 (plots every 100th point)
 newplot -- When overplotting, replace the last plot only
    default: False; can be useful when doing subplots
 clearpanel -- Clear nothing on the plot window, automatically
          clear plotting area, clear the current plot area, or
          clear the whole plot panel.
       options: None, Auto, Current, All
       default: Auto
       example: clearpanel='Current'
 title -- Plot title (above plot)
    default: ''; example: title='This is my title'
 xlabels -- Label for x axis
    default: ''; example: xlabels='X Axis'
 ylabels -- Label for y axis
    default: ''; example: ylabels='Y Axis'
 fontsize -- Font size for labels
    default: 10; example: fontsize=2
 windowsize -- Window size
    default: 1.0; not yet implemented
 interactive -- turn on/off on screen display
    options: True = interactively flag data
             False = direct output to a file without on screen display
    default: True;
 figfile -- File name to save the plotted figure to.
    default: '' = do not save figure; 
    example: figfile='myPlot.png' save figure to png file
             figfile='myPlot.txt' append plotted xy to an ascii file
 end -- File name to save the plotted figure to.
    default: False = do not quit, keep plotting; 
    example: end=True no more plotting to do

 Hints on using plotxy (see section 3.4 in cookbook)

 Useful Buttons at bottom left:
      5th--magnifying glass.  Click on this,
               left mouse button rectangle drag will zoom
               right mose button rectangle drag will unzoom a certain amount
      1st--restore original magnification

 Useful regions just above:
      Quit will terminate plotter
      Next will go to next plot as specified by iteration
      To flag, unflag, locate, you must click 'Mark Region' first
         then make appropriate region(s)
         then click flag, unflag, locate for the desired operation
         plot will then refrest

Definition at line 13 of file plotxy.py.