casa  $Rev:20696$
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
casa::TablePlot Class Reference

#include <TablePlot.h>

List of all members.

Public Member Functions

Bool setTableT (Vector< Table > &inTabObj, Vector< String > &rootTabNames, Vector< String > &selection)
 Set a list of Table objects that are to be used for subsequent plotting.
Bool setTableS (Vector< String > &inTabName, Vector< String > &rootTabNames, Vector< String > &selection)
 Set a list of Tables by specifying their names.
Bool useFlagColumns (String dataflags=String("FLAG"), String rowflags=String("FLAG_ROW"))
 Set names of Table columns to be used for Flags.
Bool isTableSet ()
 Check if at least one Table has been set.
Bool setGui (Bool guiVisible=True)
 Choose between a GUI-based or completely command-line based interface.
Bool saveFigure (const String &filename, const Int dpi, const String &orientation, const String &papertype, const String &facecolor, const String &edgecolor)
 Save the plot to an image file, using the pl.savefig command.
Bool saveData (const String &filename)
Vector< StringcheckInputs (PlotOptions &pop, Vector< Vector< String > > &datastrvector, Vector< String > &iteraxes)
 Validation check for input parameters.
Vector< StringcheckInputs (PlotOptions &pop, Vector< String > &datastr, Vector< String > &iteraxes)
Vector< StringcheckTables (Vector< Table > &tables)
 Check that the "FLAG(dataFlagColName_p)" ArrayColumn in input Tables have the same shape across all rows.
Bool checkShapes (Table &intab)
Bool plotData (PlotOptions &pop, Vector< Vector< String > > &datastrvector)
 Plot data based on input plot options and [X,Y] TaQL string pairs.
Bool plotData (PlotOptions &pop, Vector< String > &datastr)
 Plot data based on input plot options and [X,Y] TaQL string pairs.
Bool rePlot ()
 Refresh the plot.
Bool markRegions (Int nrows, Int ncols, Int panel, Vector< Double > &region)
 Mark regions to flag.
Bool flagData (Int direction)
 Flag all data in regions marked using markFlags().
Bool flagData (Int direction, Vector< Int > regs)
Bool locateData (Vector< String > columnlist, PtrBlock< Record * > &INFO, Int doFlag=-1)
 Print out information about the data selected using markFlags() It takes in a list of table column names to make lists for.
Bool locateData (Int doFlag=-1)
Bool clearAllFlags (Bool forRootTable)
 Clear all flags from all the tables attached to the vector of BasePlots Dangerous.
Bool saveFlagVersion (String versionname, String comment, String merge)
 FlagVersion control functions.
Bool restoreFlagVersion (Vector< String > versionname, String merge)
Bool deleteFlagVersion (Vector< String > versionname)
Bool getFlagVersionList (Vector< String > &verlist)
Bool clearPlot (Int nrows=0, Int ncols=0, Int panel=0)
 Clear on or all plot panels.
Bool iterMultiPlotStart (PlotOptions &pop, Vector< Vector< String > > &datastrvector, Vector< String > &iteraxes)
 Plotting from a series of subtables created by iterating over a specified iteration axis.
Bool iterMultiPlotStart (PlotOptions &pop, Vector< String > &datastr, Vector< String > &iteraxes)
Int iterMultiPlotNext (Vector< String > &labelcols, Vector< Vector< Double > > &labelvals)
 Advances to the next iteration.
Int iterMultiPlotStop (Bool)
 Terminates the iterations.
Bool iterMultiPlotStop ()
Bool getTabVec (Vector< Table > &tabs)
 Get the current list of Tables from TablePlot.
Bool runPlotCommand (String command)
 Allow the user app to directly run a python command.
Bool changeGuiButtonState (String button, String state)
 Change the state of a button on the Gui.
Bool resetTP (Int closewindow=1)
 Clean up the TablePlot object.
Bool setResetCallBack (String appname, TPResetCallBack *resetter)
 Set the "reset" callback function.
Bool clearResetCallBack (String appname)

Static Public Member Functions

