casa::ImageProfileFitter Class Reference

#include <ImageProfileFitter.h>

Inheritance diagram for casa::ImageProfileFitter:
casa::ImageTask< Float >

List of all members.

Public Member Functions

 ImageProfileFitter (const SPCIIF image, const String &region, const Record *const &regionPtr, const String &box, const String &chans, const String &stokes, const String &mask, const Int axis, const uInt ngauss, Bool overwrite=False)
 Top level interface for one-dimensional profile fits.
 ImageProfileFitter (const SPCIIF image, const String &region, const Record *const &regionPtr, const String &box, const String &chans, const String &stokes, const String &mask, const Int axis, const String &estimatesFilename, Bool overwrite=False)
 Fit only Gaussian singlets and an optional polynomial.
 ImageProfileFitter (const SPCIIF image, const String &region, const Record *const &regionPtr, const String &box, const String &chans, const String &stokes, const String &mask, const Int axis, const SpectralList &spectralList, Bool overwrite=False)
 Fit any permitted combination of spectral components and an optional polynomial.
 ~ImageProfileFitter ()
 destructor
Record fit (Bool doDetailedResults=True)
 Do the fit.
Record getResults () const
 get the fit results.
String getClass () const
void setPolyOrder (Int p)
 set the order of a polynomial to be simultaneously fit.
void setDoMultiFit (const Bool m)
 set whether to do a pixel by pixel fit.
void setLogResults (const Bool logResults)
 set if results should be written to the logger
void setMinGoodPoints (const uInt mgp)
 set minimum number of good points required to attempt a fit
void setModel (const String &model)
 Solution images.
void setResidual (const String &residual)
 residual image name
void setAmpName (const String &s)
 gaussian amplitude image name
void setAmpErrName (const String &s)
 gaussian amplitude error image name
void setCenterName (const String &s)
 gaussian center image name
void setCenterErrName (const String &s)
 gaussian center error image name
void setFWHMName (const String &s)
 gaussian fwhm image name
void setFWHMErrName (const String &s)
 gaussian fwhm error image name
void setIntegralName (const String &s)
 gaussian integral image name
void setIntegralErrName (const String &s)
 gaussian integral error image name
void setPLPName (const String &s)
 set the name of the power logarithmic polynomial image.
void setPLPErrName (const String &s)
 set the name of the power logarithmic polynomial image.
void setLTPName (const String &s)
 set the name of the logarithmic transformed polynomial image.
void setLTPErrName (const String &s)
 set the name of the logarithmic transformed polynomial image.
void setGoodAmpRange (const Double min, const Double max)
 set the range over which PFC amplitude solutions are valid
void setGoodCenterRange (const Double min, const Double max)
 set the range over which PFC center solutions are valid
void setGoodFWHMRange (const Double min, const Double max)
 set the range over which PFC FWHM solutions are valid
void setSigma (const Array< Float > &sigma)
 set standard deviation image
void setSigma (const ImageInterface< Float > *const &sigma)
void setOutputSigmaImage (const String &s)
const Array< SHARED_PTR
< ProfileFitResults > > & 
getFitters () const
Double getWorldValue (Double pixelVal, const IPosition &imPos, const String &units, Bool velocity, Bool wavelength, Int tabularIndex=-1, MFrequency::Types type=MFrequency::DEFAULT) const
 Converts a pixel value into a world value either in velocity, wavelength, or frequency units.
void setAbscissaDivisor (Double d)
void setAbscissaDivisor (const Quantity &q)
void createResidualImage (Bool b)
 for backward compatibility with ia.continuumsub.
SPIIF getResidual () const
void setGoodPlanes (const std::set< uInt > &planes)
 set the planes along the fit axis that are considered good for performing the fits.

Protected Member Functions

CasacRegionManager::StokesControl _getStokesControl () const
vector< Coordinate::Type > _getNecessaryCoordinates () const
 Represents the minimum set of coordinates necessary for the task to function.
