MosaicFT.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_MOSAICFT_H
00030 #define SYNTHESIS_MOSAICFT_H
00031
00032 #include <synthesis/TransformMachines/FTMachine.h>
00033 #include <synthesis/TransformMachines/SkyJones.h>
00034 #include <casa/Arrays/Matrix.h>
00035 #include <scimath/Mathematics/FFTServer.h>
00036 #include <msvis/MSVis/VisBuffer.h>
00037 #include <images/Images/ImageInterface.h>
00038 #include <images/Images/ImageInterface.h>
00039 #include <casa/Containers/Block.h>
00040 #include <casa/Arrays/Array.h>
00041 #include <casa/Arrays/Vector.h>
00042 #include <casa/Utilities/CountedPtr.h>
00043 #include <scimath/Mathematics/ConvolveGridder.h>
00044 #include <lattices/Lattices/LatticeCache.h>
00045 #include <lattices/Lattices/ArrayLattice.h>
00046 #include <ms/MeasurementSets/MSColumns.h>
00047 #include <measures/Measures/Measure.h>
00048 #include <measures/Measures/MDirection.h>
00049 #include <measures/Measures/MPosition.h>
00050 #include <coordinates/Coordinates/DirectionCoordinate.h>
00051
00052 namespace casa {
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 class MosaicFT;
00126 class SimplePBConvFunc;
00127 class MPosition;
00128 class UVWMachine;
00129
00130
00131 class MosaicFT : public FTMachine {
00132 public:
00133
00134
00135
00136
00137
00138
00139 MosaicFT(SkyJones* sj, MPosition mloc, String stokes,
00140 Long cachesize, Int tilesize=16,
00141 Bool usezero=True, Bool useDoublePrec=False);
00142
00143
00144
00145 MosaicFT(const RecordInterface& stateRec);
00146
00147
00148 MosaicFT(const MosaicFT &other);
00149
00150
00151 MosaicFT &operator=(const MosaicFT &other);
00152
00153 ~MosaicFT();
00154
00155
00156
00157 void initializeToVis(ImageInterface<Complex>& image,
00158 const VisBuffer& vb);
00159
00160
00161
00162 void finalizeToVis();
00163
00164
00165 void initializeToSky(ImageInterface<Complex>& image, Matrix<Float>& weight,
00166 const VisBuffer& vb);
00168
00169
00170
00171
00172 void finalizeToSky();
00173
00174
00175 void get(VisBuffer& vb, Int row=-1);
00176
00177
00178
00179 void put(const VisBuffer& vb, Int row=-1, Bool dopsf=False,
00180 FTMachine::Type type=FTMachine::OBSERVED);
00181
00182
00183 void makeImage(FTMachine::Type type,
00184 VisSet& vs,
00185 ImageInterface<Complex>& image,
00186 Matrix<Float>& weight);
00187
00188
00189
00190 ImageInterface<Complex>& getImage(Matrix<Float>&, Bool normalize=True);
00191 virtual void normalizeImage(Lattice<Complex>& ,
00192 const Matrix<Double>& ,
00193 Lattice<Float>& ,
00194 Bool )
00195 {throw(AipsError("MosaicFT::normalizeImage() called"));}
00196
00197
00198
00199 void getWeightImage(ImageInterface<Float>&, Matrix<Float>&);
00200
00201
00202
00203 virtual void getFluxImage(ImageInterface<Float>& image);
00204
00205
00206 Bool toRecord(String& error, RecordInterface& outRec,
00207 Bool withImage=False, const String diskimage="");
00208 Bool fromRecord(String& error, const RecordInterface& inRec);
00209
00210
00211 Bool isFourier() {return True;}
00212
00213
00214
00215 virtual String name() const;
00216 virtual Bool useWeightImage(){return True;};
00217
00218
00219
00220
00221
00222 void setConvFunc(CountedPtr<SimplePBConvFunc>& pbconvFunc);
00223 CountedPtr<SimplePBConvFunc>& getConvFunc();
00224
00225 CountedPtr<TempImage<Float> >& getConvWeightImage();
00226
00227
00228 virtual void reset();
00229 virtual void setMiscInfo(const Int qualifier){(void)qualifier;};
00230 virtual void ComputeResiduals(VisBuffer&, Bool ) {};
00231
00232 protected:
00233
00234 Int nint(Double val) {return Int(floor(val+0.5));};
00235
00236
00237 void findConvFunction(const ImageInterface<Complex>& image,
00238 const VisBuffer& vb);
00239
00240 void girarUVW(Matrix<Double>& uvw, Vector<Double>& dphase,
00241 const VisBuffer& vb);
00242
00243 void addBeamCoverage(ImageInterface<Complex>& image);
00244 void prepGridForDegrid();
00245
00246 SkyJones* sj_p;
00247
00248
00249
00250 Array<Complex>* getDataPointer(const IPosition&, Bool);
00251
00252 void ok();
00253
00254 void init();
00255
00256
00257
00258 Bool recordOnGrid(const VisBuffer& vb, Int rownr) const;
00259
00260
00261
00262 LatticeCache<Complex> * imageCache;
00263
00264
00265 Long cachesize;
00266 Int tilesize;
00267
00268
00269 ConvolveGridder<Double, Complex>* gridder;
00270
00271
00272 Bool isTiled;
00273
00274
00275 CountedPtr<Lattice<Complex> > arrayLattice;
00276
00277
00278
00279 CountedPtr<Lattice<Complex> > lattice;
00280 CountedPtr<Lattice<Complex> > weightLattice;
00281
00282 Float maxAbsData;
00283
00284
00285 IPosition centerLoc, offsetLoc;
00286
00287
00288 Vector<Double> uvScale, uvOffset;
00289
00290
00291 Array<Complex> griddedWeight;
00292 Array<DComplex> griddedWeight2;
00293
00294 MSPointingColumns* mspc;
00295
00296
00297 MSAntennaColumns* msac;
00298
00299 DirectionCoordinate directionCoord;
00300
00301 MDirection::Convert* pointingToImage;
00302
00303 Vector<Double> xyPos;
00304
00305 MDirection worldPosMeas;
00306
00307 Int priorCacheSize;
00308
00309
00310 Bool usezero_p;
00311
00312 Array<Complex> convFunc;
00313 Array<Complex> weightConvFunc_p;
00314 Int convSampling;
00315 Int convSize;
00316 Int convSupport;
00317 Vector<Int> convSupportPlanes_p;
00318 Vector<Int> convSizePlanes_p;
00319 Vector<Int> convRowMap_p;
00320 Vector<Int> convChanMap_p;
00321 Vector<Int> convPolMap_p;
00322
00323 Int wConvSize;
00324
00325 Int lastIndex_p;
00326
00327 Int getIndex(const ROMSPointingColumns& mspc, const Double& time,
00328 const Double& interval);
00329
00330 Bool getXYPos(const VisBuffer& vb, Int row);
00331
00332 CountedPtr<TempImage<Float> >skyCoverage_p;
00333 TempImage<Complex>* convWeightImage_p;
00334 CountedPtr<SimplePBConvFunc> pbConvFunc_p;
00335 CountedPtr<UVWMachine> phaseShifter_p;
00336
00337 String machineName_p;
00338 Bool doneWeightImage_p;
00339 String stokes_p;
00340
00341
00342 };
00343
00344 }
00345
00346 #endif