00001 //# SISubterBot.h: This file contains the interface definition SISubIterBot class 00002 //# 00003 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) 00004 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. 00005 //# Copyright (C) European Southern Observatory, 2011, All rights reserved. 00006 //# 00007 //# This library is free software; you can redistribute it and/or 00008 //# modify it under the terms of the GNU Lesser General Public 00009 //# License as published by the Free software Foundation; either 00010 //# version 2.1 of the License, or (at your option) any later version. 00011 //# 00012 //# This library is distributed in the hope that it will be useful, 00013 //# but WITHOUT ANY WARRANTY, without even the implied warranty of 00014 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 //# Lesser General Public License for more details. 00016 //# 00017 //# You should have received a copy of the GNU Lesser General Public 00018 //# License along with this library; if not, write to the Free Software 00019 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00020 //# MA 02111-1307 USA 00021 //# $Id: $ 00022 00023 #ifndef SYNTHESIS_MINORCYCLECONTROLLER 00024 #define SYNTHESIS_MINORCYCLECONTROLLER 00025 00026 // .casarc interface 00027 #include <casa/System/AipsrcValue.h> 00028 00029 // System utilities (for profiling macros) 00030 #include <casa/OS/HostInfo.h> 00031 #include <sys/time.h> 00032 00033 00034 // Include files for the DBus Service 00035 //#include <casadbus/interfaces/SynthImager.adaptor.h> 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 class Record; 00040 00041 class SIMinorCycleController 00042 { 00043 public: 00044 00045 // make noncopyable... 00046 SIMinorCycleController( const SIMinorCycleController& ) = delete; 00047 SIMinorCycleController &operator=( const SIMinorCycleController& ) = delete; 00048 SIMinorCycleController(); 00049 00050 virtual ~SIMinorCycleController(); 00051 00052 /* Method to call to determine if a major cycle is required, true if 00053 - exceeded number maxcycleniter 00054 - exceeded cycle threshold 00055 */ 00056 virtual Int majorCycleRequired(Float currentPeakResidual); 00057 00058 /* This method sets the following controls for the Minor Cycle Controller: 00059 - niter 00060 - cycleniter 00061 - interactiveniter? 00062 - threshold 00063 - cyclethreshold 00064 - interactive theshold? 00065 - loop gain 00066 - cycle factor 00067 */ 00068 void setCycleControls(Record& ); 00069 00070 /* Get Cycle Execution Data: 00071 Returns information about the set of cycles just executed: 00072 - iterdone 00073 - maxcycleiterdone 00074 - updated model flag 00075 - peak residual 00076 - minor cycle summary 00077 */ 00078 Record getCycleExecutionRecord(); 00079 00080 00081 /* Get Initialization Data 00082 Returns information at the beginning of a cycle: 00083 - peak residual 00084 - maxPSFSidelobe 00085 */ 00086 Record getCycleInitializationRecord(); 00087 00088 /* Getter Methods for the control variables */ 00089 Float getLoopGain(); 00090 00091 void incrementMinorCycleCount(Int itersDonePerStep=1); 00092 00093 Int getIterDone(); 00094 Int getCycleNiter(); 00095 Float getCycleThreshold(); 00096 00097 /* This method resets the iteration counter for the cycle */ 00098 void resetCycleIter(); 00099 00100 /* Flag to note that the model has been updated */ 00101 void setUpdatedModelFlag(Bool updatedmodel); 00102 00103 void addSummaryMinor(uInt deconvolverid, uInt subimageid, Float model, Float peakresidual); 00104 00105 /* Variables to track status inside each Deconvolver */ 00106 Float getPeakResidual(); 00107 Float getIntegratedFlux(); 00108 Float getMaxPsfSidelobe(); 00109 00110 void setPeakResidual(Float peakResidual); 00111 void addIntegratedFlux(Float integratedFlux); 00112 void setMaxPsfSidelobe(Float maxPsfSidelobe); 00113 00114 protected: 00115 /* Control Variables */ 00116 Int itsCycleNiter; 00117 Float itsCycleThreshold; 00118 Float itsLoopGain; 00119 00120 Bool itsUpdatedModelFlag; 00121 00122 /* Status Reporting Variables */ 00123 Int itsIterDone; // Iterations done during this set of cycles 00124 Int itsCycleIterDone; // Iterations done on this subimage 00125 Int itsIterDiff; // Difference between latest and previous count, to catch zero increments. 00126 00127 /* Useful only for reporting */ 00128 Int itsTotalIterDone; // Total iterations done by deconvolver 00129 00130 /* This variable keeps track of the maximum number of iterations done 00131 during a major cycle */ 00132 Int itsMaxCycleIterDone; 00133 00134 Float itsPeakResidual; 00135 Float itsIntegratedFlux; 00136 Float itsMaxPsfSidelobe; 00137 00138 00139 /* Summary Variable */ 00140 Array<Double> itsSummaryMinor; 00141 Int itsNSummaryFields; 00142 Int itsDeconvolverID; /* An ID per Deconvolver. Used only for the summary */ 00143 }; 00144 00145 00146 } //# NAMESPACE CASA - END 00147 00148 #endif /* SISUBITERBOT_H_ */