casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Smooth.h
Go to the documentation of this file.
00001 //# Smooth.h: smooth vectors and arrays 
00002 //# Copyright (C) 2010 by ESO (in the framework of the ALMA collaboration)
00003 //# Copyright (C) 1996,1997,1998,1999,2000,2001
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id: Smooth.h 21051 2011-04-20 11:46:29Z gervandiepen $
00028 
00029 #ifndef SCIMATH_SMOOTH_H
00030 #define SCIMATH_SMOOTH_H
00031 
00032 
00033 //# Includes
00034 #include <casa/aips.h>
00035 #include <casa/Arrays/Vector.h>
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 
00040 // <summary>
00041 // Smooth a Vector or the rows of a 2D Array taking into account
00042 // flags which are supplied in a Vector/Array of the same shape.
00043 // Modify the flags as necessary to mark channels for which the
00044 // smoothing could not be done because needed channels were flagged.
00045 // </summary>
00046 
00047 // <use visibility=export>
00048 
00049 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00050 // </reviewed>
00051 
00052 // <prerequisite>
00053 //   <li> <linkto class="Vector">Vector</linkto>
00054 //   <li> <linkto class="Array">Array</linkto>
00055 // </prerequisite>
00056 
00057 // <etymology>
00058 // self-explanatory
00059 // </etymology>
00060 
00061 // <synopsis>
00062 // Perform smoothing on Vectors or Arrays
00063 // </synopsis>
00064 
00065 // <example>
00066 // <srcBlock>
00067 //    Smooth<Complex>::hanning(outv, // the output
00068 //                             outFlags, // the output mask
00069 //                             yin, // the input
00070 //                             yinFlags, // the input mask
00071 //                             False,  // for flagging: good is not true
00072 //                             True); // use the default scheme for producing output flags 
00073 // </srcBlock>
00074 // </example>
00075 
00076 // <motivation>
00077 // This is used, e.g., for visibilities in spectral channel vectors.
00078 // </motivation>
00079 
00080 // <todo asof="2010/07/27">
00081 //   <li> 
00082 // </todo>
00083  
00084 
00085   template <class T>
00086   class Smooth {
00087 
00088   Smooth(){}; 
00089   
00090   public:
00091   
00092   // Hanning smoothing
00093   static void hanning(Vector<T>& out, Vector<Bool>& outmask, 
00094                       Vector<T>& in, Vector<Bool>& mask, 
00095                       Bool TrueIsGood, Bool relaxed=True);
00096   
00097   // as above but calling hanningSmooth for each row of the 2D array
00098   static void hanning(Array<T>& out, Array<Bool>& outmask, 
00099                       Array<T>& in, Array<Bool>& mask, 
00100                       Bool TrueIsGood, Bool relaxed=True);
00101   };
00102   
00103   
00104 } //# NAMESPACE CASA - END
00105 
00106 #ifndef CASACORE_NO_AUTO_TEMPLATES
00107 #include <scimath/Mathematics/Smooth.tcc>
00108 #endif //# CASACORE_NO_AUTO_TEMPLATES
00109 
00110 #endif
00111