casa
5.7.0-16
|
A Multi-dimensional Gaussian functional. More...
#include <GaussianND.h>
Public Member Functions | |
GaussianND () | |
Makes a Gaussian using the indicated height, mean, variance & covariance. More... | |
GaussianND (uInt ndim) | |
GaussianND (uInt ndim, const T &height) | |
GaussianND (uInt ndim, const T &height, const Vector< T > &mean) | |
GaussianND (uInt ndim, const T &height, const Vector< T > &mean, const Vector< T > &variance) | |
GaussianND (uInt ndim, const T &height, const Vector< T > &mean, const Matrix< T > &covar) | |
GaussianND (const GaussianND &other) | |
Copy constructor (deep copy) More... | |
GaussianND< T > & | operator= (const GaussianND< T > &other) |
Copy assignment (deep copy) More... | |
virtual | ~GaussianND () |
Destructor. More... | |
virtual T | eval (typename Function< T >::FunctionArg x) const |
Evaluate the Gaussian at x . More... | |
virtual Function< T > * | clone () const |
Return a copy of this object from the heap. More... | |
Public Member Functions inherited from casacore::GaussianNDParam< T > | |
GaussianNDParam () | |
Constructs a Gaussian using the indicated height, mean, variance & covariance. More... | |
GaussianNDParam (uInt ndim) | |
GaussianNDParam (uInt ndim, const T &height) | |
GaussianNDParam (uInt ndim, const T &height, const Vector< T > &mean) | |
GaussianNDParam (uInt ndim, const T &height, const Vector< T > &mean, const Vector< T > &variance) | |
GaussianNDParam (uInt ndim, const T &height, const Vector< T > &mean, const Matrix< T > &covar) | |
GaussianNDParam (const GaussianNDParam &other) | |
Copy constructor (deep copy) More... | |
template<class W > | |
GaussianNDParam (const GaussianNDParam< W > &other) | |
GaussianNDParam< T > & | operator= (const GaussianNDParam< T > &other) |
Copy assignment (deep copy) More... | |
virtual | ~GaussianNDParam () |
Destructor. More... | |
virtual const String & | name () const |
Give name of function. More... | |
virtual uInt | ndim () const |
Variable dimensionality. More... | |
T | height () const |
Get or set the peak height of the Gaussian. More... | |
void | setHeight (const T &height) |
T | flux () const |
The analytical integrated area underneath the Gaussian. More... | |
void | setFlux (const T &flux) |
Vector< T > | mean () const |
The center ordinate of the Gaussian. More... | |
void | setMean (const Vector< T > &mean) |
Vector< T > | variance () const |
The FWHM of the Gaussian is sqrt(8*variance*log(2)) . More... | |
void | setVariance (const Vector< T > &variance) |
Matrix< T > | covariance () const |
The covariance Matrix defines the correlations between all the axes. More... | |
void | setCovariance (const Matrix< T > &covar) |
Public Member Functions inherited from casacore::Function< T > | |
Function () | |
Constructors. More... | |
Function (const uInt n) | |
Function (const Vector< T > &in) | |
Function (const FunctionParam< T > &other) | |
Function (const Function< W, X > &other) | |
Function (const Function< T, U > &other) | |
virtual | ~Function () |
Destructor. More... | |
uInt | nparameters () const |
Returns the number of parameters. More... | |
virtual U | eval (FunctionArg x) const =0 |
Evaluate the function object. More... | |
T & | operator[] (const uInt n) |
Manipulate the nth parameter (0-based) with no index check. More... | |
const T & | operator[] (const uInt n) const |
virtual U | operator() () const |
Evaluate this function object at x or at x, y . More... | |
virtual U | operator() (const ArgType &x) const |
virtual U | operator() (const Vector< ArgType > &x) const |
virtual U | operator() (FunctionArg x) const |
virtual U | operator() (const ArgType &x, const ArgType &y) const |
virtual U | operator() (const ArgType &x, const ArgType &y, const ArgType &z) const |
Bool & | mask (const uInt n) |
Manipulate the mask associated with the nth parameter (e.g. More... | |
const Bool & | mask (const uInt n) const |
const FunctionParam< T > & | parameters () const |
Return the parameter interface. More... | |
FunctionParam< T > & | parameters () |
const Vector< ArgType > & | argp () const |
Get arg_p and parset_p . More... | |
Bool | parsetp () const |
void | lockParam () |
Compiler cannot always find the correct 'const' version of parameter access. More... | |
void | unlockParam () |
virtual void | setMode (const RecordInterface &mode) |
get/set the function mode. More... | |
virtual void | getMode (RecordInterface &mode) const |
virtual Bool | hasMode () const |
return True if the implementing function supports a mode. More... | |
ostream & | print (ostream &os) const |
Print the function (i.e. More... | |
virtual Function< typename FunctionTraits< T >::DiffType > * | cloneAD () const |
virtual Function< typename FunctionTraits< T >::BaseType > * | cloneNonAD () const |
Public Member Functions inherited from casacore::Functional< FunctionTraits< T >::ArgType, U > | |
virtual | ~Functional () |
Destructor. More... | |
virtual U | operator() (const FunctionTraits< T >::ArgType &x) const =0 |
Map a Domain x into a Range y value. More... | |
Public Member Functions inherited from casacore::Functional< Vector< FunctionTraits< T >::ArgType >, U > | |
virtual | ~Functional () |
Destructor. More... | |
virtual U | operator() (const Vector< FunctionTraits< T >::ArgType > &x) const =0 |
Map a Domain x into a Range y value. More... | |
Additional Inherited Members | |
Public Types inherited from casacore::GaussianNDParam< T > | |
enum | { HEIGHT, CENTER } |
Public Types inherited from casacore::Function< T > | |
typedef FunctionTraits< T > ::ArgType | ArgType |
typedef const ArgType * | FunctionArg |
Protected Member Functions inherited from casacore::GaussianNDParam< T > | |
void | repack (Matrix< T > &covar) const |
Functions to convert between internal Vector of parameters and the Covariance Matrix. More... | |
void | unpack (const Matrix< T > &covar) |
Protected Attributes inherited from casacore::GaussianNDParam< T > | |
uInt | itsDim |
dimensionality More... | |
T | itsFlux2Hgt |
factor to convert from flux to height More... | |
Protected Attributes inherited from casacore::Function< T > | |
FunctionParam< T > | param_p |
The parameters and masks. More... | |
Vector< ArgType > | arg_p |
Aid for non-contiguous argument storage. More... | |
Bool | parset_p |
Indicate parameter written. More... | |
Bool | locked_p |
Indicate that parameters are expected to be locked from changing. More... | |
A Multi-dimensional Gaussian functional.
Public interface
A GaussianND
is used to calculate Gaussian functions of any dimension. A Gaussian1D class exists which is more appropriate for one dimensional Gaussian functions, and a Gaussian2D class exists for two dimensional functions.
A statistical description of the multi-dimensional Gaussian is used (see Kendall & Stuart "The Advanced Theory of Statistics"). A Gaussian is defined in terms of its height, mean (which is the location of the peak value), variance, (a measure of the width of the Gaussian), and covariance which skews the distribution with respect to the Axes.
In the general description the variance and covariance are specified using a covariance matrix. This is defined as (for a 4 dimensional Gaussian):
where s1 (sigma1
) is the standard deviation of the Gaussian with respect to the first axis, and r12 (rho12
) is the correlation between the the first and second axis. The correlation MUST be between -1 and 1, and this class checks this as well as ensuring that the diagonal is positive.
Warning: It is possible to have symmetric matrices that are of the above described form (ie; symmetric with -1 <= rho(ij) <=1
) that do not generate a Gaussian function; This is because the Matrix is NOT positive definite (The limits on rho(ij)
are upper limits); This class does check that the covariance Matrix is positive definite and will throw an exception (AipsError) if it is not;
The covariance Matrix can be specified by only its upper or lower triangular regions (ie. with zeros in the other triangle), otherwise it MUST be symmetric.
The Gaussian that is constructed from this covariance Matrix (V), along with mean (u) and height (h) is:
where x, and u are vectors whose length is the dimensionality of the Gaussian and V^(-1) is the inverse of the covariance Matrix defined above. For a two dimensional Gaussian with zero mean this expression reduces to:
The amplitude of the Gaussian can be defined in two ways, either using the peak height (as is done in the constructors, and the setHeight function) or using the setFlux function. The flux in this context is the analytic integral of the Gaussian over all dimensions. Using the setFlux function does not modify the shape of the Gaussian just its height.
All the parameters of the Gaussian except its dimensionality can be modified using the set/get functions.
The parameter interface (see FunctionParam class), is used to provide an interface to the Fitting classes. There are always 4 parameter sets. The parameters are, in order:
Construct a two dimensional Gaussian with mean=(0,1), variance=(.1,7) and height = 1;
A Gaussian Functional was needed for modeling the sky with a series of components. It was later realised that it was too general and Gaussian2D was written.
Definition at line 178 of file GaussianND.h.
|
inline |
Makes a Gaussian using the indicated height, mean, variance & covariance.
ndim defaults to 2, mean defaults to 0, height to Pi^(-ndim/2) (the flux is unity) variance defaults to 1.0, covariance defaults to 0.0,
Definition at line 190 of file GaussianND.h.
|
inlineexplicit |
Definition at line 191 of file GaussianND.h.
|
inline |
Definition at line 193 of file GaussianND.h.
|
inline |
Definition at line 195 of file GaussianND.h.
|
inline |
Definition at line 197 of file GaussianND.h.
|
inline |
Definition at line 200 of file GaussianND.h.
|
inline |
Copy constructor (deep copy)
Definition at line 207 of file GaussianND.h.
|
inlinevirtual |
Destructor.
Definition at line 215 of file GaussianND.h.
|
inlinevirtual |
Return a copy of this object from the heap.
The caller is responsible for deleting this pointer.
Implements casacore::Function< T >.
Definition at line 227 of file GaussianND.h.
|
virtual |
Evaluate the Gaussian at x
.
|
inline |
Copy assignment (deep copy)
Definition at line 211 of file GaussianND.h.
References casacore::GaussianNDParam< T >::operator=().