This class does, oh a little of this and a little of that. This class understands Measurement Sets and provides support for plotting various bits of data in the measurment set.
More...
Public Member Functions |
| MsPlot () |
| Constructor; creates an MsPlot object with no Measurement Set or TablePlot object associated with it at this point.
|
| MsPlot (const String &MSPath) |
| Constructor; creates an MsPlot object with a Measurement Set associated with it.
|
| ~MsPlot () |
| Destructor, destroy the MsPlot object, destroying the TablePlot and Measurement Set object with it.
|
Bool | open (const String &MSPath, Bool doVel=False, const String &restfreq="", const String &frame="", const String &doppler="") |
| Open the Measurement Set (table) to be plotted, creating a Measurement Set object as well as as <linto class"TablePlot">TablePlot</linkto> object.
|
Bool | initialize () |
| Initialize the class variables.
|
Bool | reset (Bool resetMS) |
| Reset the MsPlot class back to its initial state.
|
Bool | done () |
| Free memory, reset defaults, and destroy the TablePlot and MeasurementSet objects.
|
Bool | setupPlotxy (const String &x, const String &y, const String &xcolumn, const String &ycolumn, const String &xvalue, const String &yvalue, Vector< String > &iteration) |
| Do all of the necessary setup required to prepare for plotting.
|
Bool | plotxy (const Bool checkOnly, const String &x, const String &y, const String &xcolumn, const String &ycolumn, const String &xvalue, const String &yvalue, Vector< String > &iteration) |
| Main plot function.
|
Bool | iterPlotNext () |
| Iteration plotting.
|
Bool | iterPlotStop (const Bool rmplotter) |
Bool | clearPlot (const Int nrows, const Int ncols, const Int panel) |
Bool | setplotoptions (Record) |
Bool | saveFigure (const String &filename, const Int dpi, const String &orientation, const String &papertype, const String &facecolor, const String &edgecolor) |
Bool | summary (Bool selected) |
Bool | setData (const String &baselineExpr, const String &fieldExpr, const String &scanExpr, const String &uvDistExpr, const String &arrayExpr, const String &feedExpr, const String &spwExpr, const String &corrExpr, const String &timeExpr) |
Bool | setFlagExtension (const String &extendcorr="", const String &extendchan="", const String &extendspw="", const String &extendant="", const String &extendtime="") |
Bool | average (const String &chanAveMode, const String &corrAveMode, const String &aveData, const String &aveMode, const String &aveChan, const String &aveTime, const Bool &aveFlag, const Bool &aveScan, const Bool &aveBl, const Bool &aveArray, const Bool &aveChanId, const Bool &aveVel) |
Bool | setSpectral (const Vector< Int > &start, const Vector< Int > &end, const Vector< Int > &step, const Bool width, const String &average, const String &frequencyExpr, const String &correlationExpr) |
| nchan: how many channels you want the selected data to be averagged to.
|
Bool | markRegion (Int nrows, Int ncols, Int panel, Vector< Double > regionvec) |
Bool | flagData (Int direction) |
Bool | locateData () |
Bool | saveFlagVersion (String versionname, String comment, String merge) |
| Functions for flag version control.
|
Bool | restoreFlagVersion (Vector< String > versionname, String merge) |
Bool | deleteFlagVersion (Vector< String > versionname) |
Bool | getFlagVersionList () |
Double | getRefFrequency (uInt spwId=0) |
| A number of methods for getting specific values for the open measurement set.
|
Double | getChanFrequency (uInt spwId=0, uInt channel=0) |
Double | getChanVelocity (uInt spwId=0, uInt fieldId=0, uInt channel=0) |
Private Member Functions |
String | defaultDataSelectString () |
String | defaultSpectralSelectString () |
void | resetDataSelection () |
void | resetTableSelection () |
Bool | makeDataSelectStr (MSSelection &MSSelecObj, const Vector< Vector< String > > &selectedCorrs, const String &selectedTimes) |
Bool | corrSelection (const String &correlation, Vector< Vector< String > > &corrNames) |
Bool | corrAndStokesParser (const String &corrExpr, Vector< Vector< String > > &names) |
Bool | validateCorrAndStokes (Vector< Vector< String > > &names) |
Bool | makeCorrIdLists (Vector< Vector< Int > > &ids) |
Bool | getChannelInfo (Matrix< Int > chanSelectList) |
Bool | setSingleChannelSet (uInt spwId, Int start, Int stop, Int step) |
String | getTimeExprStr (const String ×, const String &aveOrStep) |
String | getTimeExprStr (const String ×) |
In order to make thins faster
when we get a new Measurement
Set we store a bunch of
information in some internal
variables *void | initAllLists () |
void | getAllAntennaNames () |
void | getAllFieldNames () |
void | getAllCorrelations () |
void | getAllSpwsAndFreqs () |
void | getAllSpwChanNums () |
void | getAllScanNumbers () |
void | getAllTimes () |
Vector< String > | parsePlotRange () |
| Parse the input provided by the user for the plotrange option, if double/int values are given the values are taken as they are.
|
Vector< String > | plotrangeToDbls (Vector< String > rangeStrVec, Vector< Double > rangeVector, Vector< Bool > rangeSet) |
Vector< String > | parseStrToList (const String &inString, Vector< String > &outVector) |
| /////////////////////////////////////////////////////////////////////// Parse a string assuming to be a list of values.
|
Create the TaQL string from
the various parameters given
to plotxy *Bool | createTaQL (const String &x, const String &y, const String &xcolumn, const String &ycolumn, const String &xvalue, const String &yvalue, String &title, String &xlabel, String &ylabel) |
Bool | createSaQL (const String &x, const String &y, const String &xvalue, const String &yvalue, String &title, String &xlabel, String &ylabel) |
Vector< String > | getTaQL (const String &axisStr, const String &column, const String &value, const uInt spwId, const uInt polId, const char axis, String &label) |
Bool | checkAverageMode (String optName, String mode, String selectExpr) |
Bool | checkAverageMode (String optName, String mode) |
Bool | checkIterationAxes (const Vector< String > &iteration) |
Bool | setSingleInputTable (const Vector< String > &sortOrder, const uInt spwId, const uInt polId, const Table table, const String tableName) |
Bool | setInputTable (const String &xcolumn, const String &ycolumn) |
Bool | updatePlotOptions (const String &title, const String &xlabel, const String &ylabel, const String &xcolumn, const String &ycolumn, const String &x, const String &y) |
void | cleanupOptions () |
Bool | checkSpwShapes () |
| Bool setSpwLists( Bool checkShape );.
|
Bool | checkPolShapes () |
Vector< String > | dataTaQL (const String &column, const String &value, const uInt spwId, const uInt polId, String &label) |
| Bool setSpwChanNums();.
|
String | getIndices (const Int &startcorr, const Int &endcorr, const Int &stepcorr, const Int &startchan, const Int &endchan, const Int &stepchan, const String &column, const String &value, String &label) |
| Create the vector of XTaQL, YTaQL pairs that TablePlot likes..\.
|
Double | getMeterToKlambdaConvertValue (uInt spwIndex) |
| Find the conversion value for converting uvdists from meters to kilometers.
|
Bool | getDerivedConvertVectors () |
Bool | setupConvertFn (const String &axisStr, const Char &axis) |
Vector< Double > | msDerivedConvert (const String &convertType) |
| Conversion routines which use MSDerived to calculate the conversion values.
|
Misceleanouse methods Verify
that the class variables have
been iniiatlized If they haven
t been then initialize them
*Bool | checkInit () |
Int | checkForArrayPlot (Int subplot) |
| This is needed for flagging.
|
Bool | checkOpenMS () |
| Verify that we have openen a measurement set.
|
void | initializeLabels () |
| Initialize the plot title, x-axis label, and y-axis label to their default settings, the empty sting.
|
void | disableAllButtons () |
| Enable/Disable all buttons.
|
void | enableAllButtons () |
Private Attributes |
SLog * | log |
| Message log, used to report warning, errors, and debugging information.
|
TablePlot * | itsTablePlot |
| The table plotter, a measurement set is a table and as such can be plotted by the TablePlot class.
|
Table * | itsTable |
| The Table that is to be plotted, this may or may not be the full measurement set, depending on the values given to setdata()
|
MeasurementSet * | itsMS |
| The measurement set that that is plotted.
|
MeasurementSet | itsSelectedMS |
| The reference MS created after data selection.
|
MSSelection | itsMSSelectionObj |
MeasurementSet | itsAveragedMS |
Vector< Vector< Table > > | itsTableVectors |
| In case an extra sub-selection needs to be done to account for varying shapes in the main table (due to different spectral window shapes) store the internally sub-selected MSs.
|
Vector< Vector< String > > | itsTableVecNames |
Vector< Vector< Int > > | itsTableVecSpwIds |
Vector< Vector< Int > > | itsTableVecPolIds |
Vector< String > | itsSelectString |
| Vector<uInt> itsTableVecSpwIdNChans;.
|
String | itsDataSelectString |
Vector< Int > | itsSelectedSpwIds |
Vector< Int > | itsSpwIdNChans |
Vector< Vector< Int > > | itsSelectedCorrIds |
Vector< Int > | itsSelectedPolIds |
Vector< Int > | itsSelectedNPols |
String | itsTimeSelectString |
Int | itsTimeStep |
MsAverager * | msa |
String | itsDataColumn |
String | itsAveMode |
Vector< String > | itsAveCorr |
Int | itsAveChan |
Double | itsAveTime |
Double | itsMinTimeInterval |
Bool | itsAveFlag |
Bool | itsAveScan |
Bool | itsAveBl |
Bool | itsAveArray |
Int | nAveChan |
Int | nAvePol |
Matrix< Int > | chanList |
Matrix< Int > | aveRowMap |
Matrix< Int > | aveChanMap |
Matrix< Double > | aveTimeMap |
Bool | doAverage |
Bool | useAveChanId |
Bool | doVel |
String | itsRestFreq |
String | itsFrame |
String | itsDoppler |
String | itsExtendCorr |
String | itsExtendChan |
String | itsExtendSpw |
String | itsExtendAnt |
String | itsExtendTime |
uInt | itsMaxPolId |
| Blarg.
|
Matrix< Int > | itsBaselines |
Vector< Vector< String > > | itsCorrelationNames |
Vector< Vector< Int > > | itsCorrelationIds |
Vector< String > | itsFieldNames |
Vector< String > | itsAntennaNames |
Vector< Double > | itsRefFrequencies |
Vector< Vector< Double > > | itsChanFrequencies |
Vector< Vector< Vector< Double > > > | itsChanVelocities |
| x=spw id, y= field id, z = channel num
|
Vector< Int > | itsScanNumbers |
MVTime | itsStartTime |
MVTime | itsEndTime |
uInt | itsMaxSpwId |
Vector< Bool > | itsUsedSpws |
Array< Double > | itsPlotRange |
PlotOptions | itsPlotOptions |
| The various plot options that can be set by the user.
|
Record | itsOptionRecord |
| This record is the persistant record of parameters.
|
Vector< Vector< Vector< String > > > | itsTaqlStrings |
| Stores the TaQL string used by TablePlot to select the data to be plotted.
|
Vector< String > | itsIterationAxes |
| Store the iteration axes information.
|
Vector< Double > | itsTimeRange |
| The time range selected as a pair of double values.
|
Bool | itsIterPlotOn |
| Values to keep track of iterative plots.
|
Vector< String > | itsIterLabels |
| Bool itsIterPlot;.
|
Vector< String > | itsIterAxes |
Vector< Vector< Int > > | itsStartChan |
| Variables to keep track of the current data selection for channels and correlations.
|
Vector< Vector< Int > > | itsEndChan |
Vector< Vector< Int > > | itsStepChan |
Vector< String > | itsAverage |
String | itsStepOrSlice |
Vector< Vector< Int > > | itsStartCorr |
Vector< Vector< Int > > | itsEndCorr |
Vector< Vector< Int > > | itsStepCorr |
TPGuiCallBackHooks * | itsCallBack |
TPResetCallBack * | itsResetCallBack |
Bool | itsInitialized |
Bool | itsMsIsOpen |
Bool | itsIsNewSelection |
| Flags to decide when to send a Table into TablePlot.
|
Bool | itsIsSubTablePlot |
Bool | itsIsIterationPlot |
Bool | itsIsInIterPlot |
Bool | itsConvertClassSet |
Bool | itsSpwIterOn |
Bool | itsIsUVWPlot |
Methods used to figure out
what needs to be plotted Find
which table to give to Table | plot |
Methods used to figure out
what needs to be plotted Find
which table to give to Table
it will be one of | three: 1. The whole measurement set 2. The SubMS created with MSSelection values 3. A SubMS with channel averaging Table* getTable() |
Static Private Attributes |
static String | clname |
This class does, oh a little of this and a little of that. This class understands Measurement Sets and provides support for plotting various bits of data in the measurment set.
Intended use:
Public interface
Review Status
- Date Reviewed:
- yyyy/mm/dd
Prerequisite
Etymology
The implementation of the Measurement Set plotting facilities hence its called MS Plot.
Synopsis
This class implements the interface to the MS plotting tool. See the Measurement Set description to get a good understanding of measurement sets and the TablePlot class description for further details on plotting.
There are four basic activities that can be performed with the MS Plot tool, as follows:
-
Selecting data to be plotted,
-
Specify a number of plotting options,
-
Making a plot, and
-
(un)flagging and querying the plotted data
The data selection is done via the MSSelection class, with some additions. Although the added selections in MS plot will be in the MSSelection class in the future. The data selections made determine which data in the MeasurementSet is to be plotted. Selections can be made on the following data:
-
Spectral windows, include channels for each one
-
Correlations
-
Fields
-
Baselines
-
Scan number
-
Array identifiers
-
Time ranges
-
UV distances
See the MSSelection class for details on the syntax.
MS Plot uses all of the plotting options as defined by the PanelParam class in the TablePlot module. The plot options control the plot colours, window size, overplotting, number of plots to display, labels on the axes, and many more options. The plotrange option in MS Plot is specified as a String, rather then a list of doubles. This allows time ranges to be given in time values as well as numeric values, unlike TablePlot which allows numeric values only.
The plotting of the data is where most of the tricky bits occur in this class. A good understanding of the process is important in understanding this class. The general process is:
-
verify the plot options, setting some of the internally depending on some of choices the user has made for plotting This includes setting up a callback class or two if they are needed. The callback classes are used to allow MS Plot some control over flagging, displaying information about selected plotted points, resets, and others. See MsPlotHooks class.
-
Some of the plots require each data point to be altered, for these plots "convert" functions have been set up. These are set up at this point in the plotting process. An example of a conversion class is, the UVDist plot converts all points from m to klamba. See MsPlotConvert class.
-
Next the set of table(s) to be plotted is constructed. The table may be one of:
-
The whole measurement set, ie. main table
-
A sub table of the measurement set, such as the Antenna table
-
The main table sorted by some criteria. This step uses the MSIter class to divide and sort the main table into a number of smaller tables. This process is done if the measurment set contains spectral windows with differently shaped data, if different pieces of the data have different correlations, or if the user has selected time averaging.
Once it is determined what tables are to be used these are given to TablePlot to store and keep track of.
-
Create the Table Query expressions (TaQL) string. In MS Plot only the "select" portion of the TaQLs are constructed. The TaQL strings created can be viewed in the log messages, if the messaging level is set to INFO3. The TaQL strings are designed to do as much of the work as possible, for example the channel averaging is done through careful construction of the TaQLs. See AIPS++ note 199 for a good description of TaQL expressions.
-
Finally the data is plotted by calling the table plot (see (method="TablePlot::plotData"))plotData method for single plots or the iterMultiPlotStart
method for iterative plots. Iterative plots allow users to circulate over some data property. For example, plotting each field separately.
All flagging facilities are currently handled by the TablePlot . MS Plot just hands all information given to the table plot class, this may change in the future, for example to properly support flagging of antenna's MS Plot will need to flag all data in the main table as well as the Antenna subtable.
The current model between TablePlot and MSPlot has all of the GUI events being funnelled through TablePlot, but all of the command-line commands from the Python interpreter being funnelled through MSPlot to TablePlot. This makes the design tricky!
The approach taken has been for the command-line flow, MsPlot accesses the TablePlot through and instance of the class. For the GUI flow, MsPlot provides a set of classes which, are given to TablePlot, TablePlot then calls methods in these classes to give control to MsPlot. These classes are:
-
MsPlotReset , which handles selection of the reset button on the GUI.
-
MsPlotMainMSCallBack , which handles the next, and locate buttons when data from the main table has been plotted.
-
MsPlotAntennaCallBack , which handles the next, and locate buttons when data from the Antenna has been plotted.
-
MsPlotUVWCallBack , which handles the next, and locate buttons when data from the UVW column has been plotted.
Example
This is a simple example which plots some Measurement Set data.
MsPlot myPlotter( "/dir1/dir2/myMeasurementSet.ms" );
Record optionRec;
optionRec.define( RecordFieldId( "nrows" ), Int(2) );
optionRec.define( RecordFieldId( "ncols" ), Int(1) );
optionRec.define( RecordFieldId( "panel" ), Int(1) );
optionRec.define( RecordFieldId( "color" ), String( "green" ) );
optionRec.define( RecordFieldId( "fontsize" ), Double( 7.0 ) );
optionRec.define( RecordFieldId( "title" ), String( "My Plot" ) );
if ( ! myPloter.setplotoptions( optionRec )
cout << "An error occured when setting the plot options" << endl;
return;
if ( ! myPlotter.setData( "", "0", "", "", "", "2:10~120^3", "vectorchunk", "", "", "", "" ) )
cout << "An error occured when setting th data" << endl;
return;
if ( myPlotter.ploxy( True, "uvdist", "data", "", "", "", "AMPLITUDE", "" ) )
myPlotter.ploxy( False, "uvdist", "data", "", "", "", "AMPLITUDE", "" ) );
mp.plotter.plotxy( False, "chan_freq", "data", "", "corrected", "", "", "" );
myPlotter.clearPlot();
myPlot.reset( True );
myPlotter.open( "/dir1/dir2/myCoolMeasurmentSet.ms" );
optionRec.define( RecordFieldId( "nrows" ), Int(2) );
optionRec.define( RecordFieldId( "ncols" ), Int(3) );
optionRec.define( RecordFieldId( "panel" ), Int(1) );
optionRec.define( RecordFieldId( "fontsize" ), Double( 7.0 ) );
optionRec.define( RecordFieldId( "title" ), String( "My Plot" ) );
if ( ! myPlotter.setplotoptions( optionRec )
cout << "An error occured when setting the plot options" << endl;
return;
myPlotter.plotxy( False, "default_weight", "uvdist", "", "", "", "", "baseline" );
myPlotter.iterPlotNext();
myPlotter.iterPlotNext();
myPlotter.iterPlotStop();
myPlotter.getFlagVersionList();
myPlotter.restoreFlagVersion( "testFlags", "" );
myPlotter.plotxy( False, "hourangle", "data", "", "", "", "Phase", "" );
Vector<Double> flagRegion(4);
flagRegion[0]=3; flagRegion[1]=10; flagRegion[2]=-50; flagRegion[3]=0;
myPlotter.flagData( FLAG );
Motivation
To provide a plotting tool for Measurement Sets that is very flexible, but fairly easy to use.
Thrown Exceptions
To Do
-
Look at it making it generic for all CASA
-
Perhaps provide ways of "streaming" the error messages instead of making it all a single String.
///////////////////////////////////////////////////////////////////////////
Definition at line 312 of file MsPlot.h.