casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
casa::SpectralEstimate Class Reference

Get an initial estimate for spectral lines. More...

#include <SpectralEstimate.h>

List of all members.

Public Member Functions

 SpectralEstimate (const uInt maxpar=MAXPAR)
 Default constructor creates a default estimator (default max number of components to be found is 200) with the given maximum number of components that will be found.
 SpectralEstimate (const Double rms, const Double cutoff=0.0, const Double minsigma=0.0, const uInt maxpar=MAXPAR)
 Create an estimator with the given maximum number of possible elements.
 SpectralEstimate (const SpectralEstimate &other)
 Copy constructor (deep copy)
 ~SpectralEstimate ()
 Destructor.
SpectralEstimateoperator= (const SpectralEstimate &other)
 Assignment (copy semantics)
template<class MT >
const SpectralListestimate (const Vector< MT > &ordinate, Vector< MT > *der=0)
 Generate the estimates for a profile and return the list found.
template<class MT >
const SpectralListestimate (const Vector< MT > &abcissa, const Vector< MT > &ordinate)
const SpectralListlist () const
 Return the list found.
void setRMS (const Double rms=0.0)
 Set estimation parameters.
void setCutoff (const Double cutoff=0.0)
 Set the amplitude cutoff for valid estimate (forced to max(0,cutoff))
void setMinSigma (const Double minsigma=0.0)
 Set the minimum width allowed (forced to max(0,minsigma))
