MultiTermFTNew.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SYNTHESIS_MULTITERMFTNEW_H
00030 #define SYNTHESIS_MULTITERMFTNEW_H
00031
00032 #include <synthesis/TransformMachines/FTMachine.h>
00033 #include <casa/Arrays/Matrix.h>
00034 #include <scimath/Mathematics/FFTServer.h>
00035 #include <msvis/MSVis/VisBuffer.h>
00036 #include <images/Images/ImageInterface.h>
00037 #include <images/Images/ImageInterface.h>
00038 #include <casa/Containers/Block.h>
00039 #include <casa/Arrays/Array.h>
00040 #include <casa/Arrays/Vector.h>
00041 #include <casa/Arrays/Matrix.h>
00042 #include <scimath/Mathematics/ConvolveGridder.h>
00043 #include <lattices/Lattices/LatticeCache.h>
00044 #include <lattices/Lattices/ArrayLattice.h>
00045
00046 #include <casa/OS/Timer.h>
00047
00048 namespace casa {
00049
00050 class UVWMachine;
00051
00052 class MultiTermFTNew : public FTMachine {
00053 public:
00054
00055
00056 MultiTermFTNew(CountedPtr<FTMachine>& subftm, Int nterms=1, Bool forward=False);
00057
00058
00059 MultiTermFTNew(const RecordInterface& stateRec);
00060
00061
00062
00063 MultiTermFTNew(const MultiTermFTNew &other);
00064
00065
00066 MultiTermFTNew &operator=(const MultiTermFTNew &other);
00067
00068
00069 ~MultiTermFTNew();
00070
00071
00072
00073 void initializeToVis(ImageInterface<Complex>& ,
00074 const VisBuffer& )
00075 {throw(AipsError("MultiTermFTNew::initializeToVis called without vectors !"));};
00076
00077
00078
00079
00080 virtual void initializeToVisNew(const VisBuffer& vb,
00081 CountedPtr<SIImageStore> imstore);
00082
00083
00084 void finalizeToVis();
00085
00086
00087 void initializeToSky(ImageInterface<Complex>& ,
00088 Matrix<Float>& , const VisBuffer& )
00089 {throw(AipsError("MultiTermFTNew::initializeToSky() called without vectors!"));};
00090
00091
00092
00093 virtual void initializeToSkyNew(const Bool dopsf,
00094 const VisBuffer& vb,
00095 CountedPtr<SIImageStore> imstore);
00096
00097
00098
00099 void finalizeToSky(){throw(AipsError("MultiTermFTNew::finalizeToSky() called without arguments!"));};
00100
00101
00102
00103 virtual void finalizeToSkyNew(Bool dopsf,
00104 const VisBuffer& vb,
00105 CountedPtr<SIImageStore> imstore );
00106
00107
00108
00109
00110
00111
00112 void get(VisBuffer& vb, Int row=-1);
00113
00114
00115 void put(VisBuffer& vb, Int row=-1, Bool dopsf=False,
00116 FTMachine::Type type=FTMachine::OBSERVED);
00117
00118
00119 void put(const VisBuffer& , Int =-1, Bool =False,
00120 FTMachine::Type =FTMachine::OBSERVED)
00121 {throw(AipsError("MultiTermFTNew::put called with a const vb. This FTM needs to modify the vb."));};
00122
00123
00124
00125 virtual void ComputeResiduals(VisBuffer&vb, Bool useCorrected);
00126
00127
00128 void makeImage(FTMachine::Type type,
00129 VisSet& vs,
00130 ImageInterface<Complex>& image,
00131 Matrix<Float>& weight);
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 ImageInterface<Complex>& getImage(Matrix<Float>& , Bool =True)
00142 {throw(AipsError("MultiTermFTNew::getImage() should not be called"));}
00143
00144 virtual Bool useWeightImage()
00145 {AlwaysAssert(subftms_p.nelements()>0,AipsError); return subftms_p[0]->useWeightImage(); };
00146
00147 void getWeightImage(ImageInterface<Float>& weightImage, Matrix<Float>& weights)
00148 {AlwaysAssert(subftms_p.nelements()>0,AipsError);
00149 subftms_p[0]->getWeightImage(weightImage, weights);}
00150
00151
00152
00153 virtual Bool toRecord(String& error, RecordInterface& outRec, Bool withImage=False,
00154 const String diskimage="");
00155 virtual Bool fromRecord(String& error, const RecordInterface& inRec);
00156
00157
00158 virtual Bool isFourier() {return True;}
00159 virtual void setNoPadding(Bool nopad){subftms_p[0]->setNoPadding(nopad);};
00160 virtual String name()const {return machineName_p;};
00161 virtual void setMiscInfo(const Int qualifier){(void)qualifier;};
00162
00163 void printFTTypes()
00164 {
00165 cout << "** Number of FTs : " << subftms_p.nelements() << " -- " ;
00166 for(uInt tix=0; tix<(subftms_p).nelements(); tix++)
00167 cout << tix << " : " << (subftms_p[tix])->name() << " " ;
00168 cout << endl;
00169 };
00170
00171 FTMachine* cloneFTM();
00172 virtual void setDryRun(Bool val)
00173 {
00174 isDryRun=val;
00175
00176 for (uInt i=0;i<subftms_p.nelements();i++)
00177 subftms_p[i]->setDryRun(val);
00178 };
00179 virtual Bool isUsingCFCache() {Bool v=False; if (subftms_p.nelements() > 0) v=subftms_p[0]->isUsingCFCache(); return v;};
00180
00181 protected:
00182
00183 virtual void initMaps(const VisBuffer& vb);
00184
00185 CountedPtr<FTMachine> getNewFTM(const CountedPtr<FTMachine>& ftm);
00186
00187
00188 Bool modifyVisWeights(VisBuffer& vb, uInt thisterm);
00189
00190 Bool modifyModelVis(VisBuffer &vb, uInt thisterm);
00191
00192 void restoreImagingWeights(VisBuffer &vb);
00193
00194
00195 Bool storeAsImg(String fileName, ImageInterface<Float> & theImg);
00196
00197
00198 Cube<Complex> modviscube_p;
00199
00201 uInt nterms_p, psfnterms_p;
00202 Double reffreq_p;
00203 Matrix<Float> imweights_p;
00204 String machineName_p;
00205
00206
00207
00208 Block< CountedPtr<FTMachine> > subftms_p;
00209
00210 };
00211
00212 }
00213
00214 #endif