casa
$Rev:20696$
|
Get an initial estimate for spectral lines. More...
#include <SpectralEstimate.h>
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. | |
SpectralEstimate & | operator= (const SpectralEstimate &other) |
Assignment (copy semantics) | |
template<class MT > | |
const SpectralList & | estimate (const Vector< MT > &ordinate, Vector< MT > *der=0) |
Generate the estimates for a profile and return the list found. | |
template<class MT > | |
const SpectralList & | estimate (const Vector< MT > &abcissa, const Vector< MT > &ordinate) |
const SpectralList & | list () 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. | |
Double * | deriv_p |
The second derivatives. | |
SpectralList | slist_p |
The list of components. | |
uInt | lprof_p |
The length of the current profile being estimated. |
Get an initial estimate for spectral lines.
Public interface
From spectral line and estimate
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.
To have an automatic method to find spectral lines
Definition at line 95 of file SpectralEstimate.h.
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.
casa::SpectralEstimate::SpectralEstimate | ( | const SpectralEstimate & | other | ) |
Copy constructor (deep copy)
Destructor.
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.
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.
const SpectralList& casa::SpectralEstimate::estimate | ( | const Vector< MT > & | abcissa, |
const Vector< MT > & | ordinate | ||
) |
void casa::SpectralEstimate::findc2 | ( | const Vector< MT > & | prof | ) | [private] |
Get the second derivatives.
void casa::SpectralEstimate::findga | ( | const Vector< MT > & | prof | ) | [private] |
Find the Gaussians.
const SpectralList& casa::SpectralEstimate::list | ( | ) | const [inline] |
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))
void casa::SpectralEstimate::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.
uInt casa::SpectralEstimate::window | ( | const Vector< MT > & | prof | ) | [private] |
Get the window or the total spectrum.
Double casa::SpectralEstimate::a_p [private] |
Internal cashing of calculated values based on q.
Definition at line 193 of file SpectralEstimate.h.
Double casa::SpectralEstimate::b_p [private] |
Definition at line 194 of file SpectralEstimate.h.
Double casa::SpectralEstimate::cutoff_p [private] |
Source cutoff amplitude.
Definition at line 178 of file SpectralEstimate.h.
Double* casa::SpectralEstimate::deriv_p [private] |
The second derivatives.
Definition at line 199 of file SpectralEstimate.h.
uInt casa::SpectralEstimate::lprof_p [private] |
The length of the current profile being estimated.
Definition at line 203 of file SpectralEstimate.h.
const uInt casa::SpectralEstimate::MAXPAR [static] |
Default maximum number of components to be found.
Definition at line 99 of file SpectralEstimate.h.
Int casa::SpectralEstimate::q_p [private] |
Int casa::SpectralEstimate::regionEnd_p [private] |
Definition at line 187 of file SpectralEstimate.h.
Int casa::SpectralEstimate::regionLow_p [private] |
Region low and high value.
Definition at line 186 of file SpectralEstimate.h.
Double casa::SpectralEstimate::rms_p [private] |
rms estimate in profile
Definition at line 176 of file SpectralEstimate.h.
Double casa::SpectralEstimate::sigmin_p [private] |
The minimum Gaussian width.
Definition at line 197 of file SpectralEstimate.h.
SpectralList casa::SpectralEstimate::slist_p [private] |
Bool casa::SpectralEstimate::useWindow_p [private] |
Int casa::SpectralEstimate::windowEnd_p [private] |
Definition at line 182 of file SpectralEstimate.h.
Int casa::SpectralEstimate::windowLow_p [private] |
Window low and end value.
Definition at line 181 of file SpectralEstimate.h.