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
32
33namespace casacore { //# NAMESPACE CASACORE - BEGIN
34
35//# Forward Declarations
36
37template <class T> class MaskedLattice;
38template <class T> class Lattice;
39class IPosition;
40class LogIO;
41class String;
42
43// <summary>
44// Compute two point auto-correlation functions from a lattice
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="MaskedLattice">MaskedLattice</linkto>
54// </prerequisite>
55
56// <synopsis>
57// This class allows you to compute two point correlation functions
58// from lattices over planes of the specified two axes.
59// At present, only autocorrelation is implemented and only
60// the structure function is available.
61//
62// The structure function is
63// <src>S(x,y) = < [lat(i,j) - lat(i+x,j+y)]**2 ></src>
64// where x and y are absolute integer shifts (or lags).
65// </synopsis>
66// <example>
67// <srcblock>
68// </srcblock>
69// </example>
70
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
77
78template <class T> class LatticeTwoPtCorr
79{
80public:
81
82enum Method {
83
84// Undefined
86
87// Structure Function
89
90// nMethods
92};
93
94
95// Default constructor
98
99// Destructor
102
103// Compute specified autocorrelation function for the planes of the given TWO axes.
104// If the output lattice has a mask, it will first be set to False (bad)
105// and then any output pixel with some contributing values will be set to
106// True (good).
107// <group>
109 const IPosition& axes, Method method,
110 Bool showProgress=True) const;
111// </group>
112
113// Helper function to provide output lattice shape give the input shape
114// and the axes to find the structure function over.
115 static IPosition setUpShape (const IPosition& inShape, const IPosition& axes);
116
117// Helper functions to convert method types to and from strings
118// <group>
119 static Method fromString (const String& method);
120 static String toString (Method method);
121// </group>
122
123private:
124// Function Pointer typedef
125 typedef T (LatticeTwoPtCorr<T>::*FuncPtr)(T d1, T d2) const;
126
127// Do the iteration work
129 const IPosition& axes,
130 FuncPtr,
131 Bool showProgress) const;
132
133// Check Output lattice shape
134 void check (LogIO& os, const MaskedLattice<T>& latOut,
135 const MaskedLattice<T>& latIn,
136 const IPosition& axes) const;
137
138// Compute structure function
139 T structureFunction (T d1, T d2) const {return (d1-d2)*(d1-d2);}
140};
141
142
143} //# NAMESPACE CASACORE - END
144
145#ifndef CASACORE_NO_AUTO_TEMPLATES
146#include <casacore/lattices/LatticeMath/LatticeTwoPtCorr.tcc>
147#endif //# CASACORE_NO_AUTO_TEMPLATES
148#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:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41