00001 //# SynthesisNormalizer.h: Gather and Scatter operations for parallel major cycles. 00002 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 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 //# 00025 //# $Id$ 00026 00027 #ifndef SYNTHESIS_SYNTHESISPARSYNC_H 00028 #define SYNTHESIS_SYNTHESISPARSYNC_H 00029 00030 #include <casa/aips.h> 00031 #include <casa/OS/Timer.h> 00032 #include <casa/Containers/Record.h> 00033 #include <ms/MeasurementSets/MeasurementSet.h> 00034 #include <casa/Arrays/IPosition.h> 00035 #include <casa/Quanta/Quantum.h> 00036 #include <measures/Measures/MDirection.h> 00037 00038 #include<synthesis/ImagerObjects/SDAlgorithmBase.h> 00039 #include<synthesis/ImagerObjects/SDAlgorithmHogbomClean.h> 00040 #include<synthesis/ImagerObjects/SDMaskHandler.h> 00041 #include <synthesis/ImagerObjects/SIMinorCycleController.h> 00042 00043 #include <synthesis/ImagerObjects/SIImageStore.h> 00044 #include <synthesis/ImagerObjects/SIImageStoreMultiTerm.h> 00045 00046 namespace casa { //# NAMESPACE CASA - BEGIN 00047 00048 // Forward declarations 00049 class MeasurementSet; 00050 template<class T> class ImageInterface; 00051 00052 // <summary> Class that contains functions needed for imager </summary> 00053 00054 class SynthesisNormalizer 00055 { 00056 public: 00057 // Default constructor 00058 00059 SynthesisNormalizer(); 00060 ~SynthesisNormalizer(); 00061 00062 // Copy constructor and assignment operator 00063 00064 // make all pure-inputs const 00065 void setupNormalizer(Record normpars); 00066 00067 // Gather all part images to the 'full' one 00068 void gatherImages(Bool dopsf, Bool doresidual, Bool dodensity); 00069 00070 // 'Gather' the pb ( just one node makes it.. ) 00071 void gatherPB(); 00072 00073 // Copy out model to all pieces. Currently a No-Op. 00074 void scatterModel(); 00075 00076 // Gather all part gridded weights and add them up. 00077 void gatherWeightDensity(); 00078 // Scatter summed gridded weights to all parts 00079 void scatterWeightDensity(); 00080 00081 SHARED_PTR<SIImageStore> getImageStore(); 00082 void setImageStore( SIImageStore* imstore ); 00083 00084 void divideResidualByWeight(); 00085 void dividePSFByWeight(); 00086 void divideModelByWeight(); 00087 void multiplyModelByWeight(); 00088 00089 void normalizePrimaryBeam(); 00090 00091 protected: 00092 00093 // Normalize. This can later change to be more general, i.e. used for PB-correction too... 00094 // Check if images exist on disk and are all the same shape 00095 Bool setupImagesOnDisk(); 00096 Bool doImagesExist( String imagename ); 00097 00098 SHARED_PTR<SIImageStore> makeImageStore( String imagename ); 00099 SHARED_PTR<SIImageStore> makeImageStore( String imagename, CoordinateSystem& csys, IPosition shp, Bool useweightimage ); 00100 00101 void setPsfFromOneFacet(); 00102 00104 00105 SHARED_PTR<SIImageStore> itsImages; 00106 Vector<SHARED_PTR<SIImageStore> > itsPartImages; 00107 Block<SHARED_PTR<SIImageStore> > itsFacetImageStores; 00108 00109 IPosition itsImageShape; 00110 00111 String itsImageName; 00112 Vector<String> itsPartImageNames; 00113 String itsStartingModelName; 00114 Float itsPBLimit; 00115 00116 String itsMapperType; 00117 uInt itsNTaylorTerms, itsNFacets; 00118 00119 String itsNormType; 00120 00121 }; 00122 00123 00124 } //# NAMESPACE CASA - END 00125 00126 #endif