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

#include <ImageFitter.h>

Inheritance diagram for casa::ImageFitter:
casa::ImageTask

List of all members.

Public Types

enum  CompListWriteControl {
  NO_WRITE,
  WRITE_NO_REPLACE,
  OVERWRITE
}
 Top level interface to ImageAnalysis::fitsky to handle inputs, bookkeeping etc and ultimately call fitsky to do fitting. More...

Public Member Functions

 ImageFitter (const ImageInterface< Float > *const &image, const String &region, const Record *const regionRec, const String &box="", const String &chanInp="", const String &stokes="", const String &maskInp="", const Vector< Float > &includepix=Vector< Float >(0), const Vector< Float > &excludepix=Vector< Float >(0), const String &residualInp="", const String &modelInp="", const String &estiamtesFilename="", const String &newEstimatesInp="", const String &compListName="", const CompListWriteControl writeControl=NO_WRITE)
 constructor approprate for API calls.
 ~ImageFitter ()
 destructor
ComponentList fit ()
 Do the fit.
String getClass () const
Bool converged (uInt plane) const
 Did the fit converge for the specified channel? Throw AipsError if the fit has not yet been done.
Vector< Boolconverged () const
 Did the fit converge? Throw AipsError if the fit has not yet been done.
void setZeroLevelEstimate (const Double estimate, const Bool isFixed)
 set the zero level estimate.
void unsetZeroLevelEstimate ()
 Unset zero level (resets to zero).
void getZeroLevelSolution (vector< Double > &solution, vector< Double > &error)
 get the fitted result and error.

Protected Member Functions

virtual Bool _supportsMultipleRegions ()

Private Member Functions

vector
< ImageInputProcessor::OutputStruct
_getOutputs ()
vector< Coordinate::Type_getNecessaryCoordinates () const
 Represents the minimum set of coordinates necessary for the task to function.
CasacRegionManager::StokesControl _getStokesControl () const
void _finishConstruction (const String &estimatesFilename)
String _resultsHeader () const
String _resultsToString ()
 summarize the results in a nicely formatted string
String _sizeToString (const uInt compNumber) const
 summarize the size details in a nicely formatted string
String _fluxToString (uInt compNumber) const
String _spectrumToString (uInt compNumber) const
void _writeNewEstimatesFile () const
 write output to log file void _writeLogfile(const String& output) const;
void _setFluxes ()
 Set the flux densities and peak intensities of the fitted components.
void _setSizes ()
 Set the convolved sizes of the fitted components.
void _getStandardDeviations (Double &inputStdDev, Double &residStdDev) const
void _getRMSs (Double &inputRMS, Double &residRMS) const
Double _getStatistic (const String &type, const uInt index, const Record &stats) const
String _statisticsToString () const
void setErrors (const Record &residStats)
SubImage< Float_createImageTemplate () const
void _writeCompList (ComponentList &list) const
void _setIncludeExclude (Fit2D &fitter) const
void _fitsky (Fit2D &fitter, Array< Float > &pixels, Array< Bool > &pixelMask, Bool &converged, Double &zeroLevelOffsetSolution, Double &zeroLevelOffsetError, const uInt &chan, const Vector< String > &models, const Bool fitIt, const Bool deconvolveIt, const Bool list, const Double zeroLevelEstimate)
Vector< Double_singleParameterEstimate (Fit2D &fitter, Fit2D::Types model, const MaskedArray< Float > &pixels, Float minVal, Float maxVal, const IPosition &minPos, const IPosition &maxPos) const
ComponentType::Shape _convertModelType (Fit2D::Types typeIn) const
void _fitskyExtractBeam (Vector< Double > &parameters, const ImageInfo &imageInfo, const Bool xIsLong, const CoordinateSystem &cSys) const
void _encodeSkyComponentError (LogIO &os, SkyComponent &sky, Double facToJy, const ImageInterface< Float > &subIm, const Vector< Double > &parameters, const Vector< Double > &errors, Stokes::StokesTypes stokes, Bool xIsLong) const

Private Attributes

