casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LatticeTwoPtCorr.h
Go to the documentation of this file.
1 //# LatticeTwoPtCorr.h: compute two-point correlation functions from a lattice
2 //# Copyright (C) 1997,1998,1999,2000,2001,2003
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 addressed as follows:
20 //# Internet email: aips2-request@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 LATTICES_LATTICETWOPTCORR_H
30 #define LATTICES_LATTICETWOPTCORR_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 
40 template <class T> class MaskedLattice;
41 template <class T> class Lattice;
42 class IPosition;
43 class LogIO;
44 class String;
45 
46 // <summary>
47 // Compute two point auto-correlation functions from a lattice
48 // </summary>
49 
50 // <use visibility=export>
51 
52 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
53 // </reviewed>
54 
55 // <prerequisite>
56 // <li> <linkto class="MaskedLattice">MaskedLattice</linkto>
57 // </prerequisite>
58 
59 // <synopsis>
60 // This class allows you to compute two point correlation functions
61 // from lattices over planes of the specified two axes.
62 // At present, only autocorrelation is implemented and only
63 // the structure function is available.
64 //
65 // The structure function is
66 // <src>S(x,y) = < [lat(i,j) - lat(i+x,j+y)]**2 ></src>
67 // where x and y are absolute integer shifts (or lags).
68 // </synopsis>
69 // <example>
70 // <srcblock>
71 // </srcblock>
72 // </example>
73 
74 
75 // <todo asof="yyyy/mm/dd">
76 // <li> Add additional algorithms other than the structure function
77 // <li> Allow cross correlation algorithms as well as autocorrelation
78 // </todo>
79 
80 
81 template <class T> class LatticeTwoPtCorr
82 {
83 public:
84 
85 enum Method {
86 
87 // Undefined
89 
90 // Structure Function
92 
93 // nMethods
95 };
96 
97 
98 // Default constructor
100  {}
101 
102 // Destructor
104  {}
105 
106 // Compute specified autocorrelation function for the planes of the given TWO axes.
107 // If the output lattice has a mask, it will first be set to False (bad)
108 // and then any output pixel with some contributing values will be set to
109 // True (good).
110 // <group>
111  void autoCorrelation (MaskedLattice<T>& out, const MaskedLattice<T>& in,
112  const IPosition& axes, Method method,
113  Bool showProgress=True) const;
114 // </group>
115 
116 // Helper function to provide output lattice shape give the input shape
117 // and the axes to find the structure function over.
118  static IPosition setUpShape (const IPosition& inShape, const IPosition& axes);
119 
120 // Helper functions to convert method types to and from strings
121 // <group>
122  static Method fromString (const String& method);
123  static String toString (Method method);
124 // </group>
125 
126 private:
127 // Function Pointer typedef
128  typedef T (LatticeTwoPtCorr<T>::*FuncPtr)(T d1, T d2) const;
129 
130 // Do the iteration work
131  void autoCorrelation (MaskedLattice<T>& out, const MaskedLattice<T>& in,
132  const IPosition& axes,
133  FuncPtr,
134  Bool showProgress) const;
135 
136 // Check Output lattice shape
137  void check (LogIO& os, const MaskedLattice<T>& latOut,
138  const MaskedLattice<T>& latIn,
139  const IPosition& axes) const;
140 
141 // Compute structure function
142  T structureFunction (T d1, T d2) const {return (d1-d2)*(d1-d2);}
143 };
144 
145 
146 } //# NAMESPACE CASACORE - END
147 
148 #ifndef CASACORE_NO_AUTO_TEMPLATES
149 #include <casacore/lattices/LatticeMath/LatticeTwoPtCorr.tcc>
150 #endif //# CASACORE_NO_AUTO_TEMPLATES
151 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
static Method fromString(const String &method)
Helper functions to convert method types to and from strings.
T(LatticeTwoPtCorr< T >::* FuncPtr)(T d1, T d2) const
Function Pointer typedef.
A templated, abstract base class for array-like objects with masks.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
static String toString(Method method)
LatticeTwoPtCorr()
Default constructor.
Compute two point auto-correlation functions from a lattice.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
T structureFunction(T d1, T d2) const
Compute structure function.
void check(LogIO &os, const MaskedLattice< T > &latOut, const MaskedLattice< T > &latIn, const IPosition &axes) const
Check Output lattice shape.
static IPosition setUpShape(const IPosition &inShape, const IPosition &axes)
Helper function to provide output lattice shape give the input shape and the axes to find the structu...
void autoCorrelation(MaskedLattice< T > &out, const MaskedLattice< T > &in, const IPosition &axes, Method method, Bool showProgress=True) const
Compute specified autocorrelation function for the planes of the given TWO axes.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const Bool True
Definition: aipstype.h:43
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42