casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
casa::GaussianMultipletSpectralElement Class Reference

Describes a multiplet of Gaussian shaped spectral lines. More...

#include <GaussianMultipletSpectralElement.h>

Inheritance diagram for casa::GaussianMultipletSpectralElement:
casa::CompiledSpectralElement casa::SpectralElement

Public Member Functions

 GaussianMultipletSpectralElement (const std::vector< GaussianSpectralElement > &estimates, const casacore::Matrix< casacore::Double > &fixedRelationships)
 Construct a Gaussian multiplet. More...
 
 GaussianMultipletSpectralElement (const GaussianMultipletSpectralElement &other)
 copy semantics More...
 
 ~GaussianMultipletSpectralElement ()
 
SpectralElementclone () const
 
GaussianMultipletSpectralElementoperator= (const GaussianMultipletSpectralElement &other)
 copy semantics More...
 
casacore::Bool operator== (const GaussianMultipletSpectralElement &other) const
 
const std::vector
< GaussianSpectralElement > & 
getGaussians () const
 get the gaussians More...
 
const casacore::Matrix
< casacore::Double > & 
getConstraints () const
 get the constraints matrix More...
 
void set (const casacore::Vector< casacore::Double > &param)
 These methods must be public because the architecture of the class hierarchy requires it and set() and setError() must be accessible by fitters. More...
 
void setError (const casacore::Vector< casacore::Double > &err)
 Set the error fields. More...
 
void fix (const casacore::Vector< casacore::Bool > &fix)
 Set fixed parameters (true) or unset them (false) More...
 
casacore::Bool toRecord (casacore::RecordInterface &out) const
 Save to a record. More...
 
- Public Member Functions inherited from casa::CompiledSpectralElement
 CompiledSpectralElement (const casacore::String &function, const casacore::Vector< casacore::Double > &param)
 Construct a compiled string. More...
 
 CompiledSpectralElement (const CompiledSpectralElement &other)
 
virtual ~CompiledSpectralElement ()
 
CompiledSpectralElementoperator= (const CompiledSpectralElement &other)
 
virtual casacore::Double operator() (const casacore::Double x) const
 Evaluate the value of the element at x. More...
 
*const casacore::StringgetFunction () const
 Get the string of a compiled functional. More...
 
- Public Member Functions inherited from casa::SpectralElement
virtual ~SpectralElement ()
 
casacore::Bool operator== (const SpectralElement &other) const
 
virtual casacore::Double operator[] (const casacore::uInt n) const
 Get parameter n. More...
 
SpectralElement::Types getType () const
 Get type of this element. More...
 
void get (casacore::Vector< casacore::Double > &params) const
 Get all parameters. More...
 
casacore::Vector
< casacore::Double
get () const
 
void getError (casacore::Vector< casacore::Double > &err) const
 Get error estimates of parameters. More...
 
casacore::Vector
< casacore::Double
getError () const
 
