casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
VisImagingWeight.h
Go to the documentation of this file.
00001 //# VisImagingWeight.h: Calculate Imaging Weights for a buffer from weight
00002 //# Copyright (C) 2009
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be adressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef VISIMAGINGWEIGHT_H
00030 #define VISIMAGINGWEIGHT_H
00031 #include <casa/aips.h>
00032 #include <casa/BasicSL/Complex.h>
00033 #include <casa/Quanta/Quantum.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 //#forward
00037 class ROVisibilityIterator;
00038 template<class T> class Matrix;
00039 template<class T> class Vector;
00040 
00041 // <summary>
00042 // Object to hold type of imaging weight scheme to be used on the fly and to provide
00043 // facilities to do that.
00044 // </summary>
00045 
00046 // <reviewed reviewer="" date="" tests="" demos="">
00047 
00048 // <prerequisite>
00049 // </prerequisite>
00050 //
00051 // <etymology>
00052 // </etymology>
00053 //
00054 // <synopsis>
00055 // </synopsis>
00056 //
00057 // <example>
00058 // <srcblock>
00059 // </srcblock>
00060 // </example>
00061 //
00062 // <motivation>
00063 // </motivation>
00064 //
00065 // <todo asof="">
00066 // </todo>
00067 
00068  class VisImagingWeight {
00069     public:
00070      //empty constructor
00071      VisImagingWeight();
00072      //Constructor to calculate natural and radial weights
00073      VisImagingWeight(const String& type);
00074      //Constructor to calculate uniform weight schemes; include Brigg's and super/uniform
00075      //If multiField=True, the weight density calcution is done on a per field basis, 
00076      //else it is all fields combined
00077      VisImagingWeight(ROVisibilityIterator& vi, const String& rmode, const Quantity& noise,
00078                                const Double robust, const Int nx, const Int ny,
00079                                const Quantity& cellx, const Quantity& celly,
00080                       const Int uBox, const Int vBox, const Bool multiField=False);
00081      virtual ~VisImagingWeight();
00082 
00083 
00084      // reference semantically = operator
00085      VisImagingWeight& operator=(const VisImagingWeight& imwgt);
00086 
00087 
00088 
00089      // Function to calculate the  uniform style weights, include Brigg's for example
00090      // imagingWeight should be sized by (nchan, row) already
00091      // The fieldid and msid parameters must correspond to what VisBuffer  or VisIter fieldId() and msId() returns
00092      virtual void weightUniform(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag, const Matrix<Double>& uvw,
00093                                 const Vector<Double>& frequency, const Vector<Float>& weight, const Int msid, const Int fieldid ) const;
00094 
00095      //Natural weighting scheme
00096      //imagingWeight should be sized by (nchan, row) already
00097      virtual void weightNatural(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag,
00098                                 const Vector<Float>& weight) const;
00099 
00100      //Radial weighting
00101      //imagingWeight should be sized by (nchan, row) already
00102      virtual void weightRadial(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag,
00103                                const Matrix<Double>& uvw, const Vector<Double>& frequency,
00104                                const Vector<Float>& weight) const;
00105 
00106      //Get the type of weighting this object is on..will return one of "natural", "uniform", "radial"
00107      virtual String getType() const;
00108      
00109      //setting uv filtering
00110      virtual void setFilter(const String& type, const Quantity& bmaj,
00111                             const Quantity& bmin, const Quantity& bpa);
00112 
00113      //returns if uv filtering is set
00114      virtual Bool doFilter() const;
00115 
00116      //do uvfiltering...to be called after imaging weight is calculated
00117      virtual void filter(Matrix<Float>& imWeight, const Matrix<Bool>& flag, 
00118                          const Matrix<Double>& uvw,
00119                          const Vector<Double>& frequency, const Vector<Float>& weight) const;
00120 
00121      // This is to  get/set uniform style weight density...e.g if the caller wants to
00122      // add densities from different pieces of data distributed via different 
00123      // VisibilityIterators
00124      virtual Bool getWeightDensity (Block<Matrix<Float> >& density);
00125      virtual void setWeightDensity(const Block<Matrix<Float> >& density);
00126 
00127     private:
00128 
00129      SimpleOrderedMap <String, Int> multiFieldMap_p;
00130      Block<Matrix<Float> > gwt_p;
00131      String wgtType_p;
00132      Float uscale_p, vscale_p;
00133      Vector<Float> f2_p, d2_p;
00134      Int uorigin_p, vorigin_p;
00135      Int nx_p, ny_p;
00136      Bool doFilter_p;
00137      Double cospa_p;
00138      Double sinpa_p;
00139      Double rbmaj_p;
00140      Double rbmin_p;
00141      Double robust_p;
00142      String rmode_p;
00143      Quantity noise_p;
00144 
00145 
00146  };
00147 } //# NAMESPACE CASA - END
00148 #endif // VISIMAGINGWEIGHT_H