casa  $Rev:20696$
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
casa::BasePlot Class Reference

#include <BasePlot.h>

Inheritance diagram for casa::BasePlot:
casa::CrossPlot

List of all members.

Public Member Functions

 BasePlot ()
 Constructor.
virtual ~BasePlot ()
 Destructor.
BasePlotoperator= (const BasePlot &)
 Operator= Equate by reference.
Int init (Table &tab, Int &tableNumber, String &rootTabName, String &tableSelection, String &dataFlagColName, String &rowFlagColName)
 Attach the BasePlot object to a table/subtable.
Int createTENS (Vector< String > &datastr)
 Create TableExprNodes for all TaQL strings.
Int getData (Vector< String > &datastr, Int layer, TPConvertBase *conv, TPGuiCallBackHooks *callbackhooks_p)
 Read data from the table and fill up storage arrays.
virtual Int setPlotRange (Double &xmin, Double &xmax, Double &ymin, Double &ymax, Bool showflags, Bool columnsxaxis, String flagversion, Int averagenrows, String connectpoints=String("tablerow"), Bool doscalingcorrection=True, String multicolour=String("none"), Bool honourxflags=False)
 This function is callse from TPPlotter::setPlotRange().
Int convertCoords (Vector< Vector< Double > > &flagmarks)
 This function is called from TPPlotter::setFlagRegions().
Int flagData (Int diskwrite, Int rowflag, Int direction)
 Fill in flags in the storage arrays.
virtual Bool selectedPoint (Int np, Int nr)
Int flagData (Int direction, String msname, String ext)
Int flagData (Int direction, String msname, String spwexpr, Matrix< Int > &rowMap, Matrix< Int > &chanMap, String ext)
Int getFlags (String versionname, String msname)
Int setFlags (Int direction, Int setrowflag, String msname)
Clear all flags (FLAG and FLAG_ROW) from the current table/subtable.*/Int clearFlags()
Bool saveData (const String &filename)
virtual Double getXVal (Int pnum, Int col)
 Query the internal structures for X data values.
virtual Double getYVal (Int pnum, Int col)
 Query the internal structures for Y data values.
virtual Bool getYFlags (Int pnum, Int col)
 Query the internal structures for flags.
void showFlags ()
virtual Int getNumRows ()
 Query for the number of points per plot.
virtual Int getNumPlots ()
 Query for the number of plots.
virtual Int getColourAddOn (Int pnum)
 Get the plot colour to use - based on "multicolour" This number is added to the "color" in PlotOption, to generate the different colours for different cellrows/cellcols.
Int getPlotType ()
 Query for the type of plot (BASEPLOT) For BasePlot, this is "XYPLOT".
Vector< StringgetBasePlotInfo ()
 Get some Table Info.
virtual Int locateData (Vector< String > collist, Matrix< Double > &info, Vector< String > &cpol)
 Locate Data Step through the data, check if each point has been selected.
virtual Int locateData (Vector< String > collist, Matrix< Double > &info, Vector< String > &cpol, Matrix< Int > &rmap, Matrix< Int > &cmap)
 Make this different from the above just in case somebody else also use this function make TablePlot to know which one to call.
Int updateFlagHistory (Vector< Vector< Double > > &flagmarks, Int &direction, Int &numflags)
 Update Flag History Fill in these parameters with a list of flag regions, flag or unflag, and the number of points selected in these regions.
String getTableName ()
 Return the name of the Table being held by BP.

Public Attributes

Int NRows_p
 Number of rows in the BP's Table.
TPGuiCallBackHookscallbackhooks_p
 A pointer to the CallBack class.

Protected Member Functions

virtual Int createXTENS (Vector< String > &datastr)
 Create TableExprNodes from input TAQL strings.
Int createYTENS (Vector< String > &datastr)
virtual Int getXData (TPConvertBase *conv, Bool dummyread=False)
 Read in the values ( after TaQL evaluations ) into the storage arrays.
Int getYData (TPConvertBase *conv, Bool dummyread=False)
Int getFlags (String versionname, Bool showflags)
 Read flags from the table into theflags_p This reconciles the original indices in the FLAG column, with the indices selected via TaQL.
