Tool: tableplot Plot data from tables via plotter
Method: tableplot Construct a tableplot tool
Method: open *\n Specify list of tables. \n All plots will operate on these tables \n until called again to change the list of tables. \n Example : \n tp.open(tabnames=['ngc5921.ms','ngc3342.ms']); \n*
tabnames stringArray List of strings : Table names
Method: selectdata * \n Perform a TaQL based subtable selection for subsequent plots. \n Example : \n tp.selectdata(taqlstring='ANTENNA1==5') \n*
taqlstring string TaQL string for selection
Method: plotdata * \n Plot the result of a general TaQL expression.\n \n This function evaluates the specified TaQL expressions for the X and Y axes \n of a two-dimensional plot,extracts the resulting columns, and plots them. \n \n() TaQL expressions resulting in scalars are plotted as a single X-Y plot. \n Expressions involving Array-Columns can result in arrays which are then \n plotted as overlays. \n \n() The default mode of operation is to plot one expression against another. \n In the case of Array-Columns (ex. DATA column of a measurement set with \n each row containing an array of shape $NColumns \times NPolarzations$), \n a Cross-plot mode allows plots with the x-axis representing one axes of \n the Array-Column. (ex. X-axis is channel number or polarization number).\n \n() If multiple tables are specified in tp.open(), then the TaQL expressions \n are applied to all tables and overlay plots are generated. \n \n() Plots can be made to separate panels whose locations on the plot window \n are user specified (multipanel mode).\n \n() Multiple successive plots can be stacked upon each other on a panel \n (overplot mode).\n \n() Plotter options can be specifed to control appearance, plot-style, \n labels, etc. \n \n Valid TaQL strings must satisfy the following conditions.\n \n() Each TaQL string must result in a Double scalar or array. \n'AMPLITUDE(DATA[1,1])'} results in a Double scalar (valid). \n'AMPLITUDE(DATA[1:2,1])'} results in a Double array (valid). \n'MEAN(AMPLITUDE(DATA[1:2,1]))'} results in a Double scalar (valid). \n'DATA[1,1]'} results in a Complex scalar (NOT valid). \n'AMPLITUDE(DATA[1,1])<10'} results in a Bool scalar (NOT valid).\n \n() All TaQL functions resulting in Double Scalars/Arrays are allowed, \n except for those involving an explicit collapse axis (means,sums,etc..). \n Note that these functions are different from mean,sum,etc.. which \n are supported.\n \n() TaQL strings must be provided as pairs of strings, with the \n X-TaQL first, followed by the Y-TaQL. There are 3 cases.\n \n X-TaQL Scalar, Y-TaQL Scalar (one-to-one single plot) \n X-TaQL Scalar, Y-TaQL Array (one-to-many overlay plot) \n X-TaQL Array, Y-TaQL Array (if the shapes are the same, \n then a one-to-one mapping is done, otherwise only the first \n X-TaQL result is used for a one-to-many mapping with the Y-TaQL Array.)\n\n \n Plotting options ('poption' entries) are listed below. \n Default values are indicated within [ ] when present.\n \n nrows [ 1 ] : Number of rows of panels \n ncols [ 1 ] : Number of columns of panels \n panel [ 1 ] : Panel index. Must be in [1,nrows x ncols] \n plotcolour [ 1 ] : Plot colour. Codes for matplotlib are \n [0:black, 1:red, 2:green, 3:blue, 4:cyan, 5:yellow] \n [-1:magenta is reserved for plotting flagged \n values if useflags = 1 ] \n multicolour [ False ] : True -> Each channel,pol appears in a different colour. \n False -> Data from all pols and channels appear \n in the same colour. Different colours \n appear for different layers (overplot) \n or data from different tables. \n timeplot [ False ] : True -> Turn on date/time formatting for the x-axis. \n overplot [ False ] : True -> Overlay on an existing plot. All layers will \n remain active for data editing via flagging. Labels \n will be those of the top-most layer. \n False -> Any existing plot is wiped clean before \n plotting. Only this plot will be visible and active. \n multipanel [ False ] : True -> Plot on multiple panels (specified by \n (nrows,ncols,panel). All panels will be active \n for data editing via flagging. \n False -> Only one panel is visible and active \n at any time. \n py_plotsymbol [ , ] : Plot markers. Options for matplotlib are \n [, . o x * ] \n \n plotrange [ ] : Only data within this specific range of values \n [xmin,xmax,ymin,ymax] will be plotted. \n Default is the data range. \n useflags [ 0 ] : 0 -> Plot only unflagged data. \n 1 -> Plot only flagged data. \n 2 -> Plot unflagged and flagged data, in different colours. \n crossdirection [ False ] : Applies only with CROSS-plots on table ArrayColumns. \n False -> use column number as the x-axis (ex. channel no.). \n True -> use row number as the x-axis (ex. polarization no.). \n pointlabels [ ] : Data points can be annotated by supplying a \n list of labels. If N labels are supplied, the \n first N data points plotted will be annotated. \n (Note that if data is edited via flagging,the \n points are relabeled to label the first N points.) \n windowsize [ 8.0 ] : horizontal size of plot window (inches) \n aspectratio [ 0.8 ] : aspect-ratio of the plot window (dx/dy) \n fontsize [ 1.0 ] : font size of label text\n \n \n Example :\n \n # Plot data amplitude vs uv-distance for a Measurement set table \n # as a single panel plot, for channels 1 to 3 of polarization 1. \n \n pop = { 'nrows':1, 'ncols':1,'panel':1} \n labels = ['Amplitude vs UVdist','uvdist','amplitude']; \n xystr = ['SQRT(SUMSQUARE(UVW[1:2]))','AMPLITUDE(DATA[1,1:2])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n Example :\n \n # Multi-panel plotting \n \n # uvdist for pol 1 and chan 1,2 on panel 211 \n pop = { 'nrows':2, 'ncols':1,'panel':1} \n labels = ['Amplitude vs UVdist','uvdist','amplitude']; \n xystr = ['SQRT(SUMSQUARE(UVW[1:2]))','AMPLITUDE(DATA[1,1:2])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n # uvdist for pol 2 and chan 1,2 (overplot=1) on panel 211 \n pop = { 'nrows':2, 'ncols':1,'panel':1, 'overplot':True, 'multipanel':True} \n labels = ['Amplitude vs UVdist','uvdist','amplitude']; \n xystr = ['SQRT(SUMSQUARE(UVW[1:2]))','AMPLITUDE(DATA[2,1:2])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n # uv coverage on panel 223 \n pop = { 'nrows':2, 'ncols':2,'panel':3, 'plotcolour':4, 'multipanel':True} \n labels = ['UV Coverage','u','v']; \n xystr = ['UVW[1]','UVW[2]','-UVW[1]','-UVW[2]']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n # amp(data[1:2,1:10]) vs channel number on panel 224 \n pop = { 'nrows':2, 'ncols':2,'panel':4, 'plotcolour':1, 'multipanel':True} \n labels = ['Amplitude vs Baseline number','baseline number','amplitude']; \n xystr = ['28*ANTENNA1+ANTENNA2-(ANTENNA1-1)*(ANTENNA1+2)/2','AMPLITUDE(DATA[1:2,1:10])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n Example :\n \n # Plotting with time formatting \n # vistime for 10 chans (timeplot=1) \n \n pop = { 'nrows':1, 'ncols':1,'panel':1,'timeplot':True} \n labels = ['Timeplot','time','amplitude']; \n xystr = ['TIME','AMPLITUDE(DATA[1:2,1:10])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n Example :\n \n # Cross-plots - take in a single TaQL expression involving an ArrayColumn, \n # and use the column numbers of each Array per row of the table as the x-axis. \n # In a measurement set, the DATA ArrayColumn contains 2D Arrays, each with \n # NCHAN columns and NPOL rows. Plotting with 'CROSS' as the X-TaQL, uses \n # channel numbers as the x-axis. The option 'crossdirection=True' can be used \n # to plot with polarization on the x-axis. \n \n pop = { 'nrows':2, 'ncols':1,'panel':1, 'plotcolour':2} \n labels = ['Amplitude vs Channel number','chan','amplitude']; \n xystr = ['CROSS','AMPLITUDE(DATA[1:2,1:10])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n pop = { 'nrows':2, 'ncols':1,'panel':1, 'plotcolour':2, 'multipanel':True, 'crossdirection':True} \n labels = ['Amplitude vs Polarization number','pol','amplitude']; \n xystr = ['CROSS','AMPLITUDE(DATA[1:2,1:10])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n Example :\n \n # Individual points can be annotated by specifying the 'pointlabels' parameter. \n # If N labels are specified, the first N data points to be plotted, are annotated. \n \n pop = {'nrows':1,'ncols':1, 'panel':1, 'plotcolour':1,'py_plotsymbol':'o', 'pointlabels':[' A1',' A2',' A3',' A4',' A5',' A6',' A7',' A8',' A9',' B1',' B2',' B3',' B4',' B5',' B6',' B7',' B8',' B9',' C1',' C2',' C3',' C4',' C5',' C6',' C7',' C8',' C9',' D1',' D2',' D3',' D4']} \n xystr = ['POSITION[1]','POSITION[2]']; \n labels = ['Antenna positions','x','y']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n Example :\n \n # To plot with multiple colours for each channel and polarization of an MS. \n # (multicolour=1, plotcolour>5) \n \n pop = { 'nrows':1, 'ncols':1,'panel':1, 'plotcolour':6,'useflags':0, 'multicolour':True} \n labels = ['Amplitude vs UVdist','uvdist','amplitude']; \n xystr = ['SQRT(SUMSQUARE(UVW[1:2]))','AMPLITUDE(DATA[1:2,1:2])']; \n tp.plotdata(poption=pop,labels=labels,datastr=xystr); \n \n **
poption any Record of plot options
labels stringArray List of strings : Title,Xlabel,Ylabel
datastr stringArray List of TaQL strings : X,Y
Method: iterplotstart * \n Begin a series of plots using subtables constructed via an iteration axes.\n \n In addition to plotdata parameters, set a list of iteration axes \n (Table column names) and use iterplotnext() to step through. \n Only forward step through is allowed.\n \n Example :\n \n pop = { 'nrows':3, 'ncols':1,'panel':1, 'plotcolour':1, 'aspectratio':1.6} \n iteraxes = ['ANTENNA1']; \n labels = ['Amplitude vs UVdist','uvdist','amplitude']; \n xystr = ['SQRT(SUMSQUARE(UVW[1:2]))','AMPLITUDE(DATA[1,1:2])']; \n tp.iterplotstart(poption=pop, labels=labels, datastr=xystr, iteraxes=iteraxes); \n tp.iterplotnext(); \n*
poption any Record of plot options default is nxpanels=1,nypanels=1,windowsize=6, aspectratio=0.8,fontsize=1.0
labels stringArray List of strings : Title,Xlabel,Ylabel
datastr stringArray List of TaQL strings : X,Y
iteraxes stringArray List of strings : Iteration axes
Method: iterplotnext * \n Continue plotting by stepping through the iteration axes. \n Call after tp.iterplotstart(). \n *
Method: iterplotstop * \n To be called at the end of the plot iterations, or in between if desired. \n Okay if ignored. \n*
Method: markflags * \n Mark or specify a rectangular region to flag.\n \n Call without arguments to enable mouse based interactive region marking. \n Marked regions can be discarded via the 'Alt' key. \n \n Command-line region marking can be done by setting panel and region parameters.\n \n After marking flag regions, call tp.flagdata() or tp.unflagdata().\n \n Example : \n tp.markflags(nrows=2,ncols=1,panel=1,region=[300.0,400.0,0.090,0.095]);\n \n*
nrows int Number of rows of panels
ncols int Number of columns of panels
panel int Panel number
region doubleArray [xmin,ymin,xmax,ymax] bounding box
Method: flagdata * \n Set flags for all regions marked using tp.markflags(). \n \n The plot is automatically redrawn after applying flags. \n \n Options : \n diskwrite = [False : flag in memory],[True : write flags to disk] \n rowflags = [False : use FLAG column],[True : use FLAG,FLAG_ROW ] \n*
diskwrite bool true to write flags to the table on disk, false to set dummy flags
rowflag bool true to set a row-flag in addition to individual data flags, false to ignore row flags if individual flags exist
Method: unflagdata * \n Unset flags for all regions marked using tp.markflags(). \n \n This is similar to the tp.flagdata() function in all other respects.\n \n Options : \n diskwrite = [False : unflag in memory], [True : write flags to disk] \n rowflags = [False : use FLAG column]. [True : use FLAG,FLAG_ROW ] \n*
diskwrite bool true to write flags to the table on disk, false to set dummy flags
rowflag bool true to set a row-flag in addition to individual data flags, false to ignore row flags if individual flags exist
Method: zoomplot * \n (ONLY WITH PGPLOT) Zoom/Unzoom on marked regions.\n For MATPLOTLIB use the plot window GUI\n **
nrows int Number of rows of panels
ncols int Number of columns of panels
panel int Panel number
direction int 1 to zoom, 0 to unzoom
Method: clearflags * \n Clear all flags in the table \n *
Method: clearplot * \n Clear a plot. \n clearplot() or clearplot(0) clears all panels.\n clearplot(panel) clears only the specified panel\n *
panel int Panel number
Method: done * \n Clean up the tableplot tool, and make it ready for tp.open() again.\n *

-- WesYoung - 17 Jul 2006
Topic revision: r1 - 2006-07-17, WesYoung
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback