Line data Source code
1 : //# ConvolutionFunction.h: Definition for ConvolutionFunction 2 : //# Copyright (C) 1996,1997,1998,1999,2000,2002 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 : 29 : #ifndef SYNTHESIS_CONVOLUTIONFUNCTION_H 30 : #define SYNTHESIS_CONVOLUTIONFUNCTION_H 31 : 32 : #include <synthesis/TransformMachines/CFStore.h> 33 : #include <synthesis/TransformMachines/CFStore2.h> 34 : #include <synthesis/TransformMachines/CFTerms.h> 35 : #include <synthesis/TransformMachines/PolOuterProduct.h> 36 : #include <synthesis/TransformMachines/Utils.h> 37 : #include <casacore/images/Images/ImageInterface.h> 38 : #include <casacore/images/Images/TempImage.h> 39 : #include <casacore/casa/Logging/LogOrigin.h> 40 : #include <casacore/casa/Logging/LogSink.h> 41 : #include <casacore/casa/Logging/LogIO.h> 42 : #include <casacore/casa/Arrays/Vector.h> 43 : #define CF_TYPE casacore::Double 44 : 45 : namespace casa{ 46 : // <summary> 47 : // The base class to compute convolution functions for convolutional gridding. 48 : // </summary> 49 : 50 : // <use visibility=export> 51 : // <prerequisite> 52 : // </prerequisite> 53 : // <etymology> 54 : // Class to encapsulate the convolution function for convolutional gridding. 55 : // </etymology> 56 : // 57 : // <synopsis> Standard method of re-sampling data to or from a 58 : // 59 : // regular grid is done by convolutional gridding. This requires a 60 : // convolution function which a finte support size and well behaved 61 : // function in the Fourier domain. For standard gridding, the 62 : // Prolate Spheroidal function are used. Convolution functions 63 : // used in casacore::Projection algorithms (like W-casacore::Projection, A-casacore::Projection, 64 : // etc. and their combinations) each require potentially different 65 : // mechanisms to compute. These are implemented in separate 66 : // classes in the Synthesis module. Since these are used in common 67 : // framework for gridding and de-gridding, these are all derived 68 : // from a common base class. ConvolutionFunction (this class) is 69 : // that base class. 70 : // 71 : // Most of the methods in this base class are pure virtual. I.e., 72 : // only surviving offsprings (derived classes) of this class will 73 : // be those that will have the wisdom that they methods represent. 74 : // 75 : // </synopsis> 76 : 77 : class ConvolutionFunction 78 : { 79 : public: 80 24 : ConvolutionFunction():logIO_p(), computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1) {}; 81 : ConvolutionFunction(casacore::Int dim): computeCFAngleRad_p(360.0*M_PI/180.0), rotateCFOTFAngleRad_p(0.1) {nDim=dim;}; 82 : virtual ~ConvolutionFunction(); 83 : 84 : // Set the dimention of the convolution function. 85 0 : virtual void setDimension(casacore::Int n){nDim = n;}; 86 : 87 : // Given the pixel co-ordinates and an offset values, this returns 88 : // the value of the convolution function. This is however not 89 : // used anywhere yet (and is therefore also not a pure virtual 90 : // function). 91 0 : virtual CF_TYPE getValue(casacore::Vector<CF_TYPE>& , casacore::Vector<CF_TYPE>& ) {return 0.0;}; 92 : 93 : // A support function which, for now, returns and integer ID 94 : // corresponding to the on-sky frequency of the supplied VisBuffer. 95 : virtual int getVisParams(const VisBuffer& vb,const casacore::CoordinateSystem& skyCoord=casacore::CoordinateSystem())=0; 96 : 97 : // This method computes the convolution function and the 98 : // convolution function used for gridding the weights (typically 99 : // these are the same) and returns them in the cfs and cfwts 100 : // parameters. The required information about the image and 101 : // visibility parameters is dervided from the given image and 102 : // VisBuffer objects. wConvSize is the number of w-term planes 103 : // and pa is the Parallactic Angle in radians for which the 104 : // convolution function(s) are computed. 105 : virtual void makeConvFunction(const casacore::ImageInterface<casacore::Complex>& image, 106 : const VisBuffer& vb, 107 : const casacore::Int wConvSize, 108 : const casacore::CountedPtr<PolOuterProduct>& pop, 109 : const casacore::Float pa, 110 : const casacore::Float dpa, 111 : const casacore::Vector<casacore::Double>& uvScale, const casacore::Vector<casacore::Double>& uvOffset, 112 : const casacore::Matrix<casacore::Double>& vbFreqSelection, 113 : CFStore2& cfs, 114 : CFStore2& cfwts, 115 : casacore::Bool fillCF=true) = 0; 116 : // This method computes the average response function. This is 117 : // typically image-plane equivalent of the convolution functions, 118 : // averaged over various axis. The precise averaging will be 119 : // implementation dependent in the derived classes. 120 : virtual casacore::Bool makeAverageResponse(const VisBuffer& vb, 121 : const casacore::ImageInterface<casacore::Complex>& image, 122 : casacore::ImageInterface<casacore::Float>& theavgPB, 123 : casacore::Bool reset=true) = 0; 124 : virtual casacore::Bool makeAverageResponse(const VisBuffer& vb, 125 : const casacore::ImageInterface<casacore::Complex>& image, 126 : casacore::ImageInterface<casacore::Complex>& theavgPB, 127 : casacore::Bool reset=true) = 0; 128 : 129 : // 130 : virtual void setPolMap(const casacore::Vector<casacore::Int>& polMap) = 0; 131 0 : virtual void setSpwSelection(const casacore::Cube<casacore::Int>& spwChanSelFlag) {spwChanSelFlag_p.assign(spwChanSelFlag);} 132 0 : virtual void setSpwFreqSelection(const casacore::Matrix<casacore::Double>& spwFreqSel) {spwFreqSelection_p.assign(spwFreqSel);} 133 0 : virtual void setRotateCF(const casacore::Double& computeCFAngleRad, const casacore::Double& rotateOTF) 134 0 : {computeCFAngleRad_p=computeCFAngleRad; rotateCFOTFAngleRad_p = rotateOTF;}; 135 : 136 : // virtual void setFeedStokes(const casacore::Vector<casacore::Int>& feedStokes) = 0; 137 : virtual casacore::Bool findSupport(casacore::Array<casacore::Complex>& func, casacore::Float& threshold,casacore::Int& origin, casacore::Int& R)=0; 138 : virtual casacore::Vector<casacore::Double> findPointingOffset(const casacore::ImageInterface<casacore::Complex>& image, 139 : const VisBuffer& vb) = 0; 140 : 141 : // virtual void setParams(const casacore::Vector<casacore::Int>& polMap, const casacore::Vector<casacore::Int>& feedStokes) 142 : // {setPolMap(polMap); setFeedStokes(feedStokes);}; 143 : 144 : // virtual void prepareConvFunction(const VisBuffer& vb, CFStore2& cfs)=0; 145 : virtual void prepareConvFunction(const VisBuffer& vb, VBRow2CFBMapType& theMap)=0; 146 : virtual casacore::Matrix<casacore::Int> makeBaselineList(const casacore::Vector<casacore::Int>& antList); 147 0 : virtual casacore::Int mapAntIDToAntType(const casacore::Int& /*ant*/) {return 0;}; 148 0 : virtual void setMiscInfo(const casacore::RecordInterface& /*params*/) {}; 149 0 : virtual casacore::CountedPtr<CFTerms> getTerm(const casacore::String& /*name*/) {return NULL;} 150 : private: 151 : casacore::Int nDim; 152 : protected: 153 : casacore::LogIO& logIO() {return logIO_p;} 154 : casacore::LogIO logIO_p; 155 : casacore::Cube<casacore::Int> spwChanSelFlag_p; 156 : casacore::Matrix<casacore::Double> spwFreqSelection_p; 157 : casacore::Double computeCFAngleRad_p, rotateCFOTFAngleRad_p; 158 : }; 159 : 160 : }; 161 : 162 : #endif