casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef LATTICES_LATTICETWOPTCORR_H
27#define LATTICES_LATTICETWOPTCORR_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31
32namespace casacore { // # NAMESPACE CASACORE - BEGIN
33
34// # Forward Declarations
35
36template <class T>
37class MaskedLattice;
38template <class T>
39class Lattice;
40class IPosition;
41class LogIO;
42class String;
43
44// <summary>
45// Compute two point auto-correlation functions from a lattice
46// </summary>
47
48// <use visibility=export>
49
50// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
51// </reviewed>
52
53// <prerequisite>
54// <li> <linkto class="MaskedLattice">MaskedLattice</linkto>
55// </prerequisite>
56
57// <synopsis>
58// This class allows you to compute two point correlation functions
59// from lattices over planes of the specified two axes.
60// At present, only autocorrelation is implemented and only
61// the structure function is available.
62//
63// The structure function is
64// <src>S(x,y) = < [lat(i,j) - lat(i+x,j+y)]**2 ></src>
65// where x and y are absolute integer shifts (or lags).
66// </synopsis>
67// <example>
68// <srcblock>
69// </srcblock>
70// </example>
71
72// <todo asof="yyyy/mm/dd">
73// <li> Add additional algorithms other than the structure function
74// <li> Allow cross correlation algorithms as well as autocorrelation
75// </todo>
76
77template <class T>
79 public:
80 enum Method {
81
82 // Undefined
84
85 // Structure Function
87
88 // nMethods
90 };
91
92 // Default constructor
94
95 // Destructor
97
98 // Compute specified autocorrelation function for the planes of the given TWO axes.
99 // If the output lattice has a mask, it will first be set to False (bad)
100 // and then any output pixel with some contributing values will be set to
101 // True (good).
102 // <group>
104 Method method, Bool showProgress = True) const;
105 // </group>
106
107 // Helper function to provide output lattice shape give the input shape
108 // and the axes to find the structure function over.
109 static IPosition setUpShape(const IPosition& inShape, const IPosition& axes);
110
111 // Helper functions to convert method types to and from strings
112 // <group>
113 static Method fromString(const String& method);
114 static String toString(Method method);
115 // </group>
116
117 private:
118 // Function Pointer typedef
119 typedef T (LatticeTwoPtCorr<T>::*FuncPtr)(T d1, T d2) const;
120
121 // Do the iteration work
123 FuncPtr, Bool showProgress) const;
124
125 // Check Output lattice shape
126 void check(LogIO& os, const MaskedLattice<T>& latOut, const MaskedLattice<T>& latIn,
127 const IPosition& axes) const;
128
129 // Compute structure function
130 T structureFunction(T d1, T d2) const { return (d1 - d2) * (d1 - d2); }
131};
132
133} // namespace casacore
134
135#ifndef CASACORE_NO_AUTO_TEMPLATES
136#include <casacore/lattices/LatticeMath/LatticeTwoPtCorr.tcc>
137#endif // # CASACORE_NO_AUTO_TEMPLATES
138#endif
static String toString(Method method)
void autoCorrelation(MaskedLattice< T > &out, const MaskedLattice< T > &in, const IPosition &axes, FuncPtr, Bool showProgress) const
Do the iteration work.
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.
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...
T structureFunction(T d1, T d2) const
Compute structure function.
static Method fromString(const String &method)
Helper functions to convert method types to and from strings.
@ STRUCTUREFUNCTION
Structure Function.
LatticeTwoPtCorr()
Default constructor.
T(LatticeTwoPtCorr< T >::* FuncPtr)(T d1, T d2) const
Function Pointer typedef.
void check(LogIO &os, const MaskedLattice< T > &latOut, const MaskedLattice< T > &latIn, const IPosition &axes) const
Check Output lattice shape.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41