casa
$Rev:20696$
|
#include <TablePlot.h>
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< String > | checkInputs (PlotOptions &pop, Vector< Vector< String > > &datastrvector, Vector< String > &iteraxes) |
Validation check for input parameters. | |
Vector< String > | checkInputs (PlotOptions &pop, Vector< String > &datastr, Vector< String > &iteraxes) |
Vector< String > | checkTables (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 > ®ion) |
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 TablePlot * | TablePlotInstance () |
Get a reference to an instance of the TablePlot class. | |
Private Member Functions | |
TablePlot () | |
Default Constructor. | |
TablePlot (TablePlot const &) | |
Copy Constructor (reference semantics) | |
TablePlot & | operator= (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< Table > | TABS_p |
vector of currently set Tables | |
Vector< String > | rootTabNames_p |
root Table names per Table. | |
Vector< String > | tableSelections_p |
Strings with selection info oer Table. | |
String | dataFlagColName_p |
"FLAG" | |
String | rowFlagColName_p |
"FLAG_ROW" | |
TPPlotter * | TPLP |
Plotter class. | |
PtrBlock< PtrBlock< BasePlot * > * > | ATBPS |
Holds all active BasePlots. | |
Vector< TableIterator > | Iters_p |
Holds tableiters for each Table. | |
PtrBlock< PanelParams * > | PAN |
List of parameters per panel. | |
PtrBlock< TPResetCallBack * > | resetters_p |
resetTP callback pointer. | |
Vector< String > | appnames_p |
resetTP callback user-app name | |
Vector< String > | DataStr_p |
Input TaqlStrings. | |
Vector< String > | IterAxes_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< String > | TitleStrings_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. | |
SLog * | log |
Logger instance. | |
Static Private Attributes | |
static String | clname |
Definition at line 178 of file TablePlot.h.
casa::TablePlot::TablePlot | ( | ) | [private] |
Default Constructor.
Referenced by TablePlotInstance().
casa::TablePlot::TablePlot | ( | TablePlot const & | ) | [private] |
Copy Constructor (reference semantics)
casa::TablePlot::~TablePlot | ( | ) | [private] |
Destructor.
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 | ||
) |
Check that the "FLAG(dataFlagColName_p)" ArrayColumn in input Tables have the same shape across all rows.
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.
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.
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::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.
Destroy a BasePlot, and trigger the "releasetable" callback function so that user apps know when to delete/close their tables.
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.
Flag all data in regions marked using markFlags().
Direction is 1 for FLAG, and 0 for UNFLAG.
Helper function to get the panel index for a particular panel.
If this panel does not exist in the list, -1 is returned.
Get the current list of Tables from TablePlot.
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 | ||
) |
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().
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().
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.
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().
Allow the user app to directly run a python command.
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.
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.
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().
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.
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.
Vector<String> casa::TablePlot::appnames_p [private] |
resetTP callback user-app name
Definition at line 489 of file TablePlot.h.
PtrBlock<PtrBlock<BasePlot* >*> casa::TablePlot::ATBPS [private] |
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.
Int casa::TablePlot::CurrentPanel_p [private] |
Current panel number.
Definition at line 513 of file TablePlot.h.
String casa::TablePlot::dataFlagColName_p [private] |
"FLAG"
Definition at line 472 of file TablePlot.h.
Vector<String> casa::TablePlot::DataStr_p [private] |
Input TaqlStrings.
Definition at line 492 of file TablePlot.h.
Bool casa::TablePlot::isGuiVisible_p [private] |
Flag to indicate if Plot window is currently displayed.
Definition at line 523 of file TablePlot.h.
Bool casa::TablePlot::isPlotDisplayed_p [private] |
Flag to check if there is a currently displayed plot or not.
Definition at line 521 of file TablePlot.h.
Vector<String> casa::TablePlot::IterAxes_p [private] |
Input iteration axes strings.
Definition at line 494 of file TablePlot.h.
Bool casa::TablePlot::IterPlotOn_p [private] |
Flags to signal iterplot mode.
Definition at line 518 of file TablePlot.h.
Bool casa::TablePlot::IterPlotStarted_p [private] |
Definition at line 519 of file TablePlot.h.
Vector<TableIterator> casa::TablePlot::Iters_p [private] |
Holds tableiters for each Table.
Definition at line 481 of file TablePlot.h.
SLog* casa::TablePlot::log [private] |
Logger instance.
Definition at line 529 of file TablePlot.h.
Int casa::TablePlot::NCols_p [private] |
Definition at line 497 of file TablePlot.h.
Int casa::TablePlot::NRows_p [private] |
Panel co-ordinates of the latest panel.
Definition at line 497 of file TablePlot.h.
Int casa::TablePlot::nTabs_p [private] |
PtrBlock<Vector<TableIterator>* > casa::TablePlot::OvpIters_p [private] |
Definition at line 506 of file TablePlot.h.
PtrBlock<Vector<String>* > casa::TablePlot::OvpRootTabNames_p [private] |
Definition at line 507 of file TablePlot.h.
PtrBlock<Vector<String>* > casa::TablePlot::OvpTabSelections_p [private] |
Definition at line 508 of file TablePlot.h.
PtrBlock<PanelParams* > casa::TablePlot::PAN [private] |
List of parameters per panel.
Definition at line 484 of file TablePlot.h.
PlotOptions casa::TablePlot::Pop_p [private] |
Temporary instance of Plot options.
Definition at line 499 of file TablePlot.h.
PtrBlock<PlotOptions*> casa::TablePlot::Pops_p [private] |
Variables for iteration plots.
Overplots and parallel iterations are controlled via these variables.
Definition at line 504 of file TablePlot.h.
PtrBlock<TPResetCallBack *> casa::TablePlot::resetters_p [private] |
resetTP callback pointer.
Definition at line 487 of file TablePlot.h.
Vector<String> casa::TablePlot::rootTabNames_p [private] |
Definition at line 468 of file TablePlot.h.
String casa::TablePlot::rowFlagColName_p [private] |
"FLAG_ROW"
Definition at line 474 of file TablePlot.h.
String casa::TablePlot::Separate_p [private] |
Definition at line 510 of file TablePlot.h.
Vector<String> casa::TablePlot::tableSelections_p [private] |
Strings with selection info oer Table.
Definition at line 470 of file TablePlot.h.
Int casa::TablePlot::TableTouch_p [private] |
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<Table> casa::TablePlot::TABS_p [private] |
vector of currently set Tables
Definition at line 466 of file TablePlot.h.
PtrBlock<Vector<Vector<String> >* > casa::TablePlot::TaqlStr_p [private] |
Definition at line 505 of file TablePlot.h.
Vector<String> casa::TablePlot::TitleStrings_p [private] |
Definition at line 509 of file TablePlot.h.
Timer casa::TablePlot::tmr [private] |
Debug message flags.
Definition at line 526 of file TablePlot.h.
TPPlotter* casa::TablePlot::TPLP [private] |
Plotter class.
Definition at line 477 of file TablePlot.h.