void setQ (const uInt q=2)
 Set the number of points consider at each side of test point (i.e.
void setRegion (const Int lo, const Int hi)
 Set a region [lo,hi] over which to estimate.
void setWindowing (const Bool win=False)
 Do you want to look in an automatically determined window with signal? Default is False, meaning the full (possibly regioned) profile.
void setMaxN (const uInt maxpar=MAXPAR)
 Set the maximum number of estimates to find (forced to >=1; 200 default)

Static Public Attributes

static const uInt MAXPAR
 Default maximum number of components to be found.

Private Member Functions

template<class MT >
uInt window (const Vector< MT > &prof)
 Get the window or the total spectrum.
template<class MT >
void findc2 (const Vector< MT > &prof)
 Get the second derivatives.
template<class MT >
void findga (const Vector< MT > &prof)
 Find the Gaussians.
template<class MT >
GaussianSpectralElement convertElement (const Vector< MT > &abcissa, const GaussianSpectralElement &el) const
 Convert the parameters of the components in the list from pixel-based indices to the given abcissa-vector space.

Private Attributes

Bool useWindow_p
 
   

Double rms_p
 rms estimate in profile
Double cutoff_p
 Source cutoff amplitude.
Int windowLow_p
 Window low and end value.
Int windowEnd_p
Int regionLow_p
 Region low and high value.
Int regionEnd_p
Int q_p
 Smoothing parameter.
Double a_p
 Internal cashing of calculated values based on q.
Double b_p
Double sigmin_p
 The minimum Gaussian width.
Doublederiv_p
 The second derivatives.
SpectralList slist_p
 The list of components.
uInt lprof_p
 The length of the current profile being estimated.

Detailed Description

Get an initial estimate for spectral lines.

Intended use:

Public interface

Review Status

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

Prerequisite

Etymology

From spectral line and estimate

Synopsis

The SpectralEstimate class obtains an initial guess for spectral components. The current implementation uses the entire profile as signal region, or can set a window to be searched around the highest peak automatically. A window can also be set manually. The second derivative of the profile in the signal region is calculated by fitting a second degree polynomal. The smoothing parameter Q determines the number of points used for this (=2*Q+1). The gaussians can then be estimated as described by Schwarz, 1968, Bull.Astr.Inst.Netherlands, Volume 19, 405.

The elements guessed can be used in the SpectralFit class.

The default type found is a Gaussian, defined as:

        AMPL.exp[ -(x-CENTER)<sup>2</sup>/2 SIGMA<sup>2</sup>]

The parameter estimates are returned in units of zero-based pixel indices.

Example

Motivation

To have an automatic method to find spectral lines

To Do

Definition at line 95 of file SpectralEstimate.h.


Constructor & Destructor Documentation

casa::SpectralEstimate::SpectralEstimate ( const uInt  maxpar = MAXPAR) [explicit]

Default constructor creates a default estimator (default max number of components to be found is 200) with the given maximum number of components that will be found.

A value of zero will indicate an unlimited number.

casa::SpectralEstimate::SpectralEstimate ( const Double  rms,
const Double  cutoff = 0.0,
const Double  minsigma = 0.0,
const uInt  maxpar = MAXPAR 
) [explicit]

Create an estimator with the given maximum number of possible elements.

A value of zero will indicate an unlimited number. Construct with a given rms in profiles, a cutoff for amplitudes found, and a minimum width. Cutoff and minsigma default to 0.0, maximum size of list produced to 200.

Copy constructor (deep copy)

Destructor.


Member Function Documentation

template<class MT >
GaussianSpectralElement casa::SpectralEstimate::convertElement ( const Vector< MT > &  abcissa,
const GaussianSpectralElement el 
) const [private]

Convert the parameters of the components in the list from pixel-based indices to the given abcissa-vector space.

template<class MT >
const SpectralList& casa::SpectralEstimate::estimate ( const Vector< MT > &  ordinate,
Vector< MT > *  der = 0 
)

Generate the estimates for a profile and return the list found.

The first function returns component parameters in units of pixel indices. The second function calls the first and then converts to the specified abcissa space (the supplied vector must be monotonic); if the pixel-based center is out of range of the supplied abcissa vector the conversion is done via extrapolation. The der pointer is meant for debugging, and can return the derivative profile. The second function throws an AipsError if the vectors are not the same length.

template<class MT >
const SpectralList& casa::SpectralEstimate::estimate ( const Vector< MT > &  abcissa,
const Vector< MT > &  ordinate 
)
template<class MT >
void casa::SpectralEstimate::findc2 ( const Vector< MT > &  prof) [private]

Get the second derivatives.

template<class MT >
void casa::SpectralEstimate::findga ( const Vector< MT > &  prof) [private]

Find the Gaussians.

const SpectralList& casa::SpectralEstimate::list ( ) const [inline]

Return the list found.

Definition at line 148 of file SpectralEstimate.h.

References slist_p.

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

Assignment (copy semantics)

void casa::SpectralEstimate::setCutoff ( const Double  cutoff = 0.0)

Set the amplitude cutoff for valid estimate (forced to max(0,cutoff))

void casa::SpectralEstimate::setMaxN ( const uInt  maxpar = MAXPAR)

Set the maximum number of estimates to find (forced to >=1; 200 default)

void casa::SpectralEstimate::setMinSigma ( const Double  minsigma = 0.0)

Set the minimum width allowed (forced to max(0,minsigma))

void casa::SpectralEstimate::setQ ( const uInt  q = 2)

Set the number of points consider at each side of test point (i.e.

a width of 2q+1 is taken). Default internally is 2; max(1,q) taken.

void casa::SpectralEstimate::setRegion ( const Int  lo,
const Int  hi 
)

Set a region [lo,hi] over which to estimate.

Lo and hi are given as zero-based vector indices.

void casa::SpectralEstimate::setRMS ( const Double  rms = 0.0)

Set estimation parameters.

Set the profile's estimated rms (forced to abs(rms))

Do you want to look in an automatically determined window with signal? Default is False, meaning the full (possibly regioned) profile.

template<class MT >
uInt casa::SpectralEstimate::window ( const Vector< MT > &  prof) [private]

Get the window or the total spectrum.


Member Data Documentation

Internal cashing of calculated values based on q.

Definition at line 193 of file SpectralEstimate.h.

Definition at line 194 of file SpectralEstimate.h.

Source cutoff amplitude.

Definition at line 178 of file SpectralEstimate.h.

The second derivatives.

Definition at line 199 of file SpectralEstimate.h.

The length of the current profile being estimated.

Definition at line 203 of file SpectralEstimate.h.

Default maximum number of components to be found.

Definition at line 99 of file SpectralEstimate.h.

Smoothing parameter.

I.e. 2q+1 points are taken

Definition at line 190 of file SpectralEstimate.h.

Definition at line 187 of file SpectralEstimate.h.

Region low and high value.

Definition at line 186 of file SpectralEstimate.h.

rms estimate in profile

Definition at line 176 of file SpectralEstimate.h.

The minimum Gaussian width.

Definition at line 197 of file SpectralEstimate.h.

The list of components.

Definition at line 201 of file SpectralEstimate.h.

Referenced by list().

   

Use window search

Definition at line 174 of file SpectralEstimate.h.

Definition at line 182 of file SpectralEstimate.h.

Window low and end value.

Definition at line 181 of file SpectralEstimate.h.


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