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 #include <msvis/MSVis/VisibilityIterator2.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 //#forward
00038 class ROVisibilityIterator;
00039 template<class T> class Matrix;
00040 template<class T> class Vector;
00041 
00042 // <summary>
00043 // Object to hold type of imaging weight scheme to be used on the fly and to provide
00044 // facilities to do that.
00045 // </summary>
00046 
00047 // <reviewed reviewer="" date="" tests="" demos="">
00048 
00049 // <prerequisite>
00050 // </prerequisite>
00051 //
00052 // <etymology>
00053 // </etymology>
00054 //
00055 // <synopsis>
00056 // </synopsis>
00057 //
00058 // <example>
00059 // <srcblock>
00060 // </srcblock>
00061 // </example>
00062 //
00063 // <motivation>
00064 // </motivation>
00065 //
00066 // <todo asof="">
00067 // </todo>
00068 
00069  class VisImagingWeight {
00070     public:
00071      //empty constructor
00072      VisImagingWeight();
00073      //Constructor to calculate natural and radial weights
00074      VisImagingWeight(const String& type);
00075      //Constructor to calculate uniform weight schemes; include Brigg's and super/uniform
00076      //If multiField=True, the weight density calcution is done on a per field basis, 
00077      //else it is all fields combined
00078      VisImagingWeight(ROVisibilityIterator& vi, const String& rmode, const Quantity& noise,
00079                                const Double robust, const Int nx, const Int ny,
00080                                const Quantity& cellx, const Quantity& celly,
00081                       const Int uBox, const Int vBox, const Bool multiField=False);
00082      //Constructor for uniform style weighting when the weight density is calculated 
00083      //elsewhere
00084      VisImagingWeight(ROVisibilityIterator& vi, Block<Matrix<Float> >& grids, const String& rmode, const Quantity& noise,
00085                                      const Double robust, const Quantity& cellx, const Quantity& celly,
00086                       const Bool multiField=False) ;
00087      //VisibilityIterator2 version of the above....
00088      // Note the VisibilityIterator can be readonly...thus recommended if you can
00089      // as that will prevent unnecessary locks
00090      VisImagingWeight(vi::VisibilityIterator2& vi, const String& rmode, const Quantity& noise,
00091                                const Double robust, const Int nx, const Int ny,
00092                                const Quantity& cellx, const Quantity& celly,
00093                       const Int uBox, const Int vBox, const Bool multiField=False);
00094 
00095      virtual ~VisImagingWeight();
00096 
00097 
00098      // reference semantically = operator
00099      VisImagingWeight& operator=(const VisImagingWeight& imwgt);
00100 
00101 
00102 
00103      // Function to calculate the  uniform style weights, include Brigg's for example
00104      // imagingWeight should be sized by (nchan, row) already
00105      // The fieldid and msid parameters must correspond to what VisBuffer  or VisIter fieldId() and msId() returns
00106      virtual void weightUniform(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag, const Matrix<Double>& uvw,
00107                                 const Vector<Double>& frequency, const Matrix<Float>& weight, const Int msid, const Int fieldid ) const;
00108 
00109      //Natural weighting scheme
00110      //imagingWeight should be sized by (nchan, row) already
00111      virtual void weightNatural(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag,
00112                                 const Matrix<Float>& weight) const;
00113 
00114    /*  unused version?
00115      //weight as Matrix version
00116      virtual void weightNatural(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag,
00117                                 const Matrix<Float>& weight) const;
00118 
00119    */
00120      //Radial weighting
00121      //imagingWeight should be sized by (nchan, row) already
00122      virtual void weightRadial(Matrix<Float>& imagingWeight, const Matrix<Bool>& flag,
00123                                const Matrix<Double>& uvw, const Vector<Double>& frequency,
00124                                const Matrix<Float>& weight) const;
00125 
00126      //Get the type of weighting this object is on..will return one of "natural", "uniform", "radial"
00127      virtual String getType() const;
00128      
00129      //setting uv filtering
00130      virtual void setFilter(const String& type, const Quantity& bmaj,
00131                             const Quantity& bmin, const Quantity& bpa);
00132 
00133      //returns if uv filtering is set
00134      virtual Bool doFilter() const;
00135 
00136      //do uvfiltering...to be called after imaging weight is calculated
00137      virtual void filter(Matrix<Float>& imWeight, const Matrix<Bool>& flag, 
00138                          const Matrix<Double>& uvw,
00139                          const Vector<Double>& frequency, const Matrix<Float>& weight) const;
00140 
00141      // This is to  get/set uniform style weight density...e.g if the caller wants to
00142      // add densities from different pieces of data distributed via different 
00143      // VisibilityIterators
00144      virtual Bool getWeightDensity (Block<Matrix<Float> >& density);
00145      virtual void setWeightDensity(const Block<Matrix<Float> >& density);
00146 
00147      // Form corr-indep weight by averaging parallel-hand weights
00148      void unPolChanWeight(Matrix<Float>& chanRowWt, const Cube<Float>& corrChanRowWt) const;
00149 
00150     private:
00151      void cube2Matrix(const Cube<Bool>& fcube, Matrix<Bool>& fMat);
00152      SimpleOrderedMap <String, Int> multiFieldMap_p;
00153      Block<Matrix<Float> > gwt_p;
00154      String wgtType_p;
00155      Float uscale_p, vscale_p;
00156      Vector<Float> f2_p, d2_p;
00157      Int uorigin_p, vorigin_p;
00158      Int nx_p, ny_p;
00159      Bool doFilter_p;
00160      Double cospa_p;
00161      Double sinpa_p;
00162      Double rbmaj_p;
00163      Double rbmin_p;
00164      Double robust_p;
00165      String rmode_p;
00166      Quantity noise_p;
00167 
00168 
00169  };
00170 } //# NAMESPACE CASA - END
00171 #endif // VISIMAGINGWEIGHT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1