Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: tableplot.iterplotstart - Function Up: tableplot - Tool Previous: tableplot.settables - Function


tableplot.plotdata - Function



Package utility
Module table
Tool tableplot


Plot the result of a general TaQL expression


Synopsis
plotdata(poption, labels, datastr)


Description
This function evaluates the specified TaQL expressions for the X and Y axes of a two-dimensional scatter plot, extracts the resulting columns, and plots them. TaQL expressions resulting in arrays result in overlay plots. If multiple tables are specified in settables, then the TaQL expressions are applied to all tables and overlay plots are generated. Currently only single panel plots are supported for this function.

Valid TaQL strings must satisfy the following conditions.

1.
Each TaQL string must result in a Double scalar or array.
'AMPLITUDE(DATA[1,1])' results in a Double scalar (valid).
'AMPLITUDE(DATA[1:2,1])' results in a Double array (valid).
'MEAN(AMPLITUDE(DATA[1:2,1]))' results in a Double scalar (valid).
'DATA[1,1]' results in a Complex scalar (NOT valid).
'AMPLITUDE(DATA[1,1])<10' results in a Bool scalar (NOT valid).
2.
All TaQL functions resulting in Double Scalars/Arrays are allowed, except for those involving an explicit collapse axis (means,sums,etc..). Note that these functions are different from mean,sum,etc.. which are supported.
3.
TaQL strings must be provided as pairs of strings, with the X-TaQL first, followed by the Y-TaQL. There are 3 cases.
X-TaQL - Scalar, Y-TaQL - Scalar (one-to-one single plot)
X-TaQL - Scalar, Y-TaQL - Array (one-to-many overlay plot)
X-TaQL - Array, Y-TaQL - Array (if the shapes are the same, then a one-to-one mapping is done, otherwise only the first X-TaQL result is used for a one-to-many mapping with the Y-TaQL Array.)
4.
For cross plots (for example amplitude vs channel plots in an MS), the X-TaQL must be a string containing 'CROSS'. The Y-TaQL is used to read out the data from the table, and the x-values are the column indices (channel numbers) chosen by the Y-TaQL.

Various plotting options can be set as follows.

plotopts.nxpanels := 1;      # number of panels along the horizontal axis. 
plotopts.nypanels := 1;      # number of panels along the vertical axis.
plotopts.windowsize := 5;    # horizontal size of the pgplot window (inches)
plotopts.aspectratio := 0.8; # aspect-ratio of the pgplot window (dx/dy)
plotopts.fontsize := 1.0;    # font size of labels
plotopts.plotcolour := 21;   # first digit : colour, second digit : colour increment (overlays)
plotopts.plotsymbol := 5;    # plot each point with a cross
plotopts.linewidth := 2;     # line width (all lines)
plotopts.plotrange := [xmin,xmax,ymin,ymax] # specified plot range over-rides the data range if
                                            # it lies within the data range.
plotopts.useflags := 0;      # 0:plot unflagged data, 1:plot flagged data, 
                             # 2:plot both flagged and unflagged data (different colours)
Plot labelling is controlled from glish.



Arguments

poption   Record of plot options
    Allowed: Record
    Default: nxpanels=1,nypanels=1,windowsize=6, aspectratio=0.8,fontsize=1.0, plotcolour=10, plotsymbol=1, linewidth=2, plotrange=[-1e+30,1e+30,-1e+30,1e+30],useflags=0
labels   List of strings : Title,Xlabel,Ylabel
    Allowed: Vector of Strings
    Default: no default
datastr   List of TaQL strings : X,Y
    Allowed: Vector of Strings
    Default: no default


Returns
1 if plotting is successful, -1 otherwise


Example
# create a tableplot tool, set tables and plot amplitude vs uvdist 
# for two Measurement Set tables.
# Operate on channel 1 for stokes 1 and 2 using the DATA column and
# produce an overlay plot. Use two different colours for each overlay
# and plot both flagged and unflagged data in separate colours.

  tp := tableplot();
  tp.settables(tabnames=['3c273.ms','3c48.ms']);

  plotopts.nxpanels := 1;      
  plotopts.nypanels := 1;      
  plotopts.windowsize := 5;    
  plotopts.aspectratio := 0.8; 
  plotopts.fontsize := 1.0;    
  plotopts.plotcolour := 21;   
  plotopts.plotstyle := 2;
  plotopts.linewidth := 2;
  plotopts.timeplot := 1;
  plotopts.plotsymbol := 5;
  plotopts.plotrange := [1000.0,2000.0,100.0,5000.0];
  plotopts.useflags:=2;

  labels := ['Amplitude vs UVdist','uvdist','amplitude'];
  xystr := ['SQRT(SUMSQUARE(UVW[1:2]))','AMPLITUDE(DATA[1:2,1])'];
  tp.plotdata(poption=plotopts,labels=labels,datastr=xystr);
TaQL strings for the above example can also be written as follows.
  xystr := ['SQRT(UVW[1]*UVW[1]+UVW[2]*UVW[2])','AMPLITUDE(DATA[1:2,1])'];

Multiple X-TaQL, Y-TaQL pairs can be given and result in an overlay plot. A plot of UV coverage can be obtained by an overlay plot as follows.

  plotopts.nxpanels := 1;
  plotopts.nypanels := 1;
  plotopts.aspectratio := 1.0;
  labels := ['UV coverage','u','v'];
  xystr := ['UVW[1]','UVW[2]','-1*UVW[1]','-1*UVW[2]'];
  tp.plotdata(poption=plotopts,labels=labels,datastr=xystr);

TaQL strings for cross plots (amplitude vs channel number) can be written as follows.

  xystr := ['CROSS','AMPLITUDE(DATA[1,1:32])'];





next up previous contents index
Next: tableplot.iterplotstart - Function Up: tableplot - Tool Previous: tableplot.settables - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15