casa
5.7.0-16
|
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... | |
SpectralEstimate & | operator= (const SpectralEstimate &other) |
Assignment (copy semantics) More... | |
template<class MT > | |
const SpectralList & | estimate (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 SpectralList & | estimate (const casacore::Vector< MT > &abcissa, const casacore::Vector< MT > &ordinate) |
const SpectralList & | list () 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::Double * | deriv_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... | |
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:
The parameter estimates are returned in units of zero-based pixel indices.
To have an automatic method to find spectral lines
Definition at line 99 of file SpectralEstimate.h.
|
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.
|
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.
|
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 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.
const SpectralList& casa::SpectralEstimate::estimate | ( | const casacore::Vector< MT > & | abcissa, |
const casacore::Vector< MT > & | ordinate | ||
) |
|
private |
Get the second derivatives.
|
private |
Find the Gaussians.
|
inline |
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.
|
private |
Get the window or the total spectrum.
|
private |
Internal cashing of calculated values based on q.
Definition at line 197 of file SpectralEstimate.h.
|
private |
Definition at line 198 of file SpectralEstimate.h.
|
private |
Source cutoff amplitude.
Definition at line 182 of file SpectralEstimate.h.
|
private |
The second derivatives.
Definition at line 203 of file SpectralEstimate.h.
|
private |
The length of the current profile being estimated.
Definition at line 207 of file SpectralEstimate.h.
|
static |
Default maximum number of components to be found.
Definition at line 103 of file SpectralEstimate.h.
|
private |
|
private |
Definition at line 191 of file SpectralEstimate.h.
|
private |
Region low and high value.
Definition at line 190 of file SpectralEstimate.h.
|
private |
rms estimate in profile
Definition at line 180 of file SpectralEstimate.h.
|
private |
The minimum Gaussian width.
Definition at line 201 of file SpectralEstimate.h.
|
private |
|
private |
Use window search.
Definition at line 178 of file SpectralEstimate.h.
|
private |
Definition at line 186 of file SpectralEstimate.h.
|
private |
Window low and end value.
Definition at line 185 of file SpectralEstimate.h.