Gaussian1DParam.h
Classes
- Gaussian1DParam -- Parameter handling for one dimensional Gaussian class. (full description)
Types
- HEIGHT = 0
-
- CENTER
-
- WIDTH
-
Interface
- Public Members
- Gaussian1DParam()
- explicit Gaussian1DParam(const T &height)
- Gaussian1DParam(const T &height, const T ¢er)
- Gaussian1DParam(const T &height, const T ¢er, const T &width)
- Gaussian1DParam(const Gaussian1DParam<T> &other)
- Gaussian1DParam<T> &operator=(const Gaussian1DParam<T> &other)
- virtual ~Gaussian1DParam()
- T height() const
- void setHeight(const T &height)
- T flux() const
- void setFlux(const T &flux)
- T center() const
- void setCenter(const T &cnter)
- T width() const
- void setWidth(const T &width)
Prerequisite
Etymology
A 1-dimensional Gaussian's parameters.
Synopsis
A Gaussian1D is described by a height, center, and width.
The parameters (height, center and width) may be changed at run time.
The width of the Gaussian (for the constructors or the setWidth
function) is always specified in terms of the full width at half
maximum (FWHM). It is always positive and attempts to set a non-positive
width will throw an assertion when in debug mode.
The peak height of the Gaussian can be specified at construction time or
by using the setHeight function. Alternatively the
setFlux function can be used to implicitly set the peak height by
specifying the integrated area under the Gaussian. The height (or flux)
can be positive, negative or zero, as this class makes no assumptions on
what quantity the height represents.
Changing the width of the Gaussian will not affect
its peak height but will change its flux. So you should always set the
width before setting the flux.
The parameter interface (see
FunctionParam class),
is used to provide an interface to the
Fitting classes.
There are 3 parameters that are used to describe the Gaussian:
- The height of the Gaussian. This is identical to the value
returned using the height() member function.
- The center of the Gaussian in the x direction. This is identical to
the value returned using the center() member function.
- The width (FWHM) of the Gaussian. To aid convergence of
the non-linear fitting routines this parameter is allowed to be
negative. This does not affect the shape of the Gaussian as the
square of the width is used when evaluating the function.
An enumeration for the HEIGHT, WIDTH and
CENTER parameter index is provided, enabling the setting
and reading of parameters with the [] operator. The
mask() methods can be used to check and set the parameter masks.
This class is in general used implicitly by the Gaussian1D
class only.
Example
Gaussian1D<Double> gf(5.0, 25.0, 7);
gf(25); // = 5.0
gf.setHeight(1.0);
gf[WIDTH](2.0);
gf[CENTER](0.0);
gf(1); // = 0.5*height = 0.5
Template Type Argument Requirements (T)
- T should have standard numerical operators and exp() function. Current
implementation only tested for real types (and their AutoDiffs).
Thrown Exceptions
- Assertion in debug mode if attempt is made to set a negative width
- AipsError if incorrect parameter number specified.
To Do
- Gaussians that know about their DFT's could be required eventually.
Member Description
Constructs the one dimensional Gaussians. Defaults:
height=1, center=0, width(FWHM)=1.
Could not use default arguments
that worked both with gcc and IRIX and all templates
Gaussian1DParam(const Gaussian1DParam<T> &other)
Copy constructor (deep copy)
Gaussian1DParam<T> &operator=(const Gaussian1DParam<T> &other)
Copy assignment (deep copy)
Destructor
T height() const
void setHeight(const T &height)
Get or set the peak height of the Gaussian
T flux() const
void setFlux(const T &flux)
Get or set the analytical integrated area underneath the Gaussian.
Use these functions as an alternative to the height functions.
T center() const
void setCenter(const T &cnter)
Get or set the center ordinate of the Gaussian
T width() const
void setWidth(const T &width)
Get or set the FWHM of the Gaussian.