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_TRANSFORM2_MOSAICFT_H
00030 #define SYNTHESIS_TRANSFORM2_MOSAICFT_H
00031
00032 #include <synthesis/TransformMachines2/FTMachine.h>
00033 #include <synthesis/TransformMachines2/SkyJones.h>
00034 #include <casa/Arrays/Matrix.h>
00035 #include <scimath/Mathematics/FFTServer.h>
00036 #include <msvis/MSVis/VisBuffer2.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
00127 class MPosition;
00128 class UVWMachine;
00129
00130 namespace refim{
00131 class SimplePBConvFunc;
00132
00133 class MosaicFT : public FTMachine {
00134 public:
00135
00136
00137
00138
00139
00140
00141 MosaicFT(SkyJones* sj, MPosition mloc, String stokes,
00142 Long cachesize, Int tilesize=16,
00143 Bool usezero=True, Bool useDoublePrec=False);
00144
00145
00146
00147 MosaicFT(const RecordInterface& stateRec);
00148
00149
00150 MosaicFT(const MosaicFT &other);
00151
00152
00153 MosaicFT &operator=(const MosaicFT &other);
00154
00155 ~MosaicFT();
00156
00157
00158
00159 void initializeToVis(ImageInterface<Complex>& image,
00160 const vi::VisBuffer2& vb);
00161
00162
00163
00164 void finalizeToVis();
00165
00166
00167 void initializeToSky(ImageInterface<Complex>& image, Matrix<Float>& weight,
00168 const vi::VisBuffer2& vb);
00170
00171
00172
00173
00174 void finalizeToSky();
00175
00176
00177 void get(vi::VisBuffer2& vb, Int row=-1);
00178
00179
00180
00181 void put(const vi::VisBuffer2& vb, Int row=-1, Bool dopsf=False,
00182 FTMachine::Type type=FTMachine::OBSERVED);
00183
00184
00185 void makeImage(FTMachine::Type type,
00186 vi::VisibilityIterator2& vs,
00187 ImageInterface<Complex>& image,
00188 Matrix<Float>& weight);
00189
00190
00191
00192 ImageInterface<Complex>& getImage(Matrix<Float>&, Bool normalize=True);
00193 virtual void normalizeImage(Lattice<Complex>& ,
00194 const Matrix<Double>& ,
00195 Lattice<Float>& ,
00196 Bool )
00197 {throw(AipsError("MosaicFT::normalizeImage() called"));}
00198
00199
00200
00201 void getWeightImage(ImageInterface<Float>&, Matrix<Float>&);
00202
00203
00204
00205 virtual void getFluxImage(ImageInterface<Float>& image);
00206
00207
00208 Bool toRecord(String& error, RecordInterface& outRec,
00209 Bool withImage=False, const String diskimage="");
00210 Bool fromRecord(String& error, const RecordInterface& inRec);
00211
00212
00213 Bool isFourier() {return True;}
00214
00215
00216
00217 virtual String name() const;
00218 virtual Bool useWeightImage(){return True;};
00219
00220
00221
00222
00223
00224 void setConvFunc(CountedPtr<SimplePBConvFunc>& pbconvFunc);
00225 CountedPtr<SimplePBConvFunc>& getConvFunc();
00226
00227 CountedPtr<TempImage<Float> >& getConvWeightImage();
00228
00229
00230 virtual void reset();
00231 virtual void setMiscInfo(const Int qualifier){(void)qualifier;};
00232 virtual void ComputeResiduals(vi::VisBuffer2&, Bool ) {};
00233
00234 protected:
00235
00236 Int nint(Double val) {return Int(floor(val+0.5));};
00237
00238
00239 void findConvFunction(const ImageInterface<Complex>& image,
00240 const vi::VisBuffer2& vb);
00241
00242 void girarUVW(Matrix<Double>& uvw, Vector<Double>& dphase,
00243 const vi::VisBuffer2& vb);
00244
00245 void addBeamCoverage(ImageInterface<Complex>& image);
00246 void prepGridForDegrid();
00247
00248 SkyJones* sj_p;
00249
00250
00251
00252 Array<Complex>* getDataPointer(const IPosition&, Bool);
00253
00254 void ok();
00255
00256 void init();
00257
00258
00259
00260 Bool recordOnGrid(const vi::VisBuffer2& vb, Int rownr) const;
00261
00262
00263
00264 LatticeCache<Complex> * imageCache;
00265
00266
00267 Long cachesize;
00268 Int tilesize;
00269
00270
00271 ConvolveGridder<Double, Complex>* gridder;
00272
00273
00274 Bool isTiled;
00275
00276
00277 CountedPtr<Lattice<Complex> > arrayLattice;
00278
00279
00280
00281 CountedPtr<Lattice<Complex> > lattice;
00282 CountedPtr<Lattice<Complex> > weightLattice;
00283
00284 Float maxAbsData;
00285
00286
00287 IPosition centerLoc, offsetLoc;
00288
00289
00290 Vector<Double> uvScale, uvOffset;
00291
00292
00293 Array<Complex> griddedWeight;
00294 Array<DComplex> griddedWeight2;
00295
00296 MSPointingColumns* mspc;
00297
00298
00299 MSAntennaColumns* msac;
00300
00301 DirectionCoordinate directionCoord;
00302
00303 MDirection::Convert* pointingToImage;
00304
00305 Vector<Double> xyPos;
00306
00307 MDirection worldPosMeas;
00308
00309 Int priorCacheSize;
00310
00311
00312 Bool usezero_p;
00313
00314 Array<Complex> convFunc;
00315 Array<Complex> weightConvFunc_p;
00316 Int convSampling;
00317 Int convSize;
00318 Int convSupport;
00319 Vector<Int> convSupportPlanes_p;
00320 Vector<Int> convSizePlanes_p;
00321 Vector<Int> convRowMap_p;
00322 Vector<Int> convChanMap_p;
00323 Vector<Int> convPolMap_p;
00324
00325 Int wConvSize;
00326
00327 Int lastIndex_p;
00328
00329 Int getIndex(const ROMSPointingColumns& mspc, const Double& time,
00330 const Double& interval);
00331
00332 Bool getXYPos(const vi::VisBuffer2& vb, Int row);
00333
00334 CountedPtr<TempImage<Float> >skyCoverage_p;
00335 TempImage<Complex>* convWeightImage_p;
00336 CountedPtr<SimplePBConvFunc> pbConvFunc_p;
00337 CountedPtr<UVWMachine> phaseShifter_p;
00338
00339 String machineName_p;
00340 Bool doneWeightImage_p;
00341 String stokes_p;
00342
00343
00344 };
00345
00346 }
00347
00348 }
00349
00350 #endif