SimplePBConvFunc.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 #ifndef SYNTHESIS_TRANSFORM2_SIMPLEPBCONVFUNC_H
00029 #define SYNTHESIS_TRANSFORM2_SIMPLEPBCONVFUNC_H
00030
00031 #include <casa/Arrays/Vector.h>
00032 #include <synthesis/TransformMachines/PBMathInterface.h>
00033 #include <casa/Containers/Block.h>
00034 #include <casa/Utilities/CountedPtr.h>
00035 #include <msvis/MSVis/VisBufferUtil.h>
00036 #include <synthesis/Utilities/FFT2D.h>
00037
00038 #include <wcslib/wcsconfig.h>
00040 #if HAVE_SINCOS
00041 #define SINCOS(a,s,c) sincos(a,&s,&c)
00042 #else
00043 #define SINCOS(a,s,c) \
00044 s = sin(a); \
00045 c = cos(a)
00046 #endif
00047
00048
00049 namespace casa{
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 template<class T> class ImageInterface;
00070 template<class T> class Matrix;
00071
00072
00073 class CoordinateSystem;
00074 class DirectionCoordinate;
00075 namespace vi{class VisBuffer2;}
00076
00077
00078 namespace refim{
00079 class SkyJones;
00080
00081
00082 class SimplePBConvFunc
00083
00084 {
00085 public:
00086 SimplePBConvFunc();
00087 SimplePBConvFunc(const PBMathInterface::PBClass typeToUse);
00088 SimplePBConvFunc(const RecordInterface& rec, Bool calcFlux_needed);
00089 virtual ~SimplePBConvFunc();
00090
00091
00092
00093
00094 virtual void findConvFunction(const ImageInterface<Complex>& ,
00095 const vi::VisBuffer2& ,const Int& ,
00096 SkyJones& ,
00097 Matrix<Complex>& ,
00098 Matrix<Complex>& , Int& ,
00099 Int& ){};
00100
00102
00103
00104
00105 virtual void findConvFunction(const ImageInterface<Complex>& iimage,
00106 const vi::VisBuffer2& vb,
00107 const Int& convSampling,
00108 const Vector<Double>& visFreq,
00109 Array<Complex>& convFunc,
00110 Array<Complex>& weightConvFunc,
00111 Vector<Int>& convsize,
00112 Vector<Int>& convSupport,
00113 Vector<Int>& polMap, Vector<Int>& chanMap, Vector<Int>& rowMap);
00114 virtual ImageInterface<Float>& getFluxScaleImage();
00115
00116 virtual void sliceFluxScale(Int npol);
00117
00118
00119 virtual void setWeightImage(CountedPtr<TempImage<Float> >& wgtimage);
00120
00121 virtual void setSkyJones(SkyJones* sj);
00122
00123 Bool findSupport(Array<Complex>& , Float& ,Int& , Int& )
00124 {throw(AipsError("SimplePBConvFunc::findSupport() not implemented"));};
00125 virtual Bool makeAverageResponse(const vi::VisBuffer2& ,
00126 const ImageInterface<Complex>& ,
00127 ImageInterface<Float>& ,
00128 Bool )
00129 {throw(AipsError("SimplePBConvFunc::makeAverageRes() called"));};
00130
00131
00132 virtual Bool toRecord(RecordInterface& outRec);
00133
00134
00135 virtual Bool fromRecord(String& err, const RecordInterface& rec, Bool calcFluxneeded=False);
00136
00137 virtual void reset();
00138
00139 protected:
00140 SkyJones* sj_p;
00141 TempImage<Float> fluxScale_p;
00142 Int nx_p;
00143 Int ny_p;
00144 Int nchan_p;
00145 Int npol_p;
00146 CoordinateSystem csys_p;
00147 DirectionCoordinate dc_p;
00148 MDirection::Convert pointToPix_p;
00149 MeasFrame pointFrame_p;
00150 MEpoch::Types timeMType_p;
00151 Unit timeUnit_p;
00152 Int directionIndex_p;
00153 MDirection direction1_p;
00154 MDirection direction2_p;
00155 Vector<Double> thePix_p;
00156 Bool filledFluxScale_p;
00157 Vector<Bool> doneMainConv_p;
00158 Bool calcFluxScale_p;
00159 std::map<String, Int> vbConvIndex_p;
00160 virtual Int convIndex(const vi::VisBuffer2& vb);
00161 std::map<String, Int> ant1PointVal_p;
00162 Vector<MDirection> ant1PointingCache_p;
00163 const MDirection& pointingDirAnt1(const vi::VisBuffer2& vb);
00164 virtual void storeImageParams(const ImageInterface<Complex>& iimage, const vi::VisBuffer2& vb);
00165 virtual void findUsefulChannels(Vector<Int>& chanMap, Vector<Double>& chanFreqs, const vi::VisBuffer2& vb, const Vector<Double>& visFreq);
00166
00167 virtual void toPix(const vi::VisBuffer2& vb);
00168 FFT2D ft_p;
00169 CountedPtr<TempImage<Float> > convWeightImage_p;
00170 private:
00171 Bool checkPBOfField(const vi::VisBuffer2& vb);
00172 void addPBToFlux(const vi::VisBuffer2& vb);
00173 SimpleOrderedMap <String, Int> convFunctionMap_p;
00174 Int actualConvIndex_p;
00175 PBMathInterface::PBClass pbClass_p;
00176
00177 Matrix<Complex> convFunc_p;
00178 Matrix<Complex> weightConvFunc_p;
00179 Matrix<Complex> convSave_p;
00180 Matrix<Complex> weightSave_p;
00181 Int convSize_p;
00182 Int convSupport_p;
00183
00184
00185 Block <CountedPtr<Array<Complex> > > convFunctions_p;
00186 Block <CountedPtr<Array<Complex> > > convWeights_p;
00187 Block<CountedPtr<Vector<Int> > > convSizes_p;
00188 Block <CountedPtr<Vector<Int> > > convSupportBlock_p;
00189 Matrix<Bool> pointingPix_p;
00190 VisBufferUtil vbUtil_p;
00191
00192 };
00193 };
00194 };
00195 #endif