casacore
Smooth.h
Go to the documentation of this file.
1 //# Smooth.h: smooth vectors and arrays
2 //# Copyright (C) 2010 by ESO (in the framework of the ALMA collaboration)
3 //# Copyright (C) 1996,1997,1998,1999,2000,2001
4 //# Associated Universities, Inc. Washington DC, USA.
5 //#
6 //# This library is free software; you can redistribute it and/or modify it
7 //# under the terms of the GNU Library General Public License as published by
8 //# the Free Software Foundation; either version 2 of the License, or (at your
9 //# option) any later version.
10 //#
11 //# This library is distributed in the hope that it will be useful, but WITHOUT
12 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 //# License for more details.
15 //#
16 //# You should have received a copy of the GNU Library General Public License
17 //# along with this library; if not, write to the Free Software Foundation,
18 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 //#
20 //# Correspondence concerning AIPS++ should be addressed as follows:
21 //# Internet email: aips2-request@nrao.edu.
22 //# Postal address: AIPS++ Project Office
23 //# National Radio Astronomy Observatory
24 //# 520 Edgemont Road
25 //# Charlottesville, VA 22903-2475 USA
26 //#
27 //# $Id$
28 
29 #ifndef SCIMATH_SMOOTH_H
30 #define SCIMATH_SMOOTH_H
31 
32 
33 //# Includes
34 #include <casacore/casa/aips.h>
35 #include <casacore/casa/Arrays/Vector.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 
40 // <summary>
41 // Smooth a Vector or the rows of a 2D Array taking into account
42 // flags which are supplied in a Vector/Array of the same shape.
43 // Modify the flags as necessary to mark channels for which the
44 // smoothing could not be done because needed channels were flagged.
45 // </summary>
46 
47 // <use visibility=export>
48 
49 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
50 // </reviewed>
51 
52 // <prerequisite>
53 // <li> <linkto class="Vector">Vector</linkto>
54 // <li> <linkto class="Array">Array</linkto>
55 // </prerequisite>
56 
57 // <etymology>
58 // self-explanatory
59 // </etymology>
60 
61 // <synopsis>
62 // Perform smoothing on Vectors or Arrays
63 // </synopsis>
64 
65 // <example>
66 // <srcBlock>
67 // Smooth<Complex>::hanning(outv, // the output
68 // outFlags, // the output mask
69 // yin, // the input
70 // yinFlags, // the input mask
71 // False, // for flagging: good is not true
72 // True); // use the default scheme for producing output flags
73 // </srcBlock>
74 // </example>
75 
76 // <motivation>
77 // This is used, e.g., for visibilities in spectral channel vectors.
78 // </motivation>
79 
80 // <todo asof="2010/07/27">
81 // <li>
82 // </todo>
83 
84 
85  template <class T>
86  class Smooth {
87 
88  Smooth(){};
89 
90  public:
91 
92  // Hanning smoothing
93  static void hanning(Vector<T>& out, Vector<Bool>& outmask,
95  Bool TrueIsGood, Bool relaxed=True);
96 
97  // as above but calling hanningSmooth for each row of the 2D array
98  static void hanning(Array<T>& out, Array<Bool>& outmask,
99  Array<T>& in, Array<Bool>& mask,
100  Bool TrueIsGood, Bool relaxed=True);
101  };
102 
103 
104 } //# NAMESPACE CASACORE - END
105 
106 #ifndef CASACORE_NO_AUTO_TEMPLATES
107 #include <casacore/scimath/Mathematics/Smooth.tcc>
108 #endif //# CASACORE_NO_AUTO_TEMPLATES
109 
110 #endif
111 
static void hanning(Vector< T > &out, Vector< Bool > &outmask, Vector< T > &in, Vector< Bool > &mask, Bool TrueIsGood, Bool relaxed=True)
Hanning smoothing.
static void hanning(Array< T > &out, Array< Bool > &outmask, Array< T > &in, Array< Bool > &mask, Bool TrueIsGood, Bool relaxed=True)
as above but calling hanningSmooth for each row of the 2D array
this file contains all the compiler specific defines
Definition: mainpage.dox:28
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool True
Definition: aipstype.h:43