Bool _hasLogfileSupport () const
 by default, derived classes are configured to have no log file support.
Bool _supportsMultipleRegions () const

Private Member Functions

std::vector
< OutputDestinationChecker::OutputStruct
_getOutputStruct ()
void _checkNGaussAndPolyOrder () const
void _finishConstruction ()
void _fitallprofiles ()
 moved from ImageAnalysis
void _fitProfiles (const Bool showProgress)
 Fit all profiles in image.
void _flagFitterIfNecessary (ImageFit1D< Float > &fitter) const
 Bool _inVelocitySpace() const;.
Bool _isPCFSolutionOK (const PCFSpectralElement *const &pcf) const
void _loopOverFits (SPCIIF fitData, Bool showProgress, SHARED_PTR< ProgressMeter > progressMeter, Bool checkMinPts, const Array< Bool > &fitMask, ImageFit1D< Float >::AbcissaType abcissaType, const IPosition &fitterShape, const IPosition &sliceShape, const std::set< uInt > goodPlanes)
void _setAbscissaDivisorIfNecessary (const Vector< Double > &abscissaValues)
Bool _setFitterElements (ImageFit1D< Float > &fitter, SpectralList &newEstimates, const PtrHolder< const PolynomialSpectralElement > &polyEl, const vector< IPosition > &goodPos, const IPosition &fitterShape, const IPosition &curPos, uInt nOrigComps) const
void _updateModelAndResidual (Bool fitOK, const ImageFit1D< Float > &fitter, const IPosition &sliceShape, const IPosition &curPos, Lattice< Bool > *const &pFitMask, Lattice< Bool > *const &pResidMask) const
uInt _nUnknowns () const
 only implemented for the simplest cases so far

Private Attributes

String _residual
String _model
String _xUnit
String _centerName
String _centerErrName
String _fwhmName
String _fwhmErrName
String _ampName
String _ampErrName
String _integralName
String _integralErrName
String _plpName
String _plpErrName
String _ltpName
String _ltpErrName
String _sigmaName
String _abscissaDivisorForDisplay
Bool _multiFit
Bool _logResults
Bool _isSpectralIndex
Bool _createResid
Bool _overwrite
Bool _storeFits
Int _polyOrder
Int _fitAxis
uInt _nGaussSinglets
uInt _nGaussMultiplets
uInt _nLorentzSinglets
uInt _nPLPCoeffs
uInt _nLTPCoeffs
uInt _minGoodPoints
uInt _nProfiles
uInt _nAttempted
uInt _nSucceeded
uInt _nConverged
uInt _nValid
Array< SHARED_PTR
< ProfileFitResults > > 
_fitters
SHARED_PTR< const SubImage
< Float > > 
_subImage
 subimage contains the region of the original image on which the fit is performed.
Record _results
SpectralList _nonPolyEstimates
PtrHolder< std::pair< Double,
Double > > 
_goodAmpRange
PtrHolder< std::pair< Double,
Double > > 
_goodCenterRange
PtrHolder< std::pair< Double,
Double > > 
_goodFWHMRange
Matrix< String > _worldCoords
SHARED_PTR< TempImage< Float > > _sigma
Double _abscissaDivisor
SPIIF _modelImage
SPIIF _residImage
std::set< uInt > _goodPlanes
 planes along _fitAxis to use in fits, empty => use all planes originally used to support continuum subtraction
Bool _haveWarnedAboutGuessingGaussians

Static Private Attributes

static const String _class

Detailed Description

Definition at line 43 of file ImageProfileFitter.h.


Constructor & Destructor Documentation

casa::ImageProfileFitter::ImageProfileFitter ( const SPCIIF  image,
const String &  region,
const Record *const &  regionPtr,
const String &  box,
const String &  chans,
const String &  stokes,
const String &  mask,
const Int  axis,
const uInt  ngauss,
Bool  overwrite = False 
)