Int reGetYData (Int tenid, Int row, TPConvertBase *conv)
 Recompute TaQLs in case another BP has changed the flags for this row.
Int getIndices (TableExprNode &ten)
 Get TaQL incides.
void ptTraverse (const TableExprNodeRep *tenr)
 Traverse the TaQL parse tree and collect TaQL index ranges.
Int setFlags (Int direction, Int setrowflag)
 Write flags to disk.
Int cleanUp ()
 Clears currently held flag region lists and TaQL index lists.
Matrix< StringgetLocateIndices ()
 Get the chan, pol from np.
Matrix< StringgetLocateIndices (Matrix< Int > &cmap)
Matrix< IntgetLocatePolChan ()
 Get the chan, pol from np.
Int createMap ()
 Create Map_p = a matrix of important indices.
Int computeAverages (Int averagenrows)
 Compute averages of rows.
virtual Int computeXAverages (Int averagenrows, Int remrows)
 Compute averages of X values.
void BasePlotError (String msg)
 Exceptions.

Protected Attributes

Table SelTab_p
 The single Table to be accessed.
TableitsTab_p
String itsTabName_p
uInt tabNum_p
 The internal number assigned to the table by TablePlot.
String rootTabName_p
 The name of the root Table on disk.
String tabSelString_p
 A string with selection information.
Vector< StringDataStr_p
 List of TaQL strings.
Int TableTouch_p
 Flag to signal a new table being attached.
Int Layer_p
 Remember the "layer" of the plot from this basePlot.
Bool Average_p
 Flag to signal the use of averages or not.
Int nTens_p
 number of TaQL string pairs.
Vector< TableExprNodextens_p
 TableExprnodes created from these TaQL string pairs.
Vector< TableExprNodeytens_p
Matrix< Doublexplotdata_p
 Matrices to hold the actual data to be plotted.
Matrix< Floatyplotdata_p
Matrix< Booltheflags_p
 Matrix to hold the data flags.
Vector< Boolrowflags_p
 Vector to hold the row flags.
Matrix< Intflagsum_p
 Vector to hold the number of flagged cell rows/cols per row.
Bool firsttime_p
 Flag to distinguish between loading flagsum_p for the first time, and using it to check for "changed" rows.
ArrayColumn< BoolAvgFlags_p
 If averaging is done across rows, the averaged values are stored in these variables.
ScalarColumn< BoolAvgRowFlags_p
Matrix< Doubleavgxplotdata_p
Matrix< Floatavgyplotdata_p
Matrix< Boolavgtheflags_p
Vector< Boolavgrowflags_p
Vector< Intavgindices_p
Int NPlots_p
 Number of plots sum (ncellrows x ncellcols from each TaQL XY pair ) TPLP sees this number, and asks for data to create this number of plots.
Int NAvgRows_p
 Number of rows left after averaging across rows ( averagenrows )
Matrix< IntMap_p
 a VERY important data structure that holds very useful index information.
Vector< SlicerTENslices_p
 The first TaQL indices for each Y-TaQL.
Vector< IPositionTENcolshapes_p
 The Column shapes for columns accessed by each Y-TaQL.
Vector< Vector< Bool > > TENRowColFlag_p
 Holds info about which cellrows/cellcols are completely flagged per row.
Vector< IntReductionType_p
 List of reduction-types for each Y-TaQL.
Vector< BoolisArrayCol_p
 Signal for each TaQL using an ArrayCol or ScalarCol.
Vector< IPositionYshape_p
 Shapes for Xdata and Ydata.
Vector< IPositionXshape_p
Vector< Stringcolnames_p
 accessed column names
Vector< Sliceripslice_p
 accessed column slices
Int nip_p
 number of pairs of colnames and indices.
Vector< IntIndCnt_p
 mapping from yplotdata index to colnames_p indices.
ArrayColumn< BoolFlags_p
 Flag holders..\.
ScalarColumn< BoolRowFlags_p
String FlagColName_p
String FlagRowName_p
IPosition FlagColShape_p
Bool fcol_p
 flags of FLAG,FLAG_ROW existence.
Bool frcol_p
Vector< Vector< Double > > locflagmarks_p
 list of flag regions ( or locate regions )
Int nflagmarks_p
 # flag regions