casacore::uInt getOrder () const
 Get the order (i.e. More...
 
const casacore::Vector
< casacore::Bool > & 
fixed () const
 Get the fix state[s]. More...
 

Private Attributes

std::vector
< GaussianSpectralElement
_gaussians
 
casacore::Matrix
< casacore::Double
_constraints
 
casacore::Matrix< casacore::uInt_paramIndices
 

Additional Inherited Members

- Public Types inherited from casa::SpectralElement
enum  Types {
  GAUSSIAN,
  POLYNOMIAL,
  COMPILED,
  GMULTIPLET,
  LORENTZIAN,
  POWERLOGPOLY,
  LOGTRANSPOLY,
  N_Types
}
 Supported spectral components. More...
 
- Static Public Member Functions inherited from casa::SpectralElement
static const casacore::StringallTypes (casacore::Int &nall, const SpectralElement::Types *&typ)
 Get all the types available as casacore::String and codes, and number available. More...
 
static const casacore::StringfromType (SpectralElement::Types tp)
 Get a string from the type. More...
 
static casacore::Bool toType (SpectralElement::Types &tp, const casacore::String &typName)
 Get a type from a (non-case sensitive; minimum match) String. More...
 
- Protected Member Functions inherited from casa::SpectralElement
 SpectralElement ()
 
 SpectralElement (Types type, const casacore::Vector< casacore::Double > &parms=casacore::Vector< casacore::Double >(0))
 
 SpectralElement (const SpectralElement &other)
 
SpectralElementoperator= (const SpectralElement &other)
 
void _set (const casacore::Vector< casacore::Double > &params)
 
void _setType (const Types type)
 
void _setFunction (const std::shared_ptr< casacore::Function< casacore::Double, casacore::Double > > &f)
 
virtual std::shared_ptr
< casacore::Function
< casacore::Double,
casacore::Double > > 
_getFunction () const
 

Detailed Description

Describes a multiplet of Gaussian shaped spectral lines.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd
Test programs:
tSpectralFit

Prerequisite

Etymology

From Gaussian and multiplet and spectral line and element

Synopsis

The GaussianMultipletSpectralElement class describes a multiplet of Gaussian shaped spectral lines for describing spectral profile.

Relationships between Gaussians in the multiplet must be specified. Any combination of one or more of fixed relationships between line center offsets, line amplitude ratios, and/or line width ratios can be specified between a single reference line in the multiplet and other (non-reference) lines in the multiplet. The constructor takes a casacore::Vector of GaussianSpectralElements which describes the estimates of the n Gaussians in the multiplet. These objects themselves are not used in the fitting, but are used only to create the function that describes the multiplet. The first element in this casacore::Vector represents the reference line to which parameters of the other lines are constrained. In addition, the constructor takes an n-1 x 3 casacore::Matrix<casacore::Double> describing the fixed relationships between the reference line and the other lines in the multiplet. Each ith row describes the fixed relationship(s) between the (i+1)th and the zeroth (reference) Gaussian. The first element of each row describes the ratio of amplitudes between the (i+1)th and reference Gaussian, the second element describes the difference between the center locations of the (i+1)th and reference Gaussian, and the third represents the ratio of the FWHM of the (i+1)th and reference Gaussian. A value of 0 for any of these indicates there is no fixed relationship for that parameter. At least one value must be non-zero for each row and any combination of elements (including all of them) can be non-zero for any row in this matrix. The values of parameters of non-reference lines in the input vector that are constrained to the reference line are implicitly ignored and set in the constructor according to the specified constraint. If any of the parameters of the reference line are specified as fixed, the corresponding parameters of any non-reference lines which have the corresponding parameters constrained to the reference line are also implicitly fixed. Fixing a parameter in a non-reference line that is constrained to the corresponding parameter of the reference line that is not fixed will cause an exception.

Example

This is how to specify a doublet in which the only constraint is that the amplitudes between the lines must be fixed, the first Gaussian must have an ampliute of 0.6 times the zeroth (reference) Gaussian. Other than that, all other parameters can vary during the fit:

GaussianSpectralElement reference(5, 25, 16); The amplitude value of first is ignored because of the relationship to the reference, but it still must be specified in the constructor and must be non-zero or an exception will be thrown. GaussianSpectralElement first(1, 40, 17); casacore::Vector<GaussianSpectralElement> pair(2); pair[0] = reference; pair[1] = first; initialize constraints matrix to have nothing constrained (all values 0) casacore::Matrix<casacore::Double> fixedRel(1, 3, 0); Set the ratio of amplitudes between the first and reference (zeroth) line to be 0.6. fixedRel[0][0] = 0.6 GaussianMultipletSpectralElement doublet(pair,"",fixedRel);

Motivation

To allow specifying constraints between different Gaussian spectral lines for fitting, eg to support fitting of doublets.

Definition at line 120 of file GaussianMultipletSpectralElement.h.

Constructor & Destructor Documentation

casa::GaussianMultipletSpectralElement::GaussianMultipletSpectralElement ( const std::vector< GaussianSpectralElement > &  estimates,
const casacore::Matrix< casacore::Double > &  fixedRelationships 
)

Construct a Gaussian multiplet.

The values of non-reference (non-zeroth) estimates will be automatically adjusted if there is a fixed relationship between a non-reference Gaussian parameter and the corresponding reference Gaussian parameter.

casa::GaussianMultipletSpectralElement::GaussianMultipletSpectralElement ( const GaussianMultipletSpectralElement other)

copy semantics

casa::GaussianMultipletSpectralElement::~GaussianMultipletSpectralElement ( )

Member Function Documentation

SpectralElement* casa::GaussianMultipletSpectralElement::clone ( ) const
virtual

Reimplemented from casa::CompiledSpectralElement.

void casa::GaussianMultipletSpectralElement::fix ( const casacore::Vector< casacore::Bool > &  fix)
virtual

Set fixed parameters (true) or unset them (false)

Thrown Exceptions

Fix/unfix all in one go

Reimplemented from casa::SpectralElement.

const casacore::Matrix<casacore::Double>& casa::GaussianMultipletSpectralElement::getConstraints ( ) const

get the constraints matrix

const std::vector<GaussianSpectralElement>& casa::GaussianMultipletSpectralElement::getGaussians ( ) const

get the gaussians

GaussianMultipletSpectralElement& casa::GaussianMultipletSpectralElement::operator= ( const GaussianMultipletSpectralElement other)

copy semantics

casacore::Bool casa::GaussianMultipletSpectralElement::operator== ( const GaussianMultipletSpectralElement other) const
void casa::GaussianMultipletSpectralElement::set ( const casacore::Vector< casacore::Double > &  param)
virtual

These methods must be public because the architecture of the class hierarchy requires it and set() and setError() must be accessible by fitters.

However, it is strongly recommended that other classes not call these methods for object configuration but rather set them implicitly at construction via the casacore::Vector<GaussianSpectralElement> passed to the constructor.

Reimplemented from casa::SpectralElement.

void casa::GaussianMultipletSpectralElement::setError ( const casacore::Vector< casacore::Double > &  err)
virtual

Set the error fields.

Reimplemented from casa::SpectralElement.

casacore::Bool casa::GaussianMultipletSpectralElement::toRecord ( casacore::RecordInterface out) const
virtual

Save to a record.

Reimplemented from casa::SpectralElement.

Member Data Documentation

casacore::Matrix<casacore::Double> casa::GaussianMultipletSpectralElement::_constraints
private

Definition at line 175 of file GaussianMultipletSpectralElement.h.

std::vector<GaussianSpectralElement> casa::GaussianMultipletSpectralElement::_gaussians
private

Definition at line 174 of file GaussianMultipletSpectralElement.h.

casacore::Matrix<casacore::uInt> casa::GaussianMultipletSpectralElement::_paramIndices
private

Definition at line 176 of file GaussianMultipletSpectralElement.h.


The documentation for this class was generated from the following file: