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_TRANSFORM2_MULTITERMFTNEW_H
00030 #define SYNTHESIS_TRANSFORM2_MULTITERMFTNEW_H
00031
00032 #include <synthesis/TransformMachines2/FTMachine.h>
00033 #include <casa/Arrays/Matrix.h>
00034 #include <scimath/Mathematics/FFTServer.h>
00035 #include <msvis/MSVis/VisBuffer2.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 namespace vi{
00052 class VisibilityIterator2;
00053 }
00054
00055 namespace refim {
00056 class MultiTermFTNew : public FTMachine {
00057 public:
00058
00059
00060 MultiTermFTNew(CountedPtr<FTMachine>& subftm, Int nterms=1, Bool forward=False);
00061
00062
00063 MultiTermFTNew(const RecordInterface& stateRec);
00064
00065
00066
00067 MultiTermFTNew(const MultiTermFTNew &other);
00068
00069
00070 MultiTermFTNew &operator=(const MultiTermFTNew &other);
00071
00072
00073 ~MultiTermFTNew();
00074
00075
00076
00077
00078 void initializeToVis(ImageInterface<Complex>& ,
00079 const vi::VisBuffer2& ){throw(AipsError("not implemented"));};
00080
00081
00082
00083 virtual void initializeToVisNew(const vi::VisBuffer2& vb,
00084 CountedPtr<SIImageStore> imstore);
00085
00086
00087 void finalizeToVis();
00088
00089
00090 void initializeToSky(ImageInterface<Complex>& ,
00091 Matrix<Float>& , const vi::VisBuffer2& ){throw(AipsError("not implemented"));};
00092
00093
00094 virtual void initializeToSkyNew(const Bool dopsf,
00095 const vi::VisBuffer2& vb,
00096 CountedPtr<SIImageStore> imstore);
00097
00098
00099
00100 void finalizeToSky(){throw(AipsError("MultiTermFTNew::finalizeToSky() called without arguments!"));};
00101
00102
00103
00104 virtual void finalizeToSkyNew(Bool dopsf,
00105 const vi::VisBuffer2& vb,
00106 CountedPtr<SIImageStore> imstore );
00107
00108
00109
00110
00111
00112
00113 void get(vi::VisBuffer2& vb, Int row=-1);
00114
00115 void put(vi::VisBuffer2& vb, Int row=-1, Bool dopsf=False,
00116 refim::FTMachine::Type type=refim::FTMachine::OBSERVED);
00117
00118 void put(const vi::VisBuffer2& , Int , Bool ,
00119 refim::FTMachine::Type )
00120 {throw(AipsError("Internal error: called MultiTermFTNew::put(const VB2)"));};
00121
00122
00123 virtual void ComputeResiduals(vi::VisBuffer2& vb, Bool useCorrected);
00124
00125
00126 void makeImage(refim::FTMachine::Type type,
00127 vi::VisibilityIterator2& vs,
00128 ImageInterface<Complex>& image,
00129 Matrix<Float>& weight);
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 ImageInterface<Complex>& getImage(Matrix<Float>& , Bool =True)
00140 {throw(AipsError("MultiTermFTNew::getImage() should not be called"));}
00141
00142 virtual Bool useWeightImage()
00143 {AlwaysAssert(subftms_p.nelements()>0,AipsError); return subftms_p[0]->useWeightImage(); };
00144
00145 void getWeightImage(ImageInterface<Float>& weightImage, Matrix<Float>& weights)
00146 {AlwaysAssert(subftms_p.nelements()>0,AipsError);
00147 subftms_p[0]->getWeightImage(weightImage, weights);}
00148
00149
00150
00151 virtual Bool toRecord(String& error, RecordInterface& outRec, Bool withImage=False,
00152 const String diskimage="");
00153 virtual Bool fromRecord(String& error, const RecordInterface& inRec);
00154
00155
00156 virtual Bool isFourier() {return True;}
00157 virtual void setNoPadding(Bool nopad){subftms_p[0]->setNoPadding(nopad);};
00158 virtual String name()const {return machineName_p;};
00159 virtual void setMiscInfo(const Int qualifier){(void)qualifier;};
00160
00161 void printFTTypes()
00162 {
00163 cout << "** Number of FTs : " << subftms_p.nelements() << " -- " ;
00164 for(uInt tix=0; tix<(subftms_p).nelements(); tix++)
00165 cout << tix << " : " << (subftms_p[tix])->name() << " " ;
00166 cout << endl;
00167 };
00168
00169 FTMachine* cloneFTM();
00170 virtual void setDryRun(Bool val)
00171 {
00172 isDryRun=val;
00173
00174 for (uInt i=0;i<subftms_p.nelements();i++)
00175 subftms_p[i]->setDryRun(val);
00176 };
00177 virtual Bool isUsingCFCache() {Bool v=False; if (subftms_p.nelements() > 0) v=subftms_p[0]->isUsingCFCache(); return v;};
00178
00179 protected:
00180
00181 virtual void initMaps(const vi::VisBuffer2& vb);
00182
00183 CountedPtr<FTMachine> getNewFTM(const CountedPtr<FTMachine>& ftm);
00184
00185
00186 Bool modifyVisWeights(vi::VisBuffer2& vb, uInt thisterm);
00187
00188 Bool modifyModelVis(vi::VisBuffer2 &vb, uInt thisterm);
00189
00190 void restoreImagingWeights(vi::VisBuffer2 &vb);
00191
00192
00193 Bool storeAsImg(String fileName, ImageInterface<Float> & theImg);
00194
00195
00196 Cube<Complex> modviscube_p;
00197
00199 uInt nterms_p, psfnterms_p;
00200 Double reffreq_p;
00201 Matrix<Float> imweights_p;
00202 String machineName_p;
00203
00204
00205
00206 Block< CountedPtr<FTMachine> > subftms_p;
00207
00208 };
00209
00210 }
00211 }
00212
00213 #endif