Int flagdirection_p
 1 : FLAG, 0 : UNFLAG
Int numflagpoints_p
 number of selected points.
Bool showflags_p
 Plot Options that need to be used here.
Bool doscalingcorrection_p
String multicolour_p
TPConvertBaseconv_p
 Pointer to the Convert function.
FlagVersionFV
 Dear ol' FlagVersion pointer.
String currentflagversion_p
Int dbg
Int ddbg
Int adbg
Timer tmr
Int pType_p
SLoglog

Static Protected Attributes

static String clname

Detailed Description

Definition at line 137 of file BasePlot.h.


Constructor & Destructor Documentation

casa::BasePlot::BasePlot ( )

Constructor.

virtual casa::BasePlot::~BasePlot ( ) [virtual]

Destructor.


Member Function Documentation

void casa::BasePlot::BasePlotError ( String  msg) [protected]

Exceptions.

\.

Int casa::BasePlot::cleanUp ( ) [protected]

Clears currently held flag region lists and TaQL index lists.

Int casa::BasePlot::computeAverages ( Int  averagenrows) [protected]

Compute averages of rows.

virtual Int casa::BasePlot::computeXAverages ( Int  averagenrows,
Int  remrows 
) [protected, virtual]

Compute averages of X values.

. this is just a place-holder.

Reimplemented in casa::CrossPlot.

Int casa::BasePlot::convertCoords ( Vector< Vector< Double > > &  flagmarks)

This function is called from TPPlotter::setFlagRegions().

The list of regions that have been marked for flagging via TPPlotter::markFlags() is passed into BasePlot and stored.

Int casa::BasePlot::createMap ( ) [protected]

Create Map_p = a matrix of important indices.

nrows : NPlots_p. So each cellcol/cellrow gets its own Map_p row. ncols : 5 Col 0 : index into xplotdata Col 1 : index into yplotdata Col 2 : index into tens (z) Col 3 : yplotdata row index Col 4 : yplotdata col index

Int casa::BasePlot::createTENS ( Vector< String > &  datastr)

Create TableExprNodes for all TaQL strings.

The RecordGram::parse() function is used to create TableExprNodes for each of the TaQL strings in the input vector. The parse tree for each expression is also traversed to extract table column names and corresponding index ranges that are accessed. This is required while flagging based on the result of a TaQL expression. For instance, in a MS type table, if the 'MEAN' TaQL function is used to average data over several channels/stokes, only one set of data is plotted, but while flagging all accessed channels/stokes must be flagged. The function returns -1 if there is a TaQL syntax error, or if the data-type of the expression result is not TpDouble, or if an odd number of TaQL strings in sent in the input vector. (Only expressions that return a TpDouble scalar or array can be directly plotted).

virtual Int casa::BasePlot::createXTENS ( Vector< String > &  datastr) [protected, virtual]

Create TableExprNodes from input TAQL strings.

Reimplemented in casa::CrossPlot.

Int casa::BasePlot::createYTENS ( Vector< String > &  datastr) [protected]
Int casa::BasePlot::flagData ( Int  diskwrite,
Int  rowflag,
Int  direction 
)

Fill in flags in the storage arrays.

The data storage arrays are traversed and flags for all data values falling within the chosen flag regions are set to true. If diskwrite=1, updated flags are written to disk. If diskwrite=0, the flags are not written to disk, but will be applied to plots that use the current instance of BasePlot. If rowflag=1, a the FLAG_ROW column is set (if it exists) in addition to the individual flags in the FLAG column (if it exists).

Int casa::BasePlot::flagData ( Int  direction,
String  msname,
String  ext 
)
Int casa::BasePlot::flagData ( Int  direction,
String  msname,
String  spwexpr,
Matrix< Int > &  rowMap,
Matrix< Int > &  chanMap,
String  ext 
)
Clear all casa::BasePlot::flags ( FLAG and  FLAG_ROW)
Vector<String> casa::BasePlot::getBasePlotInfo ( )

Get some Table Info.

virtual Int casa::BasePlot::getColourAddOn ( Int  pnum) [virtual]

Get the plot colour to use - based on "multicolour" This number is added to the "color" in PlotOption, to generate the different colours for different cellrows/cellcols.