Top level interface for one-dimensional profile fits.

Etymology

Fits one-dimensional profiles.

Synopsis

Top level interface for one-dimensional profile fits.

Example

 ImageProfileFitter fitter(...)
 fitter.fit()

constructor appropriate for API calls. Parameters: image - the input image in which to fit the models box - A 2-D rectangular box in direction space in which to use pixels for the fitting, eg box=100,120,200,230 In cases where both box and region are specified, box, not region, is used. region - Named region to use for fitting. "" => Don't use a named region regPtr - Pointer to a region record. 0 => don't use a region record. chans - Zero-based channel range on which to do the fit. stokes - Stokes plane on which to do the fit. Only a single Stokes parameter can be specified. Only a maximum of one of region, regionPtr, or box/stokes/chans should be specified. mask - Mask (as LEL) to use as a way to specify which pixels to use </src> axis - axis along which to do the fits. If <0, use spectral axis, and if no spectral axis, use zeroth axis. ngauss number of single gaussians to fit. estimatesFilename file containing initial estimates for single gaussians. spectralList spectral list containing initial estimates of single gaussians. Do not put a polynomial in here; set that with setPolyOrder().

Fit only Gaussian singlets and an optional polynomial. In this case, the code guestimates initial estimates for the specified number of Gaussian singlets. If you only wish to fit a polynomial, you must use this constructor and you must set ngauss to zero. After construction, you must call setPolyOrder().

casa::ImageProfileFitter::ImageProfileFitter ( const SPCIIF  image,
const String &  region,
const Record *const &  regionPtr,
const String &  box,
const String &  chans,
const String &  stokes,
const String &  mask,
const Int  axis,
const String &  estimatesFilename,
Bool  overwrite = False 
)

Fit only Gaussian singlets and an optional polynomial.

In this case, the number of Gaussian singlets is deduced from the specified estimates file.

casa::ImageProfileFitter::ImageProfileFitter ( const SPCIIF  image,
const String &  region,
const Record *const &  regionPtr,
const String &  box,
const String &  chans,
const String &  stokes,
const String &  mask,
const Int  axis,
const SpectralList spectralList,
Bool  overwrite = False 
)

Fit any permitted combination of spectral components and an optional polynomial.

All components to be fit (except a possible polynomial) must be represented with initial estimates in spectralList.

casa::ImageProfileFitter::~ImageProfileFitter (  ) 

destructor


Member Function Documentation

void casa::ImageProfileFitter::_checkNGaussAndPolyOrder (  )  const [private]
void casa::ImageProfileFitter::_finishConstruction (  )  [private]
void casa::ImageProfileFitter::_fitallprofiles (  )  [private]

moved from ImageAnalysis

void casa::ImageProfileFitter::_fitProfiles ( const Bool  showProgress  )  [private]

Fit all profiles in image.

The output images must be already created; if the pointer is 0, that image won't be filled. The mask from the input image is transferred to the output images. If the weights image is pointer is non-zero, the values from it will be used to weight the data points in the fit. You can fit some combination of gaussians and a polynomial (-1 means no polynomial). Initial estimates are not required. Fits are done in image space to provide astronomer friendly results, but pixel space is better for the fitter when fitting polynomials. Thus, atm, callers should be aware that fitting polynomials may fail even when the data lie exactly on a polynomial curve. This will probably be fixed in the future by doing the fits in pixel space here and requiring the caller to deal with converting to something astronomer friendly if it so desires.

void casa::ImageProfileFitter::_flagFitterIfNecessary ( ImageFit1D< Float > &  fitter  )  const [private]

Bool _inVelocitySpace() const;.

vector<Coordinate::Type> casa::ImageProfileFitter::_getNecessaryCoordinates (  )  const [inline, protected, virtual]

Represents the minimum set of coordinates necessary for the task to function.

Implements casa::ImageTask< Float >.

