Line data Source code
1 : //# HetArrayConvFunc.h: Definition for HetArrayConvFunc 2 : //# Copyright (C) 2008 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be adressed as follows: 20 : //# Internet email: aips2-request@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : //# $Id$ 28 : #ifndef SYNTHESIS_TRANSFORM2_HETARRAYCONVFUNC_H 29 : #define SYNTHESIS_TRANSFORM2_HETARRAYCONVFUNC_H 30 : 31 : #include <synthesis/TransformMachines2/SimplePBConvFunc.h> 32 : #include <casacore/casa/Arrays/ArrayFwd.h> 33 : 34 : namespace casacore{ 35 : 36 : template<class T> class ImageInterface; 37 : 38 : } 39 : 40 : namespace casa { 41 : 42 : // <summary> A class to support FTMachines get their convolution casacore::Function </summary> 43 : 44 : // <use visibility=export> 45 : // <prerequisite> 46 : // <li> <linkto class=VisBuffer>VisBuffer</linkto> module 47 : // </prerequisite> 48 : // <etymology> 49 : // "HetArray" for Heterogeneous casacore::Array => different dish sizes 50 : // "ConvFunc" for Convolution Functions 51 : // appropriate convfunctions for each pair of antenna generated and cached 52 : // </etymology> 53 : // 54 : // <synopsis> 55 : // FTMachines like WProjection and MosaicFT need convolution functions to 56 : // deal with directional dependent issues... 57 : // this class and related ones provide and cache such functions for re-use 58 : //</synopsis> 59 : //Forward declarations 60 : namespace vi{class VisBuffer2;} 61 : namespace refim{ 62 : 63 : class HetArrayConvFunc : public SimplePBConvFunc 64 : 65 : { 66 : public: 67 : HetArrayConvFunc(); 68 : HetArrayConvFunc(const PBMathInterface::PBClass 69 : typeToUse, const casacore::String vpTable=""); 70 : //Constructor from record 71 : //if for prediction only no need to recover fluxscale 72 : HetArrayConvFunc(const casacore::RecordInterface& rec, casacore::Bool calcFluxscale); 73 : virtual ~HetArrayConvFunc(); 74 : 75 : //Returns the convfunctions in the Arrays...the rowMap maps the vb.row 76 : //to the plane of the convfunc appropriate...chanMap and polMap similarly 77 : 78 : virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>& iimage, 79 : const vi::VisBuffer2& vb, 80 : const casacore::Int& convSampling, 81 : const casacore::Vector<casacore::Double>& visFreq, 82 : casacore::Array<casacore::Complex>& convFunc, 83 : casacore::Array<casacore::Complex>& weightConvFunc, 84 : casacore::Vector<casacore::Int>& convsize, 85 : casacore::Vector<casacore::Int>& convSupport, 86 : casacore::Vector<casacore::Int>& polMap, casacore::Vector<casacore::Int>& chanMap, casacore::Vector<casacore::Int>& rowMap, 87 : const casacore::Bool getConjConvFuncs=false, 88 : const casacore::MVDirection& extraShift=casacore::MVDirection(0.0), const casacore::Bool useExtraShift=casacore::False 89 : ); 90 : 91 : virtual casacore::ImageInterface<casacore::Float>& getFluxScaleImage(); 92 : // slice flux scale images 93 : virtual void sliceFluxScale(const casacore::Int npol); 94 : //Serialization 95 : virtual casacore::Bool toRecord(casacore::RecordInterface& rec); 96 : virtual casacore::Bool fromRecord(casacore::String& err, const casacore::RecordInterface& rec, casacore::Bool calcFluxscale=false); 97 : virtual void reset(); 98 0 : virtual casacore::String name() {return casacore::String("HetArrayConvFunc");} 99 : //---------------------------------------------- 100 : 101 : private: 102 : void applyGradientToYLine(const casacore::Int iy, casacore::Complex*& convFunctions, 103 : casacore::Complex*& convWeights, const casacore::Double pixXdir, const casacore::Double pixYdir, 104 : casacore::Int convSize, const casacore::Int ndishpair, const casacore::Int nchan, const casacore::Int nPol); 105 : void fillConjConvFunc(const casacore::Vector<casacore::Double>& beamFreqs); 106 : casacore::Int conjSupport(const casacore::Vector<casacore::Double>& beamFreqs); 107 : casacore::Int factorial(casacore::Int n); 108 : // the return value are -1 or false for not in cache yet but pointing direction 109 : //seems to be inside image 110 : // 1 if value is cached..we have stopped caching..so it should not return this value 111 : // 2 pointing is off image ...thus valid but not useful 112 : casacore::Int checkPBOfField(const vi::VisBuffer2& vb, casacore::Vector<casacore::Int>& rowMap, const casacore::MVDirection& extraShift=casacore::MVDirection(0.0), const casacore::Bool useExtraShift=casacore::False); 113 : void findAntennaSizes(const vi::VisBuffer2& vb); 114 : void supportAndNormalize(casacore::Int plane, casacore::Int convSampling); 115 : void supportAndNormalizeLatt(casacore::Int plane, casacore::Int convSampling, casacore::TempLattice<casacore::Complex>& convFuncLat, 116 : casacore::TempLattice<casacore::Complex>& weightConvFuncLat); 117 : void init(const PBMathInterface::PBClass typeToUse); 118 : void makerowmap(const vi::VisBuffer2& vb, casacore::Vector<casacore::Int>& rowMap); 119 : casacore::Float interpLanczos( const casacore::Double& x , const casacore::Double& y, const casacore::Double& nx, const casacore::Double& ny, const casacore::Float* data, const casacore::Float a=3); 120 : casacore::Float sinc(const casacore::Float x) ; 121 : casacore::Array<casacore::Complex> resample(const casacore::Array<casacore::Complex>& inarray, const casacore::Double factor); 122 : casacore::Matrix<casacore::Complex> resample2(const casacore::Matrix<casacore::Complex>& inarray, const casacore::Double factor); 123 : PBMathInterface::PBClass pbClass_p; 124 : //std::map <casacore::String, casacore::Int> convFunctionMap_p; 125 : casacore::Vector<casacore::Int64> convFunctionMap_p; 126 : casacore::Int64 nDefined_p; 127 : std::map<casacore::String, casacore::Int> antDiam2IndexMap_p; 128 : casacore::Vector<casacore::Int> antIndexToDiamIndex_p; 129 : casacore::Block<casacore::CountedPtr<PBMathInterface> > antMath_p; 130 : casacore::Int msId_p; 131 : casacore::Int actualConvIndex_p; 132 : casacore::Array<casacore::Complex> convFunc_p; 133 : casacore::Array<casacore::Complex> weightConvFunc_p; 134 : casacore::Array<casacore::Complex> convSave_p; 135 : casacore::Array<casacore::Complex> weightSave_p; 136 : casacore::Int convSize_p; 137 : casacore::String vpTable_p; 138 : casacore::Vector<casacore::Int> convSupport_p; 139 : casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convFunctions_p; 140 : casacore::Block < casacore::CountedPtr<casacore::Array<casacore::Complex> > > convFunctionsConjFreq_p; 141 : casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convWeights_p; 142 : casacore::Block<casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSizes_p; 143 : casacore::Block <casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSupportBlock_p; 144 : 145 : }; 146 : }; //end of namespace refim 147 : } // end namespace casa 148 : #endif