Int casa::BasePlot::getData ( Vector< String > &  datastr,
Int  layer,
TPConvertBase conv,
TPGuiCallBackHooks callbackhooks_p 
)

Read data from the table and fill up storage arrays.

This function reads the results of all TableExprNodes from the first row of the table/subtable, to obtain the shapes of the TaQL results. Data storage arrays are accordingly resized and the reading continues for all other rows. Flags are read using the getFlags function. If the shape of the data column being accessed matches that of the FLAG column, a one-to-one mapping of flags is done. If the shapes mis-match (or if only one flag exists per row), then the FLAG_ROW column is read. If neither FLAG nor FLAG_ROW exist, all flags are assumed as False. Errors in TaQL indices are caught and -1 is returned.

Int casa::BasePlot::getFlags ( String  versionname,
String  msname 
)
Int casa::BasePlot::getFlags ( String  versionname,
Bool  showflags 
) [protected]

Read flags from the table into theflags_p This reconciles the original indices in the FLAG column, with the indices selected via TaQL.

It also take care of getting the flags in when a TaQL Scalar or Vector reduction has been done. Also, it checks with flagsum_p, to see if anyone else has updated flags for this Table, and if so, recomputes the TaQL so that channel averages take into account updated flags. And lots more !!

Int casa::BasePlot::getIndices ( TableExprNode ten) [protected]

Get TaQL incides.

Matrix<String> casa::BasePlot::getLocateIndices ( ) [protected]

Get the chan, pol from np.

Matrix<String> casa::BasePlot::getLocateIndices ( Matrix< Int > &  cmap) [protected]
Matrix<Int> casa::BasePlot::getLocatePolChan ( ) [protected]

Get the chan, pol from np.

virtual Int casa::BasePlot::getNumPlots ( ) [virtual]

Query for the number of plots.

Reimplemented in casa::CrossPlot.

virtual Int casa::BasePlot::getNumRows ( ) [virtual]

Query for the number of points per plot.

Reimplemented in casa::CrossPlot.

Int casa::BasePlot::getPlotType ( )

Query for the type of plot (BASEPLOT) For BasePlot, this is "XYPLOT".

For CrossPlot, this is "CROSS".

String casa::BasePlot::getTableName ( )

Return the name of the Table being held by BP.

virtual Int casa::BasePlot::getXData ( TPConvertBase conv,
Bool  dummyread = False 
) [protected, virtual]

Read in the values ( after TaQL evaluations ) into the storage arrays.

Reimplemented in casa::CrossPlot.

virtual Double casa::BasePlot::getXVal ( Int  pnum,
Int  col 
) [virtual]

Query the internal structures for X data values.

Reimplemented in casa::CrossPlot.

Int casa::BasePlot::getYData ( TPConvertBase conv,
Bool  dummyread = False 
) [protected]
virtual Bool casa::BasePlot::getYFlags ( Int  pnum,
Int  col 
) [virtual]

Query the internal structures for flags.

Reimplemented in casa::CrossPlot.

virtual Double casa::BasePlot::getYVal ( Int  pnum,
Int  col 
) [virtual]

Query the internal structures for Y data values.

Reimplemented in casa::CrossPlot.

Int casa::BasePlot::init ( Table tab,
Int tableNumber,
String rootTabName,
String tableSelection,
String dataFlagColName,
String rowFlagColName 
)

Attach the BasePlot object to a table/subtable.

This function also checks if the FLAG and/or FLAG_ROW column names exist.

virtual Int casa::BasePlot::locateData ( Vector< String collist,
Matrix< Double > &  info,
Vector< String > &  cpol 
) [virtual]

Locate Data Step through the data, check if each point has been selected.

If it has, then read out the row number, and index into the Table and pull out the values of each of the LocateColumns for each selected row number. Channel/Corr (cellcol/cellrow) indices are also found, and concatenated into a [row,col] string to be returned for printing.

virtual Int casa::BasePlot::locateData ( Vector< String collist,
Matrix< Double > &  info,
Vector< String > &  cpol,
Matrix< Int > &  rmap,
Matrix< Int > &  cmap 
) [virtual]

Make this different from the above just in case somebody else also use this function make TablePlot to know which one to call.