Definition at line 235 of file ImageProfileFitter.h.

std::vector<OutputDestinationChecker::OutputStruct> casa::ImageProfileFitter::_getOutputStruct (  )  [private, virtual]

Reimplemented from casa::ImageTask< Float >.

CasacRegionManager::StokesControl casa::ImageProfileFitter::_getStokesControl (  )  const [inline, protected, virtual]
Bool casa::ImageProfileFitter::_hasLogfileSupport (  )  const [inline, protected, virtual]

by default, derived classes are configured to have no log file support.

Reimplemented from casa::ImageTask< Float >.

Definition at line 239 of file ImageProfileFitter.h.

References casacore::True.

Bool casa::ImageProfileFitter::_isPCFSolutionOK ( const PCFSpectralElement *const &  pcf  )  const [private]
void casa::ImageProfileFitter::_loopOverFits ( SPCIIF  fitData,
Bool  showProgress,
SHARED_PTR< ProgressMeter >  progressMeter,
Bool  checkMinPts,
const Array< Bool > &  fitMask,
ImageFit1D< Float >::AbcissaType  abcissaType,
const IPosition &  fitterShape,
const IPosition &  sliceShape,
const std::set< uInt >  goodPlanes 
) [private]
uInt casa::ImageProfileFitter::_nUnknowns (  )  const [private]

only implemented for the simplest cases so far

void casa::ImageProfileFitter::_setAbscissaDivisorIfNecessary ( const Vector< Double > &  abscissaValues  )  [private]
Bool casa::ImageProfileFitter::_setFitterElements ( ImageFit1D< Float > &  fitter,
SpectralList newEstimates,
const PtrHolder< const PolynomialSpectralElement > &  polyEl,
const vector< IPosition > &  goodPos,
const IPosition &  fitterShape,
const IPosition &  curPos,
uInt  nOrigComps 
) const [private]
Bool casa::ImageProfileFitter::_supportsMultipleRegions (  )  const [inline, protected, virtual]

Reimplemented from casa::ImageTask< Float >.

Definition at line 241 of file ImageProfileFitter.h.

References casacore::True.

void casa::ImageProfileFitter::_updateModelAndResidual ( Bool  fitOK,
const ImageFit1D< Float > &  fitter,
const IPosition &  sliceShape,
const IPosition &  curPos,
Lattice< Bool > *const &  pFitMask,
Lattice< Bool > *const &  pResidMask 
) const [private]
void casa::ImageProfileFitter::createResidualImage ( Bool  b  )  [inline]

for backward compatibility with ia.continuumsub.

If no residual image has been provided, a TempImage is created.

Definition at line 219 of file ImageProfileFitter.h.

References _createResid.

Record casa::ImageProfileFitter::fit ( Bool  doDetailedResults = True  ) 

Do the fit.

If doDetailedResults is False, an empty Record is returned.

String casa::ImageProfileFitter::getClass (  )  const [inline, virtual]

Implements casa::ImageTask< Float >.

Definition at line 130 of file ImageProfileFitter.h.

References _class.

const Array<SHARED_PTR<ProfileFitResults> >& casa::ImageProfileFitter::getFitters (  )  const
SPIIF casa::ImageProfileFitter::getResidual (  )  const [inline]

Definition at line 221 of file ImageProfileFitter.h.

References _residImage.

Record casa::ImageProfileFitter::getResults (  )  const

get the fit results.

If fit was run with doDetailedResults=False, an empty Record is returned

Double casa::ImageProfileFitter::getWorldValue ( Double  pixelVal,
const IPosition &  imPos,
const String &  units,
Bool  velocity,
Bool  wavelength,
Int  tabularIndex = -1,
MFrequency::Types  type = MFrequency::DEFAULT 
) const

Converts a pixel value into a world value either in velocity, wavelength, or frequency units.

If the tabular index >= 0, it uses the tabular index for conversion with the specified MFrequency type, otherwise, it uses the spectral axis for conversion.

