casa
$Rev:20696$
|
00001 //# CrossPlot.h: Basic table access class for the TablePlot (tableplot) tool 00002 //# to plot across rows for an arrya-column. 00003 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2003 00004 //# Associated Universities, Inc. Washington DC, USA. 00005 //# 00006 //# This library is free software; you can redistribute it and/or modify it 00007 //# under the terms of the GNU Library General Public License as published by 00008 //# the Free Software Foundation; either version 2 of the License, or (at your 00009 //# option) any later version. 00010 //# 00011 //# This library is distributed in the hope that it will be useful, but WITHOUT 00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 //# License for more details. 00015 //# 00016 //# You should have receied a copy of the GNU Library General Public License 00017 //# along with this library; if not, write to the Free Software Foundation, 00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00019 //# 00020 //# Correspondence concerning AIPS++ should be addressed as follows: 00021 //# Internet email: aips2-request@nrao.edu. 00022 //# Postal address: AIPS++ Project Office 00023 //# National Radio Astronomy Observatory 00024 //# 520 Edgemont Road 00025 //# Charlottesville, VA 22903-2475 USA 00026 //# 00027 //# $Id$ 00028 00029 00030 #ifndef CROSSPLOT_H 00031 #define CROSSPLOT_H 00032 00033 //# Includes 00034 00035 #include <casa/aips.h> 00036 #include <casa/iostream.h> 00037 #include <casa/OS/Timer.h> 00038 00039 #include <tableplot/TablePlot/BasePlot.h> 00040 00041 namespace casa { //# NAMESPACE CASA - BEGIN 00042 00043 // <summary> 00044 // Basic table access class for the TablePlot (tableplot) tool 00045 // - derived from BasePlot. Used for plotting across rows when 00046 // a table column is an arraycolumn. 00047 // </summary> 00048 00049 // <use visibility=export> 00050 00051 // <reviewed reviewer="" date="" tests=""> 00052 // </reviewed> 00053 00054 // <prerequisite> 00055 //#! Classes or concepts you should understand before using this class. 00056 // BasePlot 00057 // </prerequisite> 00058 00059 // <etymology> 00060 // CrossPlot is a class derived from BasePlot, and allows plots in a direction 00061 // transposed to that allowed by BasePlot. 00062 // </etymology> 00063 00064 // <synopsis> 00065 // Class CrossPlot holds the same data structures as does BasePlot, but 00066 // provides a transposed view of arraycolumn data to the TPPlotter class 00067 // which queries it to accumulate data to plot. 00068 // 00069 // </synopsis> 00070 00071 // <example> 00072 // <srcblock> 00073 // // Instantiate BasePlot 00074 // CrossPlot<T> CP(); 00075 // CP.Init(Table&); 00076 // CP.CreateTENS(Vector<String> &TaQL); 00077 // CP.GetData(); 00078 // ... followed by TPPlotter 'setPlotRange' and 'plotData' calls 00079 // </srcblock> 00080 // </example> 00081 00082 // <motivation> 00083 // This class was written to allow transposed plots for array-column data, 00084 // where the 'x-axis' of the plot is by default the column index of the 00085 // arraycolumn. 00086 // For a measurement set type table, this corresponds to plotting data as 00087 // a function of spectral channel. It is derived from BasePlot because the 00088 // data read/write/storage mechanisms and data structures are identical to that 00089 // in BasePlot. The only difference is the view presented to the TPPlotter 00090 // class. The TPPlotter class does not distinguish between BasePlot and 00091 // CrossPlot. In a future version, Histogram plots will also be implemented 00092 // in this manner. 00093 // </motivation> 00094 00095 // <templating arg=T> 00096 // <li> 00097 // </templating> 00098 00099 // <thrown> 00100 // <li> 00101 // <li> 00102 // </thrown> 00103 00104 00105 // <todo asof="$DATE:$"> 00106 //# A List of bugs, limitations, extensions or planned refinements. 00107 // </todo> 00108 00109 00110 class CrossPlot : public BasePlot { 00111 public: 00112 // Constructor 00113 CrossPlot(); 00114 00115 // Destructor 00116 ~CrossPlot(); 00117 00118 // This function is called from TPPlotter::setPlotRange(). 00119 // Set plot range (all plots for this table). 00120 // Scan the data storage arrays to compute data ranges. In the case 00121 // of overlay plots (due to Array TpDouble TaQL results), combined 00122 // data ranges for this tables data are computed. 00123 // This function requires that all stored data arrays be traversed. 00124 // This can get expensive for large number of data points. It is 00125 // assumed that for such a large number of data points, plotting 00126 // could broken down into chunks using an iteration axis. 00127 Int setPlotRange(Double &xmin, Double &xmax, Double &ymin, Double &ymax, 00128 Bool showflags, Bool columnsxaxis, String flagversion, 00129 Int averagenrows, String connectpoints=String("tablerow"), 00130 Bool doscalingcorrection=True, String multicolour=String("none"), 00131 Bool honourxflags=False); 00132 00133 // Return True or False = if a point is selected 00134 Bool selectedPoint(Int np, Int nr); 00135 00136 // Create TableExprNodes from input TAQL strings. 00137 Int createXTENS(Vector<String> &datastr); 00138 00139 // Query the internal structures for X,Y data and Flag values 00140 // These functions are called by TPPlotter 00141 Double getXVal(Int pnum, Int col); 00142 Double getYVal(Int pnum, Int col); 00143 Bool getYFlags(Int pnum, Int col); 00144 Int getNumRows(); 00145 Int getNumPlots(); 00146 00147 private: 00148 00149 // Read X data from the table. For CrossPlots this corresponds 00150 // to filling the X data arrays with channel indices. 00151 // For 'tid' set to row 0, the x storage arrays are created 00152 // and filled. Subsequent calls to getXData are ineffectual, 00153 // since the accessed channel indices can be filled in after 00154 // reading only the first row of the table, 00155 // but are required to preserve the format used in BasePlot 00156 // which reads a value from each row in the table. 00157 //Int getXData(TableExprId &tid); 00158 Int getXData(TPConvertBase* conv, Bool dummyread=False); 00159 00160 // Average the channel numbers ! not really used... 00161 Int computeXAverages(Int averagenrows, Int remrows); 00162 00163 void CrossPlotError(String msg); 00164 00165 // These hold indices for cell rows, and cell cols. 00166 // i.e. enumerated values from TaQL indices. 00167 // i.e. for [1:2,4:8], 00168 // xpdrow => [0,1] 00169 // xpdcol => [3,4,5,6,7] 00170 Vector<Vector<Double> > xpdrow_p, xpdcol_p; 00171 Vector<Int> ncellrows_p,ncellcols_p; 00172 Bool columnsxaxis_p; 00173 Bool plotperrow_p; 00174 Bool honourxflags_p; 00175 00176 // Variables from Base class. 00177 using BasePlot::ReductionType_p; 00178 using BasePlot::Xshape_p; 00179 using BasePlot::Yshape_p; 00180 using BasePlot::Map_p; 00181 using BasePlot::TENslices_p; 00182 using BasePlot::TENRowColFlag_p; 00183 using BasePlot::conv_p; 00184 using BasePlot::callbackhooks_p; 00185 using BasePlot::getTableName; 00186 00187 using BasePlot::nflagmarks_p; 00188 using BasePlot::locflagmarks_p; 00189 using BasePlot::nTens_p; 00190 using BasePlot::NRows_p; 00191 using BasePlot::NPlots_p; 00192 using BasePlot::yplotdata_p; 00193 using BasePlot::theflags_p; 00194 using BasePlot::rowflags_p; 00195 using BasePlot::pType_p; 00196 00197 using BasePlot::computeAverages; 00198 using BasePlot::Average_p; 00199 using BasePlot::NAvgRows_p; 00200 using BasePlot::avgyplotdata_p; 00201 using BasePlot::avgtheflags_p; 00202 using BasePlot::avgrowflags_p; 00203 using BasePlot::avgindices_p; 00204 00205 using BasePlot::updateFlagHistory; 00206 using BasePlot::setFlags; 00207 using BasePlot::getFlags; 00208 using BasePlot::SelTab_p; 00209 using BasePlot::flagdirection_p; 00210 using BasePlot::showflags_p; 00211 using BasePlot::doscalingcorrection_p; 00212 using BasePlot::multicolour_p; 00213 using BasePlot::getColourAddOn; 00214 00215 using BasePlot::log; 00216 using BasePlot::dbg; 00217 using BasePlot::ddbg; 00218 using BasePlot::adbg; 00219 using BasePlot::tmr; 00220 00221 static String clname; 00222 }; 00223 00224 } //# NAMESPACE CASA - END 00225 00226 //#ifndef AIPS_NO_TEMPLATE_SRC 00227 //#include <tableplot/TablePlot/CrossPlot.tcc> 00228 //#endif //# AIPS_NO_TEMPLATE_SRC 00229 #endif 00230