static TablePlotTablePlotInstance ()
 Get a reference to an instance of the TablePlot class.

Private Member Functions

 TablePlot ()
 Default Constructor.
 TablePlot (TablePlot const &)
 Copy Constructor (reference semantics)
TablePlotoperator= (TablePlot const &)
 reference =
 ~TablePlot ()
 Destructor.
Bool createBP (PtrBlock< BasePlot * > &BPS, Vector< Vector< String > > &taqls)
 Instantiate a BasePlot/CrossPlot object for each table.
Bool upDateBP (PtrBlock< BasePlot * > &BPS)
 Attach each table in the list to a BasePlot object.
Bool clearOverLaps (Int nrows, Int ncols, Int panel)
 Clear panels that lie partially or completely underneath the plot currently being plotted.
Int getPanelIndex (Int nrows, Int ncols, Int panel)
 Helper function to get the panel index for a particular panel.
Bool setupTP ()
 TP cleanup + initialization.
Bool deleteBasePlot (Int panel, Int layer)
 Destroy a BasePlot, and trigger the "releasetable" callback function so that user apps know when to delete/close their tables.
Bool plotData (PlotOptions &pop, Vector< Vector< String > > &datastrvector, const String iterstate)
 Same as plotdata described above.
Bool plotData (PlotOptions &pop, Vector< String > &datastr, const String iterstate)
Bool updateFlagHistory (PtrBlock< Record * > &flaghist)
 Read out Flagging information from BasePlots.
Bool dumpFlagHistory (PtrBlock< Record * > &flaghist)
 Print out (formatted) info about the flag history.
Bool dumpLocateInfo (PtrBlock< Record * > &INFO, Int flagdata=-1, Bool ave=0)
 Print out (formatted) info about the data points selected during a locate operation.
void TablePlotError (String msg)
 Generate an exception.

Private Attributes

Int nTabs_p
 Private class variables.
Vector< TableTABS_p
 vector of currently set Tables
Vector< StringrootTabNames_p
 root Table names per Table.
Vector< StringtableSelections_p
 Strings with selection info oer Table.
String dataFlagColName_p
 "FLAG"
String rowFlagColName_p
 "FLAG_ROW"
TPPlotterTPLP
 Plotter class.
PtrBlock< PtrBlock< BasePlot * > * > ATBPS
 Holds all active BasePlots.
Vector< TableIteratorIters_p
 Holds tableiters for each Table.
PtrBlock< PanelParams * > PAN
 List of parameters per panel.
PtrBlock< TPResetCallBack * > resetters_p
 resetTP callback pointer.
Vector< Stringappnames_p
 resetTP callback user-app name
Vector< StringDataStr_p
 Input TaqlStrings.
Vector< StringIterAxes_p
 Input iteration axes strings.
Int NRows_p
 Panel co-ordinates of the latest panel.
Int NCols_p
PlotOptions Pop_p
 Temporary instance of Plot options.
PtrBlock< PlotOptions * > Pops_p
 Variables for iteration plots.
PtrBlock< Vector< Vector
< String > > * > 
TaqlStr_p
PtrBlock< Vector
< TableIterator > * > 
OvpIters_p
PtrBlock< Vector< String > * > OvpRootTabNames_p
PtrBlock< Vector< String > * > OvpTabSelections_p
Vector< StringTitleStrings_p
String Separate_p
Int CurrentPanel_p
 Current panel number.
Int TableTouch_p
 Flag to signal that setTableT has been called and that BasePlots needs to be created/updated with the new Tables.
Bool IterPlotOn_p
 Flags to signal iterplot mode.
Bool IterPlotStarted_p
Bool isPlotDisplayed_p
 Flag to check if there is a currently displayed plot or not.
Bool isGuiVisible_p
 Flag to indicate if Plot window is currently displayed.
Timer tmr
 Debug message flags.
SLoglog
 Logger instance.

Static Private Attributes

static String clname

Detailed Description

Definition at line 178 of file TablePlot.h.


Constructor & Destructor Documentation

