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 Library 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 Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library 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: casa-feedback@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_HETARRAYCONVFUNC_H 29 : #define SYNTHESIS_HETARRAYCONVFUNC_H 30 : 31 : #include <synthesis/TransformMachines/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 : class VisBuffer; 61 : class MosaicFT; 62 : class HetArrayConvFunc : public SimplePBConvFunc 63 : 64 : { 65 : public: 66 : HetArrayConvFunc(); 67 : HetArrayConvFunc(const PBMathInterface::PBClass 68 : typeToUse, const casacore::String vpTable=""); 69 : //Constructor from record 70 : //if for prediction only no need to recover fluxscale 71 : HetArrayConvFunc(const casacore::RecordInterface& rec, casacore::Bool calcFluxscale); 72 : virtual ~HetArrayConvFunc(); 73 : 74 : //Returns the convfunctions in the Arrays...the rowMap maps the vb.row 75 : //to the plane of the convfunc appropriate...chanMap and polMap similarly 76 : 77 : virtual void findConvFunction(const casacore::ImageInterface<casacore::Complex>& iimage, 78 : const VisBuffer& vb, 79 : const casacore::Int& convSampling, 80 : const casacore::Vector<casacore::Double>& visFreq, 81 : casacore::Array<casacore::Complex>& convFunc, 82 : casacore::Array<casacore::Complex>& weightConvFunc, 83 : casacore::Vector<casacore::Int>& convsize, 84 : casacore::Vector<casacore::Int>& convSupport, 85 : casacore::Vector<casacore::Int>& polMap, casacore::Vector<casacore::Int>& chanMap, casacore::Vector<casacore::Int>& rowMap, 86 : const casacore::Bool conjugateFreqFuncs=false); 87 : 88 : virtual casacore::ImageInterface<casacore::Float>& getFluxScaleImage(); 89 : // slice flux scale images 90 : virtual void sliceFluxScale(const casacore::Int npol); 91 : //Serialization 92 : virtual casacore::Bool toRecord(casacore::RecordInterface& rec); 93 : virtual casacore::Bool fromRecord(casacore::String& err, const casacore::RecordInterface& rec, casacore::Bool calcFluxscale=false); 94 : virtual void reset(); 95 0 : virtual casacore::String name() {return casacore::String("HetArrayConvFunc");} 96 : //---------------------------------------------- 97 : 98 : private: 99 : void applyGradientToYLine(const casacore::Int iy, casacore::Complex*& convFunctions, 100 : casacore::Complex*& convWeights, const casacore::Double pixXdir, const casacore::Double pixYdir, 101 : casacore::Int convSize, const casacore::Int ndishpair, const casacore::Int nchan, const casacore::Int nPol); 102 : casacore::Int factorial(casacore::Int n); 103 : // the return value are -1 or false for not in cache yet but pointing direction 104 : //seems to be inside image 105 : // 1 if value is cached..we have stopped caching..so it should not return this value 106 : // 2 pointing is off image ...thus valid but not useful 107 : casacore::Int checkPBOfField(const VisBuffer& vb, casacore::Vector<casacore::Int>& rowMap); 108 : void findAntennaSizes(const VisBuffer& vb); 109 : void supportAndNormalize(casacore::Int plane, casacore::Int convSampling); 110 : void supportAndNormalizeLatt(casacore::Int plane, casacore::Int convSampling, casacore::TempLattice<casacore::Complex>& convFuncLat, 111 : casacore::TempLattice<casacore::Complex>& weightConvFuncLat); 112 : void init(const PBMathInterface::PBClass typeToUse); 113 : void makerowmap(const VisBuffer& vb, casacore::Vector<casacore::Int>& rowMap); 114 : 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); 115 : casacore::Float sinc(const casacore::Float x) ; 116 : casacore::Array<casacore::Complex> resample(const casacore::Array<casacore::Complex>& inarray, const casacore::Double factor); 117 : PBMathInterface::PBClass pbClass_p; 118 : //std::map <casacore::String, casacore::Int> convFunctionMap_p; 119 : casacore::Vector<casacore::Int64> convFunctionMap_p; 120 : casacore::Int64 nDefined_p; 121 : std::map <casacore::String, casacore::Int> antDiam2IndexMap_p; 122 : casacore::Vector<casacore::Int> antIndexToDiamIndex_p; 123 : casacore::Block<casacore::CountedPtr<PBMathInterface> > antMath_p; 124 : casacore::Int msId_p; 125 : casacore::Int actualConvIndex_p; 126 : casacore::Array<casacore::Complex> convFunc_p; 127 : casacore::Array<casacore::Complex> weightConvFunc_p; 128 : casacore::Array<casacore::Complex> convSave_p; 129 : casacore::Array<casacore::Complex> weightSave_p; 130 : casacore::Int convSize_p; 131 : casacore::String vpTable_p; 132 : casacore::Vector<casacore::Int> convSupport_p; 133 : casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convFunctions_p; 134 : casacore::Block <casacore::CountedPtr<casacore::Array<casacore::Complex> > > convWeights_p; 135 : casacore::Block<casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSizes_p; 136 : casacore::Block <casacore::CountedPtr<casacore::Vector<casacore::Int> > > convSupportBlock_p; 137 : 138 : }; 139 : 140 : } // end namespace casa 141 : #endif