String _regionString
String _residual
String _model
String _estimatesString
String _newEstimatesFileName
String _compListName
String _bUnit
Vector< Float_includePixelRange
Vector< Float_excludePixelRange
ComponentList _estimates
ComponentList _curResults
Vector< String_fixed
Bool _fitDone
Bool _noBeam
Bool _doZeroLevel
Bool _zeroLevelIsFixed
Vector< Bool_fitConverged
Vector< Quantity_peakIntensities
Vector< Quantity_peakIntensityErrors
Vector< Quantity_fluxDensityErrors
Vector< Quantity_fluxDensities
Vector< Quantity_majorAxes
Vector< Quantity_majorAxisErrors
Vector< Quantity_minorAxes
Vector< Quantity_minorAxisErrors
Vector< Quantity_positionAngles
Vector< Quantity_positionAngleErrors
Record _residStats
Record inputStats
Double chiSquared
String _kludgedStokes
CompListWriteControl _writeControl
Vector< uInt_chanVec
uInt _curChan
Double _zeroLevelOffsetEstimate
vector< Double_zeroLevelOffsetSolution
vector< Double_zeroLevelOffsetError
Int _stokesPixNumber
Int _chanPixNumber

Static Private Attributes

static const String _class

Detailed Description

Definition at line 42 of file ImageFitter.h.


Member Enumeration Documentation

Top level interface to ImageAnalysis::fitsky to handle inputs, bookkeeping etc and ultimately call fitsky to do fitting.

Etymology

Fits components to sources in images (ImageSourceComponentFitter was deemed to be to long of a name)

Synopsis

ImageFitter is the top level interface for fitting image source components. It handles most of the inputs, bookkeeping etc. It can be instantiated and its one public method, fit, run from either a C++ app or python.

Example

            ImageFitter fitter(...)
            fitter.fit()
Enumerator:
NO_WRITE 
WRITE_NO_REPLACE 
OVERWRITE 

Definition at line 73 of file ImageFitter.h.


Constructor & Destructor Documentation

casa::ImageFitter::ImageFitter ( const ImageInterface< Float > *const &  image,
const String region,
const Record *const  regionRec,
const String box = "",
const String chanInp = "",
const String stokes = "",
const String maskInp = "",
const Vector< Float > &  includepix = VectorFloat >(0),
const Vector< Float > &  excludepix = VectorFloat >(0),
const String residualInp = "",
const String modelInp = "",
const String estiamtesFilename = "",
const String newEstimatesInp = "",
const String compListName = "",
const CompListWriteControl  writeControl = NO_WRITE 
)

constructor approprate for API calls.

Parameters:

  • imagename - the name of the input image in which to fit the models
  • box - A 2-D rectangular box 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
  • regionPtr - A pointer to a region. Note there are unfortunately several different types of region records throughout CASA. In this case, it must be a Record produced by creating a region via a RegionManager method.
  • chanInp - Zero-based channel number on which to do the fit. Only a single channel can be specified.
  • stokes - Stokes plane on which to do the fit. Only a single Stokes parameter can be specified.
  • maskInp - Mask (as LEL) to use as a way to specify which pixels to use
  • includepix - Pixel value range to include in the fit. includepix and excludepix cannot be specified simultaneously.
  • excludepix - Pixel value range to exclude from fit
  • residualInp - Name of residual image to save. Blank means do not save residual image
  • modelInp - Name of the model image to save. Blank means do not save model image

    use these constructors when you already have a pointer to a valid ImageInterface object

destructor


Member Function Documentation

void casa::ImageFitter::_encodeSkyComponentError ( LogIO os,
SkyComponent sky,
Double  facToJy,
const ImageInterface< Float > &  subIm,
const Vector< Double > &  parameters,
const Vector< Double > &  errors,
Stokes::StokesTypes  stokes,
Bool  xIsLong 
) const [private]
void casa::ImageFitter::_finishConstruction ( const String estimatesFilename) [private]
void casa::ImageFitter::_fitsky ( Fit2D fitter,
Array< Float > &  pixels,
Array< Bool > &  pixelMask,
Bool converged,
Double zeroLevelOffsetSolution,
Double zeroLevelOffsetError,
const uInt chan,
const Vector< String > &  models,
const Bool  fitIt,
const Bool  deconvolveIt,
const Bool  list,
const Double  zeroLevelEstimate 
) [private]
void casa::ImageFitter::_fitskyExtractBeam ( Vector< Double > &  parameters,
const ImageInfo imageInfo,
const Bool  xIsLong,
const CoordinateSystem cSys 
) const [private]
String casa::ImageFitter::_fluxToString ( uInt  compNumber) const [private]
vector<Coordinate::Type> casa::ImageFitter::_getNecessaryCoordinates ( ) const [private, virtual]

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