casa::TablePlot::TablePlot ( ) [private]

Default Constructor.

Referenced by TablePlotInstance().

casa::TablePlot::TablePlot ( TablePlot const &  ) [private]

Copy Constructor (reference semantics)

casa::TablePlot::~TablePlot ( ) [private]

Destructor.


Member Function Documentation

Bool casa::TablePlot::changeGuiButtonState ( String  button,
String  state 
)

Change the state of a button on the Gui.

button : 'iternext','markregion','flag','unflag','locate' state : 'enabled','disabled' defaults -> iternext=disabled, all others are enabled.

Referenced by casa::TPGuiBinder::iterplotnext().

Vector<String> casa::TablePlot::checkInputs ( PlotOptions pop,
Vector< Vector< String > > &  datastrvector,
Vector< String > &  iteraxes 
)

Validation check for input parameters.

This function returns errors and warnings, based on the validity of the input parameters. The returned vector<string> is of length 2. The first String is Errors and the second is Warnings. User applications should not proceed to TablePlot::plotData if checkInputs fails with errors. TablePlot::plotData re-verifies inputs by calling this function internally as well.

Vector<String> casa::TablePlot::checkInputs ( PlotOptions pop,
Vector< String > &  datastr,
Vector< String > &  iteraxes 
)
Bool casa::TablePlot::checkShapes ( Table intab)
Vector<String> casa::TablePlot::checkTables ( Vector< Table > &  tables)

Check that the "FLAG(dataFlagColName_p)" ArrayColumn in input Tables have the same shape across all rows.

Bool casa::TablePlot::clearAllFlags ( Bool  forRootTable)

Clear all flags from all the tables attached to the vector of BasePlots Dangerous.

Please use this carefully. It was put in mainly for debugging purposes.

Bool casa::TablePlot::clearOverLaps ( Int  nrows,
Int  ncols,
Int  panel 
) [private]

Clear panels that lie partially or completely underneath the plot currently being plotted.

This is to mimic the behaviour of native matplotlib, and to ensure automatic cleanup of plots and associated data structures, when they are no longer needed.

Bool casa::TablePlot::clearPlot ( Int  nrows = 0,
Int  ncols = 0,
Int  panel = 0 
)

Clear on or all plot panels.

Specify the co-ordinates of the panels to clear. Setting all parameters to 0, indicates "clear all plots". BasePlot objects are destroyed in this call, and this triggers the "releaseTable" call-back for user-applications.

Referenced by casa::TPGuiBinder::clearplot().

Bool casa::TablePlot::clearResetCallBack ( String  appname)
Bool casa::TablePlot::createBP ( PtrBlock< BasePlot * > &  BPS,
Vector< Vector< String > > &  taqls 
) [private]

Instantiate a BasePlot/CrossPlot object for each table.

To be used in conjunction with upDateBP(). The second argument should contain 'CROSS' for a CrossPlot object to be instantiated. Otherwise (or left as default), BasePlot objects will be created. One way to use this is to have the incoming TAQL pair have its 'X' TaQL contain 'CROSS', since for CrossPlots, the x-axis corresponds to column indices of the array column selected by the Y-TaQL.

Bool casa::TablePlot::deleteBasePlot ( Int  panel,
Int  layer 
) [private]

Destroy a BasePlot, and trigger the "releasetable" callback function so that user apps know when to delete/close their tables.

Bool casa::TablePlot::deleteFlagVersion ( Vector< String versionname)
Bool casa::TablePlot::dumpFlagHistory ( PtrBlock< Record * > &  flaghist) [private]

Print out (formatted) info about the flag history.

Bool casa::TablePlot::dumpLocateInfo ( PtrBlock< Record * > &  INFO,
Int  flagdata = -1,
Bool  ave = 0 
) [private]

Print out (formatted) info about the data points selected during a locate operation.

This function triggers the call-back for "printlocater" for user apps to perform custom formatting of "locate" output.

Bool casa::TablePlot::flagData ( Int  direction)

Flag all data in regions marked using markFlags().