BasePlot& casa::BasePlot::operator= ( const BasePlot ) [inline]

Operator= Equate by reference.

Definition at line 148 of file BasePlot.h.

void casa::BasePlot::ptTraverse ( const TableExprNodeRep tenr) [protected]

Traverse the TaQL parse tree and collect TaQL index ranges.

Int casa::BasePlot::reGetYData ( Int  tenid,
Int  row,
TPConvertBase conv 
) [protected]

Recompute TaQLs in case another BP has changed the flags for this row.

Bool casa::BasePlot::saveData ( const String filename)
virtual Bool casa::BasePlot::selectedPoint ( Int  np,
Int  nr 
) [virtual]

Reimplemented in casa::CrossPlot.

Int casa::BasePlot::setFlags ( Int  direction,
Int  setrowflag,
String  msname 
)
Int casa::BasePlot::setFlags ( Int  direction,
Int  setrowflag 
) [protected]

Write flags to disk.

This does the inverse of getFlags. Flag expansion for TaQL scalar/vector reduction happens here.

virtual Int casa::BasePlot::setPlotRange ( Double xmin,
Double xmax,
Double ymin,
Double ymax,
Bool  showflags,
Bool  columnsxaxis,
String  flagversion,
Int  averagenrows,
String  connectpoints = String("tablerow"),
Bool  doscalingcorrection = True,
String  multicolour = String("none"),
Bool  honourxflags = False 
) [virtual]

This function is callse from TPPlotter::setPlotRange().

Set plot range (all plots for this table). Scan the data storage arrays to compute data ranges. In the case of overlay plots (due to Array TpDouble TaQL results), combined data ranges for this tables data are computed. This function requires that all stored data arrays be traversed. This can get expensive for large number of data points. It is assumed that for such a large number of data points, plotting could broken down into chunks using an iteration axis.

Reimplemented in casa::CrossPlot.

void casa::BasePlot::showFlags ( )
Int casa::BasePlot::updateFlagHistory ( Vector< Vector< Double > > &  flagmarks,
Int direction,
Int numflags 
)

Update Flag History Fill in these parameters with a list of flag regions, flag or unflag, and the number of points selected in these regions.


Member Data Documentation

Definition at line 522 of file BasePlot.h.

Flag to signal the use of averages or not.

This is for "averagenrows" and averaging across rows. If True, then points are averaged, before being sent to TPLP.

Definition at line 394 of file BasePlot.h.

If averaging is done across rows, the averaged values are stored in these variables.

This is in addition to "xplotdata_p, etc.. " Since this is filled on the fly, one can generate plots with different 'averagenrows', without having to re-read data from disk.

Definition at line 432 of file BasePlot.h.

Definition at line 439 of file BasePlot.h.

Definition at line 433 of file BasePlot.h.

Definition at line 438 of file BasePlot.h.

Definition at line 437 of file BasePlot.h.

Definition at line 435 of file BasePlot.h.

Definition at line 436 of file BasePlot.h.

A pointer to the CallBack class.

One of them is held for each BP.

Definition at line 296 of file BasePlot.h.

String casa::BasePlot::clname [static, protected]

Reimplemented in casa::CrossPlot.

Definition at line 528 of file BasePlot.h.

accessed column names

Definition at line 485 of file BasePlot.h.

Pointer to the Convert function.

Definition at line 516 of file BasePlot.h.

Definition at line 520 of file BasePlot.h.

List of TaQL strings.

Definition at line 384 of file BasePlot.h.

Int casa::BasePlot::dbg [protected]

Definition at line 522 of file BasePlot.h.

Definition at line 522 of file BasePlot.h.

Definition at line 512 of file BasePlot.h.

flags of FLAG,FLAG_ROW existence.

Definition at line 499 of file BasePlot.h.

Flag to distinguish between loading flagsum_p for the first time, and using it to check for "changed" rows.

Definition at line 424 of file BasePlot.h.

Definition at line 496 of file BasePlot.h.

Definition at line 497 of file BasePlot.h.

1 : FLAG, 0 : UNFLAG

Definition at line 506 of file BasePlot.h.

Definition at line 496 of file BasePlot.h.