Implements casa::ImageTask.

void casa::ImageFitter::_getRMSs ( Double inputRMS,
Double residRMS 
) const [private]
void casa::ImageFitter::_getStandardDeviations ( Double inputStdDev,
Double residStdDev 
) const [private]
Double casa::ImageFitter::_getStatistic ( const String type,
const uInt  index,
const Record stats 
) const [private]

Implements casa::ImageTask.

summarize the results in a nicely formatted string

void casa::ImageFitter::_setFluxes ( ) [private]

Set the flux densities and peak intensities of the fitted components.

void casa::ImageFitter::_setIncludeExclude ( Fit2D fitter) const [private]
void casa::ImageFitter::_setSizes ( ) [private]

Set the convolved sizes of the fitted components.

Vector<Double> casa::ImageFitter::_singleParameterEstimate ( Fit2D fitter,
Fit2D::Types  model,
const MaskedArray< Float > &  pixels,
Float  minVal,
Float  maxVal,
const IPosition minPos,
const IPosition maxPos 
) const [private]
String casa::ImageFitter::_sizeToString ( const uInt  compNumber) const [private]

summarize the size details in a nicely formatted string

String casa::ImageFitter::_spectrumToString ( uInt  compNumber) const [private]
virtual Bool casa::ImageFitter::_supportsMultipleRegions ( ) [inline, protected, virtual]

Reimplemented from casa::ImageTask.

Definition at line 148 of file ImageFitter.h.

References casa::True.

void casa::ImageFitter::_writeCompList ( ComponentList list) const [private]

write output to log file void _writeLogfile(const String& output) const;

Write the estimates file using this fit.

Did the fit converge for the specified channel? Throw AipsError if the fit has not yet been done.

plane is relative to the first plane in the image chosen to be fit.

Did the fit converge? Throw AipsError if the fit has not yet been done.

plane is relative to the first plane in the image chosen to be fit.

Do the fit.

If componentList is specified, store the fitted components in that object.

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

Implements casa::ImageTask.

Definition at line 123 of file ImageFitter.h.

References _class.

void casa::ImageFitter::getZeroLevelSolution ( vector< Double > &  solution,
vector< Double > &  error 
)

get the fitted result and error.

Throws an exception if the zero level was not fit for.

void casa::ImageFitter::setErrors ( const Record residStats) [private]
void casa::ImageFitter::setZeroLevelEstimate ( const Double  estimate,
const Bool  isFixed 
)

set the zero level estimate.

Implies fitting of zero level should be done. Must be called before fit() to have an effect.

Unset zero level (resets to zero).

Implies fitting of zero level should not be done. Call prior to fit().


Member Data Documentation

Definition at line 152 of file ImageFitter.h.

Definition at line 170 of file ImageFitter.h.

Definition at line 166 of file ImageFitter.h.

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

Definition at line 172 of file ImageFitter.h.

Referenced by getClass().

Definition at line 152 of file ImageFitter.h.

Definition at line 167 of file ImageFitter.h.

Definition at line 155 of file ImageFitter.h.

Definition at line 157 of file ImageFitter.h.

Definition at line 155 of file ImageFitter.h.

Definition at line 152 of file ImageFitter.h.

Definition at line 154 of file ImageFitter.h.

Definition at line 158 of file ImageFitter.h.

Definition at line 157 of file ImageFitter.h.

Definition at line 156 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 154 of file ImageFitter.h.

Definition at line 164 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 152 of file ImageFitter.h.

Definition at line 152 of file ImageFitter.h.

Definition at line 157 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 159 of file ImageFitter.h.

Definition at line 152 of file ImageFitter.h.

Definition at line 162 of file ImageFitter.h.

Definition at line 152 of file ImageFitter.h.

Definition at line 170 of file ImageFitter.h.

Definition at line 165 of file ImageFitter.h.

Definition at line 157 of file ImageFitter.h.

Definition at line 169 of file ImageFitter.h.

Definition at line 168 of file ImageFitter.h.

Definition at line 169 of file ImageFitter.h.

Definition at line 163 of file ImageFitter.h.

Definition at line 162 of file ImageFitter.h.


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