void casa::ImageProfileFitter::setAbscissaDivisor ( const Quantity &  q  ) 
void casa::ImageProfileFitter::setAbscissaDivisor ( Double  d  ) 
void casa::ImageProfileFitter::setAmpErrName ( const String &  s  )  [inline]

gaussian amplitude error image name

Definition at line 156 of file ImageProfileFitter.h.

References _ampErrName.

void casa::ImageProfileFitter::setAmpName ( const String &  s  )  [inline]

gaussian amplitude image name

Definition at line 154 of file ImageProfileFitter.h.

References _ampName.

void casa::ImageProfileFitter::setCenterErrName ( const String &  s  )  [inline]

gaussian center error image name

Definition at line 160 of file ImageProfileFitter.h.

References _centerErrName.

void casa::ImageProfileFitter::setCenterName ( const String &  s  )  [inline]

gaussian center image name

Definition at line 158 of file ImageProfileFitter.h.

References _centerName.

void casa::ImageProfileFitter::setDoMultiFit ( const Bool  m  )  [inline]

set whether to do a pixel by pixel fit.

Definition at line 136 of file ImageProfileFitter.h.

References _multiFit.

void casa::ImageProfileFitter::setFWHMErrName ( const String &  s  )  [inline]

gaussian fwhm error image name

Definition at line 164 of file ImageProfileFitter.h.

References _fwhmErrName.

void casa::ImageProfileFitter::setFWHMName ( const String &  s  )  [inline]

gaussian fwhm image name

Definition at line 162 of file ImageProfileFitter.h.

References _fwhmName.

void casa::ImageProfileFitter::setGoodAmpRange ( const Double  min,
const Double  max 
)

set the range over which PFC amplitude solutions are valid

void casa::ImageProfileFitter::setGoodCenterRange ( const Double  min,
const Double  max 
)

set the range over which PFC center solutions are valid

void casa::ImageProfileFitter::setGoodFWHMRange ( const Double  min,
const Double  max 
)

set the range over which PFC FWHM solutions are valid

void casa::ImageProfileFitter::setGoodPlanes ( const std::set< uInt > &  planes  )  [inline]

set the planes along the fit axis that are considered good for performing the fits.

An empty vector implies that all planes are considered "good".

Definition at line 227 of file ImageProfileFitter.h.

References _goodPlanes.

void casa::ImageProfileFitter::setIntegralErrName ( const String &  s  )  [inline]

gaussian integral error image name

Definition at line 168 of file ImageProfileFitter.h.

References _integralErrName.

void casa::ImageProfileFitter::setIntegralName ( const String &  s  )  [inline]

gaussian integral image name

Definition at line 166 of file ImageProfileFitter.h.

References _integralName.

void casa::ImageProfileFitter::setLogResults ( const Bool  logResults  )  [inline]

set if results should be written to the logger

Definition at line 139 of file ImageProfileFitter.h.

References _logResults.

void casa::ImageProfileFitter::setLTPErrName ( const String &  s  )  [inline]

set the name of the logarithmic transformed polynomial image.

Definition at line 181 of file ImageProfileFitter.h.

References _ltpErrName.

void casa::ImageProfileFitter::setLTPName ( const String &  s  )  [inline]

set the name of the logarithmic transformed polynomial image.

Definition at line 178 of file ImageProfileFitter.h.

References _ltpName.

void casa::ImageProfileFitter::setMinGoodPoints ( const uInt  mgp  )  [inline]

set minimum number of good points required to attempt a fit

Definition at line 142 of file ImageProfileFitter.h.

References _minGoodPoints, and ThrowIf.

void casa::ImageProfileFitter::setModel ( const String &  model  )  [inline]

Solution images.

Only written if _multifit is True model image name

Definition at line 150 of file ImageProfileFitter.h.

References _model.

