casa
$Rev:20696$
|
00001 //# LatticeCleanProgress.h: Abstract base class to monitor progress in lattice operations 00002 //# Copyright (C) 1997,1998,1999,2000 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: LatticeCleanProgress.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef LATTICES_LATTICECLEANPROGRESS_H 00029 #define LATTICES_LATTICECLEANPROGRESS_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <casa/Quanta/Quantum.h> 00034 #include <lattices/Lattices/Lattice.h> 00035 #include <lattices/Lattices/TempLattice.h> 00036 #include <casa/Arrays/IPosition.h> 00037 #include <casa/Containers/Block.h> 00038 #include <casa/Arrays/Vector.h> 00039 #include <casa/Arrays/Matrix.h> 00040 00041 namespace casa { //# NAMESPACE CASA - BEGIN 00042 00043 //# Forward Declarations 00044 template <class T> class Vector; 00045 template <class T> class Matrix; 00046 class PGPlotter; 00047 00048 // <summary> 00049 // Abstract base class to monitor progress in lattice operations 00050 // </summary> 00051 00052 // <use visibility=export> 00053 00054 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00055 // </reviewed> 00056 00057 // <synopsis> 00058 // This is an abstract base class for classes to monitor the 00059 // progress of an operation on a Lattice. The default implementation 00060 // offered by this class does nothing. 00061 // However, a derived class could show the progress using for example 00062 // a <linkto class=ProgressMeter>ProgressMeter</linkto>. A derived 00063 // class should override the virtual functions from this class. 00064 // 00065 // The user of the LatticeCleanProgress object should first call 00066 // function <src>init</src> with the total number of steps 00067 // that are to be done. Thereafter, after each step has been 00068 // executed, function <src>nstepsDone</src> should be called 00069 // after each step. Finally, function <src>done</src> should 00070 // be called. 00071 // </synopsis> 00072 00073 // <example> 00074 // <srcblock> 00075 // </srcblock> 00076 // </example> 00077 00078 // <motivation> 00079 // Since operations on Lattices can take a while, it can be useful 00080 // to show the progress. However, making module Lattices dependent on 00081 // the class ProgressMeter sounded bad. This abstract class serves 00082 // as a bridge between the Lattice module and the ProgressMeter class 00083 // (or any other class showing the progress). 00084 // </motivation> 00085 // 00086 //# <todo asof="1997/08/01"> 00087 //# <li> 00088 //# </todo> 00089 00090 00091 class LatticeCleanProgress { 00092 public: 00093 LatticeCleanProgress(PGPlotter* pgplotter=0); 00094 00095 virtual ~LatticeCleanProgress(); 00096 00097 00098 // Print and plot the information. 00099 // Currently, not all information is utilized. 00100 Bool info(const Bool lastcall, 00101 const Int iteration, 00102 const Int numberIterations, 00103 const Vector<Float>& maxima, 00104 const Block<IPosition>& posMaximum, 00105 const Float strengthOptimum, 00106 const Int optimumScale, 00107 const IPosition& positionOptimum, 00108 const Float& totalFlux, 00109 const Vector<Float>& totalFluxScale, 00110 const Bool resetBase=False); 00111 00112 protected: 00113 00114 private: 00115 00116 // initizalize the arrays and such 00117 void initialize(const uInt nScales, 00118 const Float& maxResidual, 00119 const uInt numIterations); 00120 00121 // As the iterations trickle in, we will from time to time 00122 // need to make the Matrices larger. Increase to 2*n+1 00123 void resizeDataStorage(); 00124 00125 // this will redraw the plot with a new scale; 00126 // if plotMatrices = False, just draw the boxes, 00127 // else, replot all past data. 00128 // 00129 void basicSetUp(Bool plotMatrices = False); 00130 00131 // Note: you MUST call basicSetUp before calling this. 00132 void plotOne(const Int iteration, 00133 const Vector<Float>& resid, const Vector<Float>& flux); 00134 00135 PGPlotter* itsPgplotter; 00136 00137 Vector<Float> iterationNumber; 00138 Matrix<Float> maxResiduals; 00139 Matrix<Float> posResiduals; 00140 Matrix<Float> negResiduals; 00141 Matrix<Float> totalFluxesPer; 00142 Vector<Float> totalFluxes; 00143 uInt currentIndex; 00144 uInt currentTotalIterations; 00145 Float currentFluxScale; 00146 Float currentMinFluxScale; 00147 Float currentMaxResidual; 00148 Float currentMinResidual; 00149 00150 Float logMinRes; 00151 Float logMaxRes; 00152 Float deltaY; 00153 Float xMin; 00154 Float xMax; 00155 00156 Float fluxScaleJump; 00157 Float residScaleJump; 00158 00159 Float forbidden; 00160 00161 Vector<Float> baseFluxes; 00162 00163 }; 00164 00165 00166 00167 } //# NAMESPACE CASA - END 00168 00169 #endif