Flag holders..\.

Definition at line 494 of file BasePlot.h.

Vector to hold the number of flagged cell rows/cols per row.

For an MS, this is the number of corrs/chans flagged per row. This is used to check when another BasePlot has changed the flags. ( remember - multiple BPs can work on the same Table at once...) and this ensures that channel averages are recomputed for rows for which the flags have changed. This is how flags changed through one plot, are immediately updated in all other plots from the same Table.

Definition at line 420 of file BasePlot.h.

Definition at line 499 of file BasePlot.h.

Dear ol' FlagVersion pointer.

Definition at line 519 of file BasePlot.h.

mapping from yplotdata index to colnames_p indices.

Definition at line 491 of file BasePlot.h.

accessed column slices

Definition at line 487 of file BasePlot.h.

Signal for each TaQL using an ArrayCol or ScalarCol.

Definition at line 478 of file BasePlot.h.

Definition at line 371 of file BasePlot.h.

Definition at line 372 of file BasePlot.h.

Remember the "layer" of the plot from this basePlot.

This is used to discard "getData" calls for other layers.

Definition at line 389 of file BasePlot.h.

list of flag regions ( or locate regions )

Definition at line 502 of file BasePlot.h.

SLog* casa::BasePlot::log [protected]

Definition at line 527 of file BasePlot.h.

a VERY important data structure that holds very useful index information.

This is used all over the place. A description of this Matrix is in the code of BasePlot::createMap().

Definition at line 455 of file BasePlot.h.

Definition at line 513 of file BasePlot.h.

Number of rows left after averaging across rows ( averagenrows )

Definition at line 449 of file BasePlot.h.

# flag regions

Definition at line 504 of file BasePlot.h.

number of pairs of colnames and indices.

Definition at line 489 of file BasePlot.h.

Number of plots sum (ncellrows x ncellcols from each TaQL XY pair ) TPLP sees this number, and asks for data to create this number of plots.

Definition at line 445 of file BasePlot.h.

Number of rows in the BP's Table.

Definition at line 292 of file BasePlot.h.

number of TaQL string pairs.

Definition at line 397 of file BasePlot.h.

number of selected points.

Definition at line 508 of file BasePlot.h.

Definition at line 525 of file BasePlot.h.

List of reduction-types for each Y-TaQL.

0 : no reduction 1 : scalar reduction (SUM(..)) 2 : vector reduction (SUM(..,1)) 3 : vector reduction (SUM(..,2))

Definition at line 475 of file BasePlot.h.

The name of the root Table on disk.

If a memory Table, this should be "".

Definition at line 379 of file BasePlot.h.

Vector to hold the row flags.

Definition at line 410 of file BasePlot.h.

Definition at line 495 of file BasePlot.h.

The single Table to be accessed.

Definition at line 369 of file BasePlot.h.

Plot Options that need to be used here.

Definition at line 511 of file BasePlot.h.

Flag to signal a new table being attached.

Definition at line 386 of file BasePlot.h.

The internal number assigned to the table by TablePlot.

Definition at line 376 of file BasePlot.h.

A string with selection information.

Definition at line 381 of file BasePlot.h.

The Column shapes for columns accessed by each Y-TaQL.

This is used to decide if a scalar/vector TaQL reduction has happened or not. This info goes into ReductionType_p

Definition at line 463 of file BasePlot.h.

Holds info about which cellrows/cellcols are completely flagged per row.

This is for use in averaging channel numbers -- not really used.

Definition at line 468 of file BasePlot.h.

The first TaQL indices for each Y-TaQL.

Definition at line 458 of file BasePlot.h.

Matrix to hold the data flags.

Definition at line 408 of file BasePlot.h.

Definition at line 523 of file BasePlot.h.

Matrices to hold the actual data to be plotted.

i.e. the values obtained after TaQL evaluation.

Definition at line 404 of file BasePlot.h.

Definition at line 482 of file BasePlot.h.

TableExprnodes created from these TaQL string pairs.

Definition at line 399 of file BasePlot.h.

Definition at line 405 of file BasePlot.h.

Shapes for Xdata and Ydata.

Definition at line 481 of file BasePlot.h.

Definition at line 400 of file BasePlot.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines