casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SIMinorCycleController.h
Go to the documentation of this file.
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 // Boost Libraries for mutex and noncopyable semantics
00035 //#include <boost/thread/recursive_mutex.hpp>
00036 #include <boost/utility.hpp>
00037 
00038 // Include files for the DBus Service
00039 //#include <casadbus/interfaces/SynthImager.adaptor.h>
00040 
00041 /* Future Decl */
00042 class casa::Record;
00043 
00044 namespace casa { //# NAMESPACE CASA - BEGIN
00045   
00046   class SIMinorCycleController : boost::noncopyable 
00047  {
00048   public:
00049     SIMinorCycleController();
00050 
00051     virtual ~SIMinorCycleController();
00052 
00053     /* Method to call to determine if a major cycle is required, true if
00054          - exceeded number maxcycleniter
00055          - exceeded cycle threshold
00056     */
00057     virtual bool majorCycleRequired(Float currentPeakResidual);
00058 
00059     /* This method sets the following controls for the Minor Cycle Controller:
00060        - niter
00061        - cycleniter
00062        - interactiveniter?
00063        - threshold
00064        - cyclethreshold
00065        - interactive theshold?
00066        - loop gain
00067        - cycle factor
00068     */
00069     void setCycleControls(Record& );
00070 
00071     /* Get Cycle Execution Data:
00072        Returns information about the set of cycles just executed:
00073        - iterdone
00074        - maxcycleiterdone
00075        - updated model flag
00076        - peak residual
00077        - minor cycle summary
00078     */
00079     Record getCycleExecutionRecord();
00080 
00081 
00082     /* Get Initialization Data
00083        Returns information at the beginning of a cycle:
00084        - peak residual
00085        - maxPSFSidelobe
00086     */
00087     Record getCycleInitializationRecord();
00088 
00089     /* Getter Methods for the control variables */
00090     Float getLoopGain(); 
00091 
00092     void incrementMinorCycleCount();
00093 
00094     Int getIterDone();
00095     Int getCycleNiter();
00096     Float getCycleThreshold();
00097 
00098     /* This method resets the iteration counter for the cycle */
00099     void resetCycleIter();
00100 
00101     /* Flag to note that the model has been updated */
00102     void setUpdatedModelFlag(Bool updatedmodel);
00103 
00104    void addSummaryMinor(uInt deconvolverid, uInt subimageid, Float model, Float peakresidual);
00105     
00106     /* Variables to track status inside each Deconvolver */
00107     Float getPeakResidual();
00108     Float getIntegratedFlux();
00109     Float getMaxPsfSidelobe();
00110     
00111     void setPeakResidual(Float peakResidual);
00112     void addIntegratedFlux(Float integratedFlux);
00113     void setMaxPsfSidelobe(Float maxPsfSidelobe);
00114 
00115  protected:
00116     /* Control Variables */
00117     Int    itsCycleNiter;
00118     Float itsCycleThreshold;
00119     Float itsLoopGain;
00120     
00121     Bool  itsUpdatedModelFlag;
00122 
00123     /* Status Reporting Variables */
00124     Int   itsIterDone; // Iterations done during this set of cycles
00125     Int   itsCycleIterDone; // Iterations done on this subimage
00126 
00127 
00128     /* Useful only for reporting */
00129     Int   itsTotalIterDone; // Total iterations done by deconvolver
00130 
00131     /* This variable keeps track of the maximum number of iterations done
00132        during a major cycle */
00133     Int   itsMaxCycleIterDone;
00134     
00135    Float itsMaxPsfSidelobe;
00136 
00137    Float itsPeakResidual;
00138    Float itsIntegratedFlux;
00139    
00140 
00141     /* Summary Variable */
00142     Array<Double> itsSummaryMinor;
00143     Int itsNSummaryFields;
00144     Int itsDeconvolverID;    /* An ID per Deconvolver. Used only for the summary */
00145   };
00146 
00147     
00148 } //# NAMESPACE CASA - END
00149 
00150 #endif /* SISUBITERBOT_H_ */