Direction is 1 for FLAG, and 0 for UNFLAG.

Bool casa::TablePlot::flagData ( Int  direction,
Vector< Int regs 
)
Bool casa::TablePlot::getFlagVersionList ( Vector< String > &  verlist)
Int casa::TablePlot::getPanelIndex ( Int  nrows,
Int  ncols,
Int  panel 
) [private]

Helper function to get the panel index for a particular panel.

If this panel does not exist in the list, -1 is returned.

Bool casa::TablePlot::getTabVec ( Vector< Table > &  tabs)

Get the current list of Tables from TablePlot.

Bool casa::TablePlot::isTableSet ( )

Check if at least one Table has been set.

Int casa::TablePlot::iterMultiPlotNext ( Vector< String > &  labelcols,
Vector< Vector< Double > > &  labelvals 
)

Advances to the next iteration.

BasePlot objects persist, but their attached tables are replaced by the new subtables created by TableIter.

Referenced by casa::TPGuiBinder::iterplotnext().

Bool casa::TablePlot::iterMultiPlotStart ( PlotOptions pop,
Vector< Vector< String > > &  datastrvector,
Vector< String > &  iteraxes 
)

Plotting from a series of subtables created by iterating over a specified iteration axis.

Iterations are applied to all the latest Tables set via setTableT. This mode of plotting supports multiple panels, with the panel configuration set through plotoptions : nrows,ncols. Multiple iteration plots can be setup to run as overplots (using the regular "overplot" plot option, and two successive iterMultiPlotStart calls before the first "next", as well as multipanels (see the "separateiterplot" plot option).

Bool casa::TablePlot::iterMultiPlotStart ( PlotOptions pop,
Vector< String > &  datastr,
Vector< String > &  iteraxes 
)
Int casa::TablePlot::iterMultiPlotStop ( Bool  ) [inline]

Terminates the iterations.

It is called automatically when the end of the table is reached. It can also be called before the iterations end, to cleanly terminate the iterations when desired.

Definition at line 354 of file TablePlot.h.

References iterMultiPlotStop().

Referenced by casa::TPGuiBinder::iterplotstop().

Bool casa::TablePlot::iterMultiPlotStop ( )

Referenced by iterMultiPlotStop().

Bool casa::TablePlot::locateData ( Vector< String columnlist,
PtrBlock< Record * > &  INFO,
Int  doFlag = -1 
)

Print out information about the data selected using markFlags() It takes in a list of table column names to make lists for.

INFO is a structure containing all the locate information. This function automatically prints out INFO, and provides a callback for custom formatting as well, but this structure is still accessible here. INFO needs to be empty before being passed in, and needs to be deleted after this call. TODO - remove INFO from here, and make it an internal parameter. Remember to declare it inside, and clean it up at the end of this function, after calling dumpLocate from inside.

Referenced by casa::TPGuiBinder::flagdata(), casa::TPGuiBinder::locatedata(), and casa::TPGuiBinder::unflagdata().

Bool casa::TablePlot::locateData ( Int  doFlag = -1)
Bool casa::TablePlot::markRegions ( Int  nrows,
Int  ncols,
Int  panel,
Vector< Double > &  region 
)

Mark regions to flag.

This function calls TPPlotter::markRegion(). These regions will apply to all layers of the chosen panel.

Referenced by casa::TPGuiBinder::markregion().

TablePlot& casa::TablePlot::operator= ( TablePlot const &  ) [private]

reference =

Bool casa::TablePlot::plotData ( PlotOptions pop,
Vector< Vector< String > > &  datastrvector 
) [inline]

Plot data based on input plot options and [X,Y] TaQL string pairs.

Plot options are to be sent in via the PlotOptions class. [X,Y] TaQL string pairs are sent in via datastrvector. datastrvector.nelements() must be the same as nTabObj.nelements(). i.e. the same number of Tables currently in use. For each Table (the inner Vector), there can be any number of XY TaQL pairs. [X1,Y1,X2,Y2,....] and plots from each pair will appear as overlaid plots on the same panel. each table has one set of taql each taql set has one or more taql pairs

Definition at line 267 of file TablePlot.h.

References String.

Referenced by plotData().

Bool casa::TablePlot::plotData ( PlotOptions pop,
Vector< String > &  datastr 
) [inline]

Plot data based on input plot options and [X,Y] TaQL string pairs.

Same as above, but uses only one [X,Y] TaQL pair for all the input Tables.

Definition at line 274 of file TablePlot.h.

References plotData(), and String.

Bool casa::TablePlot::plotData ( PlotOptions pop,
Vector< Vector< String > > &  datastrvector,
const String  iterstate 
) [private]

Same as plotdata described above.

The last parameter is for internal use, and signals whether TablePlot::plotData is being called in iteration or non-iteration mode. This information is used to decide cleanup strategy.

Bool casa::TablePlot::plotData ( PlotOptions pop,
Vector< String > &  datastr,
const String  iterstate 
) [private]
Bool casa::TablePlot::rePlot ( )

Refresh the plot.

Flags are re-read from all active Table objects, and the plots are re-made with all the current plot options for each panel and layer.

Bool casa::TablePlot::resetTP ( Int  closewindow = 1)

Clean up the TablePlot object.

Clear all plots and release all tables. This triggers the "reset call-back" for user applications. Note : It is dangerous to call this with closewindow=0. Extra rows of buttons might appear TODO - do something about this.

Referenced by casa::TPGuiBinder::quit().

Bool casa::TablePlot::restoreFlagVersion ( Vector< String versionname,
String  merge 
)
Bool casa::TablePlot::runPlotCommand ( String  command)

Allow the user app to directly run a python command.

Bool casa::TablePlot::saveData ( const String filename)
Bool casa::TablePlot::saveFigure ( const String filename,
const Int  dpi,
const String orientation,
const String papertype,
const String facecolor,
const String edgecolor 
)

Save the plot to an image file, using the pl.savefig command.

Bool casa::TablePlot::saveFlagVersion ( String  versionname,
String  comment,
String  merge 
)

FlagVersion control functions.

They apply to all currently set Tables. i.e. all Tables set by the previous TablePlot::setTableT call. When multiple version names are supplied as a vector, the operation is applied to each of them in turn.

Bool casa::TablePlot::setGui ( Bool  guiVisible = True)

Choose between a GUI-based or completely command-line based interface.

This function will reset TablePlot, and instantiate the plotter class in no-gui mode. Default is gui=True. Note : This function has not been tested since the latest refactoring.

Bool casa::TablePlot::setResetCallBack ( String  appname,
TPResetCallBack resetter 
)

Set the "reset" callback function.

This callback is triggered when TablePlot::resetTP() is called.

Bool casa::TablePlot::setTableS ( Vector< String > &  inTabName,
Vector< String > &  rootTabNames,
Vector< String > &  selection 
)

Set a list of Tables by specifying their names.

This is similar to TablePlot::setTableT(), but explicitly opens the Tables with the Table::Update mode, and no explicit lock acquisition.

Bool casa::TablePlot::setTableT ( Vector< Table > &  inTabObj,
Vector< String > &  rootTabNames,
Vector< String > &  selection 
)

Set a list of Table objects that are to be used for subsequent plotting.

These Tables are sent into BasePlot objects, which hold onto them. Tables are released in TablePlot::clearPlot, and a callback (defined in TPCallBackHooks.h) signals this to the user application. The Table objects passed in can be from Tables on disk, reference Tables obtained via sub-selection, or in-memory Tables. The root Table names are used for handling Flag Versions. To disable flag versions, the rootTable names can be empty strings. The selection strings are purely for labelling purposes, and will appear in the Locate and FlagHistory logger output. ArrayColumns in the Tables sent in, need to have the same shape across all rows in the Table. For MSs with varying shape columns, the Tables should be broken up and sent in as a vector

Bool casa::TablePlot::setupTP ( ) [private]

TP cleanup + initialization.

void casa::TablePlot::TablePlotError ( String  msg) [private]

Generate an exception.

static TablePlot* casa::TablePlot::TablePlotInstance ( ) [inline, static]

Get a reference to an instance of the TablePlot class.

TablePlot is a Singleton class, and user applications can obtain a reference to the single instance via this function. The first call instantiates the class, and subsequent calls return pointers to the TablePlot object.

Definition at line 186 of file TablePlot.h.

References casa::tableplot, and TablePlot().

Bool casa::TablePlot::upDateBP ( PtrBlock< BasePlot * > &  BPS) [private]

Attach each table in the list to a BasePlot object.

The first time this function is called, it must be preceded by createBP(). Successive calls to this function only change the tables/subtables being accessed. This feature is used while iterating over an iteration axis - subtables created in each iteration are assigned to a fixed vector of BasePlot objects.

Bool casa::TablePlot::updateFlagHistory ( PtrBlock< Record * > &  flaghist) [private]

Read out Flagging information from BasePlots.

This is to be called soon after a TablePlot::MarkRegions and TablePlot::flagData sequence. "flaghist" contains information about the table and plot, the regions marked, and the number of points selected for flagging/unflagging.

Bool casa::TablePlot::useFlagColumns ( String  dataflags = String("FLAG"),
String  rowflags = String("FLAG_ROW") 
)

Set names of Table columns to be used for Flags.

"dataflags" must be the name of an ArrayColumn<bool> "rowflags" must be the name of a ScalarColumn<bool> These are also the columns that will be used for Flag Versions.


Member Data Documentation

resetTP callback user-app name

Definition at line 489 of file TablePlot.h.

Holds all active BasePlots.

Definition at line 479 of file TablePlot.h.

String casa::TablePlot::clname [static, private]

Definition at line 530 of file TablePlot.h.

Current panel number.

Definition at line 513 of file TablePlot.h.

"FLAG"

Definition at line 472 of file TablePlot.h.

Input TaqlStrings.

Definition at line 492 of file TablePlot.h.

Flag to indicate if Plot window is currently displayed.

Definition at line 523 of file TablePlot.h.

Flag to check if there is a currently displayed plot or not.

Definition at line 521 of file TablePlot.h.

Input iteration axes strings.

Definition at line 494 of file TablePlot.h.

Flags to signal iterplot mode.

Definition at line 518 of file TablePlot.h.

Definition at line 519 of file TablePlot.h.

Holds tableiters for each Table.

Definition at line 481 of file TablePlot.h.

Logger instance.

Definition at line 529 of file TablePlot.h.

Definition at line 497 of file TablePlot.h.

Panel co-ordinates of the latest panel.

Definition at line 497 of file TablePlot.h.

Private class variables.

number of currently set Tables

Definition at line 464 of file TablePlot.h.

Definition at line 506 of file TablePlot.h.

Definition at line 507 of file TablePlot.h.

Definition at line 508 of file TablePlot.h.

List of parameters per panel.

Definition at line 484 of file TablePlot.h.

Temporary instance of Plot options.

Definition at line 499 of file TablePlot.h.

Variables for iteration plots.

Overplots and parallel iterations are controlled via these variables.

Definition at line 504 of file TablePlot.h.

resetTP callback pointer.

Definition at line 487 of file TablePlot.h.

root Table names per Table.

Definition at line 468 of file TablePlot.h.

"FLAG_ROW"

Definition at line 474 of file TablePlot.h.

Definition at line 510 of file TablePlot.h.

Strings with selection info oer Table.

Definition at line 470 of file TablePlot.h.

Flag to signal that setTableT has been called and that BasePlots needs to be created/updated with the new Tables.

Definition at line 516 of file TablePlot.h.

vector of currently set Tables

Definition at line 466 of file TablePlot.h.

Definition at line 505 of file TablePlot.h.

Definition at line 509 of file TablePlot.h.

Debug message flags.

Definition at line 526 of file TablePlot.h.

Plotter class.

Definition at line 477 of file TablePlot.h.


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