casa
$Rev:20696$
|
#include <ImageFitter.h>
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 ®ion, 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< Bool > | converged () 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 > ¶meters, 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 > ¶meters, 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 |
Definition at line 42 of file ImageFitter.h.
Top level interface to ImageAnalysis::fitsky to handle inputs, bookkeeping etc and ultimately call fitsky to do fitting.
Fits components to sources in images (ImageSourceComponentFitter was deemed to be to long of a name)
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.
ImageFitter fitter(...) fitter.fit()
Definition at line 73 of file ImageFitter.h.
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 = 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.
Parameters:
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
ComponentType::Shape casa::ImageFitter::_convertModelType | ( | Fit2D::Types | typeIn | ) | const [private] |
SubImage<Float> casa::ImageFitter::_createImageTemplate | ( | ) | const [private] |
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.
vector<ImageInputProcessor::OutputStruct> casa::ImageFitter::_getOutputs | ( | ) | [private] |
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] |
CasacRegionManager::StokesControl casa::ImageFitter::_getStokesControl | ( | ) | const [private, virtual] |
Implements casa::ImageTask.
String casa::ImageFitter::_resultsHeader | ( | ) | const [private] |
String casa::ImageFitter::_resultsToString | ( | ) | [private] |
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] |
String casa::ImageFitter::_statisticsToString | ( | ) | 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] |
void casa::ImageFitter::_writeNewEstimatesFile | ( | ) | const [private] |
write output to log file void _writeLogfile(const String& output) const;
Write the estimates file using this fit.
Bool casa::ImageFitter::converged | ( | uInt | plane | ) | const |
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.
Vector<Bool> casa::ImageFitter::converged | ( | ) | const |
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] |
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().
String casa::ImageFitter::_bUnit [private] |
Definition at line 152 of file ImageFitter.h.
Int casa::ImageFitter::_chanPixNumber [private] |
Definition at line 170 of file ImageFitter.h.
Vector<uInt> casa::ImageFitter::_chanVec [private] |
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().
String casa::ImageFitter::_compListName [private] |
Definition at line 152 of file ImageFitter.h.
uInt casa::ImageFitter::_curChan [private] |
Definition at line 167 of file ImageFitter.h.
ComponentList casa::ImageFitter::_curResults [private] |
Definition at line 155 of file ImageFitter.h.
Bool casa::ImageFitter::_doZeroLevel [private] |
Definition at line 157 of file ImageFitter.h.
ComponentList casa::ImageFitter::_estimates [private] |
Definition at line 155 of file ImageFitter.h.
String casa::ImageFitter::_estimatesString [private] |
Definition at line 152 of file ImageFitter.h.
Vector<Float> casa::ImageFitter::_excludePixelRange [private] |
Definition at line 154 of file ImageFitter.h.
Vector<Bool> casa::ImageFitter::_fitConverged [private] |
Definition at line 158 of file ImageFitter.h.
Bool casa::ImageFitter::_fitDone [private] |
Definition at line 157 of file ImageFitter.h.
Vector<String> casa::ImageFitter::_fixed [private] |
Definition at line 156 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_fluxDensities [private] |
Definition at line 159 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_fluxDensityErrors [private] |
Definition at line 159 of file ImageFitter.h.
Vector<Float> casa::ImageFitter::_includePixelRange [private] |
Definition at line 154 of file ImageFitter.h.
String casa::ImageFitter::_kludgedStokes [private] |
Definition at line 164 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_majorAxes [private] |
Definition at line 159 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_majorAxisErrors [private] |
Definition at line 159 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_minorAxes [private] |
Definition at line 159 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_minorAxisErrors [private] |
Definition at line 159 of file ImageFitter.h.
String casa::ImageFitter::_model [private] |
Definition at line 152 of file ImageFitter.h.
Definition at line 152 of file ImageFitter.h.
Bool casa::ImageFitter::_noBeam [private] |
Definition at line 157 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_peakIntensities [private] |
Definition at line 159 of file ImageFitter.h.
Definition at line 159 of file ImageFitter.h.
Definition at line 159 of file ImageFitter.h.
Vector<Quantity> casa::ImageFitter::_positionAngles [private] |
Definition at line 159 of file ImageFitter.h.
String casa::ImageFitter::_regionString [private] |
Definition at line 152 of file ImageFitter.h.
Record casa::ImageFitter::_residStats [private] |
Definition at line 162 of file ImageFitter.h.
String casa::ImageFitter::_residual [private] |
Definition at line 152 of file ImageFitter.h.
Int casa::ImageFitter::_stokesPixNumber [private] |
Definition at line 170 of file ImageFitter.h.
Definition at line 165 of file ImageFitter.h.
Bool casa::ImageFitter::_zeroLevelIsFixed [private] |
Definition at line 157 of file ImageFitter.h.
vector<Double> casa::ImageFitter::_zeroLevelOffsetError [private] |
Definition at line 169 of file ImageFitter.h.
Definition at line 168 of file ImageFitter.h.
vector<Double> casa::ImageFitter::_zeroLevelOffsetSolution [private] |
Definition at line 169 of file ImageFitter.h.
Double casa::ImageFitter::chiSquared [private] |
Definition at line 163 of file ImageFitter.h.
Record casa::ImageFitter::inputStats [private] |
Definition at line 162 of file ImageFitter.h.