void casa::ImageProfileFitter::setOutputSigmaImage ( const String &  s  )  [inline]

Definition at line 198 of file ImageProfileFitter.h.

References _sigmaName.

void casa::ImageProfileFitter::setPLPErrName ( const String &  s  )  [inline]

set the name of the power logarithmic polynomial image.

Definition at line 175 of file ImageProfileFitter.h.

References _plpErrName.

void casa::ImageProfileFitter::setPLPName ( const String &  s  )  [inline]

set the name of the power logarithmic polynomial image.

Definition at line 172 of file ImageProfileFitter.h.

References _plpName.

void casa::ImageProfileFitter::setPolyOrder ( Int  p  ) 

set the order of a polynomial to be simultaneously fit.

void casa::ImageProfileFitter::setResidual ( const String &  residual  )  [inline]

residual image name

Definition at line 152 of file ImageProfileFitter.h.

References _residual.

void casa::ImageProfileFitter::setSigma ( const ImageInterface< Float > *const &  sigma  ) 
void casa::ImageProfileFitter::setSigma ( const Array< Float > &  sigma  ) 

set standard deviation image


Member Data Documentation

Definition at line 264 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setAmpErrName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setAmpName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setCenterErrName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setCenterName().

const String casa::ImageProfileFitter::_class [static, private]

Definition at line 270 of file ImageProfileFitter.h.

Referenced by getClass().

Definition at line 249 of file ImageProfileFitter.h.

Referenced by createResidualImage().

Definition at line 251 of file ImageProfileFitter.h.

Definition at line 255 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setFWHMErrName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setFWHMName().

PtrHolder<std::pair<Double, Double> > casa::ImageProfileFitter::_goodAmpRange [private]

Definition at line 261 of file ImageProfileFitter.h.

PtrHolder<std::pair<Double, Double> > casa::ImageProfileFitter::_goodCenterRange [private]

Definition at line 261 of file ImageProfileFitter.h.

PtrHolder<std::pair<Double, Double> > casa::ImageProfileFitter::_goodFWHMRange [private]

Definition at line 261 of file ImageProfileFitter.h.

std::set<uInt> casa::ImageProfileFitter::_goodPlanes [private]

planes along _fitAxis to use in fits, empty => use all planes originally used to support continuum subtraction

Definition at line 268 of file ImageProfileFitter.h.

Referenced by setGoodPlanes().

Definition at line 272 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setIntegralErrName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setIntegralName().

Definition at line 249 of file ImageProfileFitter.h.

Definition at line 249 of file ImageProfileFitter.h.

Referenced by setLogResults().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setLTPErrName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setLTPName().

Definition at line 252 of file ImageProfileFitter.h.

Referenced by setMinGoodPoints().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setModel().

Definition at line 265 of file ImageProfileFitter.h.

Definition at line 249 of file ImageProfileFitter.h.

Referenced by setDoMultiFit().

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 260 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Definition at line 252 of file ImageProfileFitter.h.

Reimplemented from casa::ImageTask< Float >.

Definition at line 249 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setPLPErrName().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setPLPName().

Definition at line 251 of file ImageProfileFitter.h.

Definition at line 265 of file ImageProfileFitter.h.

Referenced by getResidual().

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setResidual().

Definition at line 259 of file ImageProfileFitter.h.

SHARED_PTR<TempImage<Float> > casa::ImageProfileFitter::_sigma [private]

Definition at line 263 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.

Referenced by setOutputSigmaImage().

Definition at line 249 of file ImageProfileFitter.h.

SHARED_PTR<const SubImage<Float> > casa::ImageProfileFitter::_subImage [private]

subimage contains the region of the original image on which the fit is performed.

Definition at line 258 of file ImageProfileFitter.h.

Matrix<String> casa::ImageProfileFitter::_worldCoords [private]

Definition at line 262 of file ImageProfileFitter.h.

Definition at line 244 of file ImageProfileFitter.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1