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_WONLYPROJECTFT_H
00030 #define SYNTHESIS_WONLYPROJECTFT_H
00031
00032 #include <synthesis/MeasurementComponents/VLACalcIlluminationConvFunc.h>
00033 #include <synthesis/MeasurementComponents/VLAIlluminationConvFunc.h>
00034
00035 #include <synthesis/MeasurementComponents/EVLAConvFunc.h>
00036 #include <synthesis/MeasurementComponents/SolvableVisCal.h>
00037 #include <synthesis/TransformMachines/VPSkyJones.h>
00038 #include <synthesis/TransformMachines/FTMachine.h>
00039
00040 #include <synthesis/TransformMachines/Utils.h>
00041
00042 #include <scimath/Mathematics/FFTServer.h>
00043 #include <msvis/MSVis/VisBuffer.h>
00044
00045 #include <casa/Containers/Block.h>
00046 #include <casa/Arrays/Array.h>
00047 #include <casa/Arrays/Vector.h>
00048 #include <casa/Arrays/Matrix.h>
00049
00050 #include <scimath/Mathematics/ConvolveGridder.h>
00051 #include <lattices/Lattices/LatticeCache.h>
00052 #include <lattices/Lattices/ArrayLattice.h>
00053 #include <ms/MeasurementSets/MSColumns.h>
00054 #include <measures/Measures/Measure.h>
00055 #include <measures/Measures/MDirection.h>
00056 #include <measures/Measures/MPosition.h>
00057 #include <images/Images/ImageInterface.h>
00058 #include <coordinates/Coordinates/DirectionCoordinate.h>
00059
00060 namespace casa {
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
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 class SolvableVisJones;
00139 class WOnlyProjectFT : public FTMachine {
00140 public:
00141
00142
00143
00144
00145
00146
00147 WOnlyProjectFT(Int nFacets, Long cachesize,
00148 CountedPtr<CFCache>& cfcache,
00149 CountedPtr<ConvolutionFunction>& cf,
00150 CountedPtr<VisibilityResampler>& reSampler,
00151 Int tilesize=16,
00152 Float pbLimit=5e-2,
00153 Bool usezero=False);
00154
00155
00156
00157 WOnlyProjectFT(const RecordInterface& stateRec);
00158
00159
00160 WOnlyProjectFT(const WOnlyProjectFT &other);
00161
00162
00163 WOnlyProjectFT &operator=(const WOnlyProjectFT &other);
00164
00165 ~WOnlyProjectFT();
00166
00167 virtual void initializeToVis(ImageInterface<Complex>& image,
00168 const VisBuffer& vb);
00169
00170
00171 virtual void initializeToVis(ImageInterface<Complex>& image,
00172 const VisBuffer& vb, Array<Complex>& griddedVis,
00173 Vector<Double>& uvscale);
00174
00175
00176
00177 virtual void finalizeToVis();
00178
00179
00180 virtual void initializeToSky(ImageInterface<Complex>& image, Matrix<Float>& weight,
00181 const VisBuffer& vb);
00182
00183
00184
00185
00186 virtual void finalizeToSky();
00187
00188 virtual void initVisBuffer(VisBuffer& vb, Type whichVBColumn);
00189 void initVisBuffer(VisBuffer& vb, Type whichVBColumn, Int row);
00190
00191
00192 void get(VisBuffer& vb, Int row=-1);
00193
00194
00195
00196
00197 void get(VisBuffer& vb, Cube<Complex>& degrid,
00198 Array<Complex>& griddedVis, Vector<Double>& scale,
00199 Int row=-1);
00200
00201
00202
00203
00204 void put(const VisBuffer&, TempImage<Complex>&, Vector<Double>&, int,
00205 UVWMachine*, Bool)
00206 {
00207
00208 }
00209 void put(const VisBuffer& vb, Int row=-1, Bool dopsf=False,
00210 FTMachine::Type type=FTMachine::OBSERVED);
00211
00212
00213 void makeImage(FTMachine::Type type,
00214 VisSet& vs,
00215 ImageInterface<Complex>& image,
00216 Matrix<Float>& weight);
00217
00218
00219
00220 virtual ImageInterface<Complex>& getImage(Matrix<Float>&, Bool normalize=True);
00221
00222
00223 Bool toRecord(RecordInterface& outRec, Bool withImage=False);
00224 Bool fromRecord(const RecordInterface& inRec);
00225
00226
00227 Bool isFourier() {return True;}
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 virtual void makeSensitivityImage(Lattice<Complex>& wtImage,
00239 ImageInterface<Float>& sensitivityImage,
00240 const Matrix<Float>& sumWt=Matrix<Float>(),
00241 const Bool& doFFTNorm=True) {};
00242 virtual void makeSensitivityImage(const VisBuffer& vb,
00243 const ImageInterface<Complex>& imageTemplate,
00244 ImageInterface<Float>& sensitivityImage);
00245
00246
00247
00248
00249
00250 virtual void normalizeImage(Lattice<Complex>& skyImage,
00251 const Matrix<Double>& sumOfWts,
00252 Lattice<Float>& sensitivityImage,
00253 Bool fftNorm=True);
00254 virtual void normalizeImage(Lattice<Complex>& skyImage,
00255 const Matrix<Double>& sumOfWts,
00256 Lattice<Float>& sensitivityImage,
00257 Lattice<Complex>& sensitivitySqImage,
00258 Bool fftNorm=True);
00259
00260 virtual ImageInterface<Float>& getSensitivityImage() {return *avgPB_p;}
00261 virtual Matrix<Double>& getSumOfWeights() {return sumWeight;};
00262
00263 Vector<Int>& getPolMap() {return polMap;};
00264 virtual String name(){ return "WOnlyProjectFT";};
00265 virtual Bool verifyShapes(IPosition shape0, IPosition shape1);
00266 virtual void setMiscInfo(const Int qualifier){(void)qualifier;};
00267
00268 protected:
00269
00270 Int nint(Double val) {return Int(floor(val+0.5));};
00271
00272
00273
00274
00275 void findConvFunction(const ImageInterface<Complex>& image,
00276 const VisBuffer& vb);
00277
00278
00279 Array<Complex>* getDataPointer(const IPosition&, Bool);
00280
00281 void ok();
00282
00283 void init();
00284
00285
00286
00287 Bool recordOnGrid(const VisBuffer& vb, Int rownr) const;
00288
00289
00290 Float padding_p;
00291
00292 Int nWPlanes_p;
00293
00294 LatticeCache<Complex> * imageCache;
00295
00296
00297 Long cachesize;
00298 Int tilesize;
00299
00300
00301 ConvolveGridder<Double, Complex>* gridder;
00302
00303
00304 Bool isTiled;
00305
00306
00307 CountedPtr<Lattice<Complex> > arrayLattice;
00308
00309
00310
00311 CountedPtr<Lattice<Complex> > lattice;
00312
00313 Float maxAbsData;
00314
00315
00316 IPosition centerLoc, offsetLoc;
00317
00318
00319 Vector<Double> uvScale, uvOffset;
00320
00321
00322 Array<Complex> griddedData;
00323
00324
00325 MDirection::Convert* pointingToImage;
00326
00327
00328 Bool usezero_p;
00329
00330
00331
00332 Array<Complex> convFunc_p, convWeights_p;
00333 CountedPtr<VisibilityResampler> reSampler_p;
00334
00335
00336
00337
00338
00339 Int convSize, convSampling, wConvSize, lastIndex_p;
00340
00341
00342
00343
00344
00345 Int maxConvSupport;
00346
00347 Int Nant_p;
00348 Bool makingPSF;
00349
00350 virtual void runFortranGet(Matrix<Double>& uvw,Vector<Double>& dphase,
00351 Cube<Complex>& visdata,
00352 IPosition& s,
00353
00354
00355
00356 Int& Conj,
00357 Cube<Int>& flags,Vector<Int>& rowFlags,
00358 Int& rownr,Vector<Double>& actualOffset,
00359 Array<Complex>* dataPtr,
00360 Int& aNx, Int& aNy, Int& npol, Int& nchan,
00361 VisBuffer& vb,Int& Nant_p, Int& scanNo,
00362 Double& sigma,
00363 Array<Float>& raoffsets,
00364 Array<Float>& decoffsets,
00365 Double area,
00366 Int& doGrad,Int paIndex);
00367 virtual void runFortranPut(Matrix<Double>& uvw,Vector<Double>& dphase,
00368 const Complex& visdata_p,
00369 IPosition& s,
00370
00371
00372
00373 Int& Conj,
00374 Cube<Int>& flags,Vector<Int>& rowFlags,
00375 const Matrix<Float>& weight,
00376 Int& rownr,Vector<Double>& actualOffset,
00377 Array<Complex>& dataPtr,
00378 Int& aNx, Int& aNy, Int& npol, Int& nchan,
00379 const VisBuffer& vb,Int& Nant_p, Int& scanNo,
00380 Double& sigma,
00381 Array<Float>& raoffsets,
00382 Array<Float>& decoffsets,
00383 Matrix<Double>& sumWeight,
00384 Double& area,
00385 Int& doGrad,
00386 Int& doPSF,Int paIndex);
00387 void runFortranGetGrad(Matrix<Double>& uvw,Vector<Double>& dphase,
00388 Cube<Complex>& visdata,
00389 IPosition& s,
00390 Cube<Complex>& gradVisAzData,
00391 Cube<Complex>& gradVisElData,
00392
00393 Int& Conj,
00394 Cube<Int>& flags,Vector<Int>& rowFlags,
00395 Int& rownr,Vector<Double>& actualOffset,
00396 Array<Complex>* dataPtr,
00397 Int& aNx, Int& aNy, Int& npol, Int& nchan,
00398 VisBuffer& vb,Int& Nant_p, Int& scanNo,
00399 Double& sigma,
00400 Array<Float>& l_off,
00401 Array<Float>& m_off,
00402 Double area,
00403 Int& doGrad,
00404 Int paIndex);
00405 };
00406 }
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423 #endif