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

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

#include <SpectralEstimate.h>

Public Member Functions

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

Static Public Attributes

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

Private Member Functions

template<class MT >
casacore::uInt window (const casacore::Vector< MT > &prof)
 Get the window or the total spectrum. More...
 
template<class MT >
void findc2 (const casacore::Vector< MT > &prof)
 Get the second derivatives. More...
 
template<class MT >
void findga (const casacore::Vector< MT > &prof)
 Find the Gaussians. More...
 
template<class MT >
GaussianSpectralElement convertElement (const casacore::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. More...
 

Private Attributes

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

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 99 of file SpectralEstimate.h.

Constructor & Destructor Documentation

casa::SpectralEstimate::SpectralEstimate ( const casacore::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 casacore::Double  rms,
const casacore::Double  cutoff = 0.0,
const casacore::Double  minsigma = 0.0,
const casacore::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.

casa::SpectralEstimate::SpectralEstimate ( const SpectralEstimate other)

Copy constructor (deep copy)

casa::SpectralEstimate::~SpectralEstimate ( )

Destructor.

Member Function Documentation

template<class MT >
GaussianSpectralElement casa::SpectralEstimate::convertElement ( const casacore::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 casacore::Vector< MT > &  ordinate,
casacore::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 casacore::Vector< MT > &  abcissa,
const casacore::Vector< MT > &  ordinate 
)
template<class MT >
void casa::SpectralEstimate::findc2 ( const casacore::Vector< MT > &  prof)
private

Get the second derivatives.

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

Find the Gaussians.

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

Return the list found.

Definition at line 152 of file SpectralEstimate.h.

References slist_p.

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

Assignment (copy semantics)

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

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

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

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

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

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

void casa::SpectralEstimate::setQ ( const casacore::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 casacore::Int  lo,
const casacore::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 casacore::Double  rms = 0.0)

Set estimation parameters.

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

void casa::SpectralEstimate::setWindowing ( const casacore::Bool  win = false)

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

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

Get the window or the total spectrum.

Member Data Documentation

casacore::Double casa::SpectralEstimate::a_p
private

Internal cashing of calculated values based on q.

Definition at line 197 of file SpectralEstimate.h.

casacore::Double casa::SpectralEstimate::b_p
private

Definition at line 198 of file SpectralEstimate.h.

casacore::Double casa::SpectralEstimate::cutoff_p
private

Source cutoff amplitude.

Definition at line 182 of file SpectralEstimate.h.

casacore::Double* casa::SpectralEstimate::deriv_p
private

The second derivatives.

Definition at line 203 of file SpectralEstimate.h.

casacore::uInt casa::SpectralEstimate::lprof_p
private

The length of the current profile being estimated.

Definition at line 207 of file SpectralEstimate.h.

const casacore::uInt casa::SpectralEstimate::MAXPAR
static

Default maximum number of components to be found.

Definition at line 103 of file SpectralEstimate.h.

casacore::Int casa::SpectralEstimate::q_p
private

Smoothing parameter.

I.e. 2q+1 points are taken

Definition at line 194 of file SpectralEstimate.h.

casacore::Int casa::SpectralEstimate::regionEnd_p
private

Definition at line 191 of file SpectralEstimate.h.

casacore::Int casa::SpectralEstimate::regionLow_p
private

Region low and high value.

Definition at line 190 of file SpectralEstimate.h.

casacore::Double casa::SpectralEstimate::rms_p
private

rms estimate in profile

Definition at line 180 of file SpectralEstimate.h.

casacore::Double casa::SpectralEstimate::sigmin_p
private

The minimum Gaussian width.

Definition at line 201 of file SpectralEstimate.h.

SpectralList casa::SpectralEstimate::slist_p
private

The list of components.

Definition at line 205 of file SpectralEstimate.h.

Referenced by list().

casacore::Bool casa::SpectralEstimate::useWindow_p
private

Use window search.

Definition at line 178 of file SpectralEstimate.h.

casacore::Int casa::SpectralEstimate::windowEnd_p
private

Definition at line 186 of file SpectralEstimate.h.

casacore::Int casa::SpectralEstimate::windowLow_p
private

Window low and end value.

Definition at line 185 of file SpectralEstimate.h.


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