#include <ImageFitter.h>
Public Member Functions | |
ImageFitter () | |
Top level interface to ImageAnalysis::fitsky to handle inputs, bookkeeping etc and ultimately call fitsky to do fitting. | |
ImageFitter (const SPCIIF image, const String ®ion, const Record *const ®ionRec, const String &box="", const String &chanInp="", const String &stokes="", const String &maskInp="", const String &estiamtesFilename="", const String &newEstimatesInp="", const String &compListName="") | |
constructor appropriate for API calls. | |
ImageFitter (const ImageFitter &other) | |
~ImageFitter () | |
destructor | |
std::pair< ComponentList, ComponentList > | fit () |
Do the fit. | |
void | setWriteControl (ImageFitterResults::CompListWriteControl x) |
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 (Double estimate, 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. | |
void | setRMS (const Quantity &rms) |
set rms level for calculating uncertainties. | |
void | setIncludePixelRange (const std::pair< Float, Float > &r) |
void | setExcludePixelRange (const std::pair< Float, Float > &r) |
void | setModel (const String &m) |
set the output model image name | |
void | setResidual (const String &r) |
set the output residual image name | |
void | setNoiseFWHM (const Quantity &q) |
set noise correlation beam FWHM | |
void | setNoiseFWHM (Double d) |
in pixel widths | |
void | clearNoiseFWHM () |
clear noise FWHM, if the image has no beam, use the uncorrelated noise equations. | |
Record | getOutputRecord () const |
The Record holding all the output info. | |
void | setSummaryFile (const String &f) |
Set The summary text file name. | |
Protected Member Functions | |
virtual Bool | _hasLogfileSupport () const |
by default, derived classes are configured to have no log file support. | |
virtual Bool | _supportsMultipleRegions () const |
Private Member Functions | |
void | _fitLoop (Bool &anyConverged, ComponentList &convolvedList, ComponentList &deconvolvedList, SPIIF templateImage, SPIIF residualImage, SPIIF modelImage, String &resultsString) |
vector < OutputDestinationChecker::OutputStruct > | _getOutputStruct () |
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 | _resultsToString (uInt nPixels) const |
String _resultsHeader() const;. | |
String | _sizeToString (const uInt compNumber) const |
summarize the size details in a nicely formatted string | |
String | _spectrumToString (uInt compNumber) const |
void | _setDeconvolvedSizes () |
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 |
SPIIF | _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, std::pair< Int, Int > &pixelOffsets, const Vector< String > &models, Bool fitIt, Bool deconvolveIt, 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 (SkyComponent &sky, Double facToJy, const CoordinateSystem &csys, const Vector< Double > ¶meters, const Vector< Double > &errors, Stokes::StokesTypes stokes, Bool xIsLong) const |
void | _doConverged (ComponentList &convolvedList, ComponentList &deconvolvedList, Double &zeroLevelOffsetEstimate, std::pair< Int, Int > &pixelOffsets, SPIIF &residualImage, SPIIF &modelImage, SHARED_PTR< TempImage< Float > > &tImage, SHARED_PTR< ArrayLattice< Bool > > &initMask, Double zeroLevelOffsetSolution, Double zeroLevelOffsetError, Bool hasSpectralAxis, Int spectralAxisNumber, Bool outputImages, const IPosition &planeShape, const Array< Float > &pixels, const Array< Bool > &pixelMask, const Fit2D &fitter, SPIIF templateImage) |
Quantity | _pixelWidth () |
void | _calculateErrors () |
Double | _getRMS () const |
Double | _correlatedOverallSNR (uInt comp, Double a, Double b, Double signalToNoise) const |
GaussianBeam | _getCurrentBeam () const |
void | _createOutputRecord (const ComponentList &convolved, const ComponentList &decon) |
void | _setSum (const SkyComponent &comp, const SubImage< Float > &im, uInt compNum) |
void | _setBeam (GaussianBeam &beam, uInt ngauss) |
Private Attributes | |
String | _regionString |
String | _residual |
String | _newEstimatesFileName |
String | _compListName |
String | _bUnit |
_curConvolvedList | |
_curDeconvolvedList | |
_deconvolvedMessages | |
_correlatedNoise | |
_useBeamForNoise | |
_peakIntensityErrors | |
_fluxDensityErrors | |
_fluxDensities | |
_majorAxes | |
_majorAxisErrors | |
_minorAxes | |
_minorAxisErrors | |
_positionAngles | |
_positionAngleErrors | |
vector< GaussianBeam > | _allBeams |
vector< Double > | _allBeamsPix |
vector< Double > | _allBeamsSter |
vector< uInt > | _allChanNums |
vector< Bool > | _isPoint |
Record | _residStats |
Record | inputStats |
Record | _output |
Double | _rms |
String | _kludgedStokes |
ImageFitterResults::CompListWriteControl | _writeControl |
Vector< uInt > | _chanVec |
uInt | _curChan |
Double | _zeroLevelOffsetEstimate |
vector< Double > | _zeroLevelOffsetSolution |
vector< Double > | _zeroLevelOffsetError |
Int | _stokesPixNumber |
Int | _chanPixNumber |
ImageFitterResults | _results |
Static Private Attributes | |
static const String | _class |
Definition at line 38 of file ImageFitter.h.
casa::ImageFitter::ImageFitter | ( | ) |
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()
casa::ImageFitter::ImageFitter | ( | const SPCIIF | image, | |
const String & | region, | |||
const Record *const & | regionRec, | |||
const String & | box = "" , |
|||
const String & | chanInp = "" , |
|||
const String & | stokes = "" , |
|||
const String & | maskInp = "" , |
|||
const String & | estiamtesFilename = "" , |
|||
const String & | newEstimatesInp = "" , |
|||
const String & | compListName = "" | |||
) |
constructor appropriate 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
casa::ImageFitter::ImageFitter | ( | const ImageFitter & | other | ) |
casa::ImageFitter::~ImageFitter | ( | ) |
destructor
void casa::ImageFitter::_calculateErrors | ( | ) | [private] |
ComponentType::Shape casa::ImageFitter::_convertModelType | ( | Fit2D::Types | typeIn | ) | const [private] |
Double casa::ImageFitter::_correlatedOverallSNR | ( | uInt | comp, | |
Double | a, | |||
Double | b, | |||
Double | signalToNoise | |||
) | const [private] |
SPIIF casa::ImageFitter::_createImageTemplate | ( | ) | const [private] |
void casa::ImageFitter::_createOutputRecord | ( | const ComponentList & | convolved, | |
const ComponentList & | decon | |||
) | [private] |
void casa::ImageFitter::_doConverged | ( | ComponentList & | convolvedList, | |
ComponentList & | deconvolvedList, | |||
Double & | zeroLevelOffsetEstimate, | |||
std::pair< Int, Int > & | pixelOffsets, | |||
SPIIF & | residualImage, | |||
SPIIF & | modelImage, | |||
SHARED_PTR< TempImage< Float > > & | tImage, | |||
SHARED_PTR< ArrayLattice< Bool > > & | initMask, | |||
Double | zeroLevelOffsetSolution, | |||
Double | zeroLevelOffsetError, | |||
Bool | hasSpectralAxis, | |||
Int | spectralAxisNumber, | |||
Bool | outputImages, | |||
const IPosition & | planeShape, | |||
const Array< Float > & | pixels, | |||
const Array< Bool > & | pixelMask, | |||
const Fit2D & | fitter, | |||
SPIIF | templateImage | |||
) | [private] |
void casa::ImageFitter::_encodeSkyComponentError | ( | SkyComponent & | sky, | |
Double | facToJy, | |||
const CoordinateSystem & | csys, | |||
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::_fitLoop | ( | Bool & | anyConverged, | |
ComponentList & | convolvedList, | |||
ComponentList & | deconvolvedList, | |||
SPIIF | templateImage, | |||
SPIIF | residualImage, | |||
SPIIF | modelImage, | |||
String & | resultsString | |||
) | [private] |
void casa::ImageFitter::_fitsky | ( | Fit2D & | fitter, | |
Array< Float > & | pixels, | |||
Array< Bool > & | pixelMask, | |||
Bool & | converged, | |||
Double & | zeroLevelOffsetSolution, | |||
Double & | zeroLevelOffsetError, | |||
std::pair< Int, Int > & | pixelOffsets, | |||
const Vector< String > & | models, | |||
Bool | fitIt, | |||
Bool | deconvolveIt, | |||
Double | zeroLevelEstimate | |||
) | [private] |
void casa::ImageFitter::_fitskyExtractBeam | ( | Vector< Double > & | parameters, | |
const ImageInfo & | imageInfo, | |||
const Bool | xIsLong, | |||
const CoordinateSystem & | cSys | |||
) | const [private] |
GaussianBeam casa::ImageFitter::_getCurrentBeam | ( | ) | 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< Float >.
vector<OutputDestinationChecker::OutputStruct> casa::ImageFitter::_getOutputStruct | ( | ) | [private, virtual] |
Reimplemented from casa::ImageTask< Float >.
Double casa::ImageFitter::_getRMS | ( | ) | const [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< Float >.
virtual Bool casa::ImageFitter::_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 179 of file ImageFitter.h.
References casacore::True.
Quantity casa::ImageFitter::_pixelWidth | ( | ) | [private] |
String casa::ImageFitter::_resultsToString | ( | uInt | nPixels | ) | const [private] |
String _resultsHeader() const;.
summarize the results in a nicely formatted string
void casa::ImageFitter::_setBeam | ( | GaussianBeam & | beam, | |
uInt | ngauss | |||
) | [private] |
void casa::ImageFitter::_setDeconvolvedSizes | ( | ) | [private] |
void casa::ImageFitter::_setIncludeExclude | ( | Fit2D & | fitter | ) | const [private] |
void casa::ImageFitter::_setSum | ( | const SkyComponent & | comp, | |
const SubImage< Float > & | im, | |||
uInt | compNum | |||
) | [private] |
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 | ( | ) | const [inline, protected, virtual] |
Reimplemented from casa::ImageTask< Float >.
Definition at line 181 of file ImageFitter.h.
References casacore::True.
void casa::ImageFitter::_writeCompList | ( | ComponentList & | list | ) | const [private] |
void casa::ImageFitter::clearNoiseFWHM | ( | ) |
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.
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.
std::pair<ComponentList, ComponentList> casa::ImageFitter::fit | ( | ) |
Do the fit.
If componentList is specified, store the fitted components in that object. The first list in the returned pair represents the convolved components. The second list represents the deconvolved components. If the image has no beam, the two lists will be the same.
String casa::ImageFitter::getClass | ( | ) | const [inline, virtual] |
Implements casa::ImageTask< Float >.
Definition at line 119 of file ImageFitter.h.
References _class.
Record casa::ImageFitter::getOutputRecord | ( | ) | const [inline] |
The Record holding all the output info.
Definition at line 172 of file ImageFitter.h.
References _output.
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::setExcludePixelRange | ( | const std::pair< Float, Float > & | r | ) | [inline] |
Definition at line 150 of file ImageFitter.h.
void casa::ImageFitter::setIncludePixelRange | ( | const std::pair< Float, Float > & | r | ) | [inline] |
Definition at line 146 of file ImageFitter.h.
void casa::ImageFitter::setModel | ( | const String & | m | ) | [inline] |
set the output model image name
Definition at line 155 of file ImageFitter.h.
void casa::ImageFitter::setNoiseFWHM | ( | Double | d | ) |
in pixel widths
void casa::ImageFitter::setNoiseFWHM | ( | const Quantity & | q | ) |
set noise correlation beam FWHM
void casa::ImageFitter::setResidual | ( | const String & | r | ) | [inline] |
set the output residual image name
Definition at line 158 of file ImageFitter.h.
References _residual.
void casa::ImageFitter::setRMS | ( | const Quantity & | rms | ) |
set rms level for calculating uncertainties.
If not positive, an exception is thrown.
void casa::ImageFitter::setSummaryFile | ( | const String & | f | ) | [inline] |
Set The summary text file name.
Definition at line 175 of file ImageFitter.h.
void casa::ImageFitter::setWriteControl | ( | ImageFitterResults::CompListWriteControl | x | ) | [inline] |
Definition at line 117 of file ImageFitter.h.
References _writeControl.
void casa::ImageFitter::setZeroLevelEstimate | ( | Double | estimate, | |
Bool | isFixed | |||
) |
set the zero level estimate.
Implies fitting of zero level should be done. Must be called before fit() to have an effect.
void casa::ImageFitter::unsetZeroLevelEstimate | ( | ) |
Unset zero level (resets to zero).
Implies fitting of zero level should not be done. Call prior to fit().
vector<GaussianBeam> casa::ImageFitter::_allBeams [private] |
Definition at line 199 of file ImageFitter.h.
vector<Double> casa::ImageFitter::_allBeamsPix [private] |
Definition at line 202 of file ImageFitter.h.
vector<Double> casa::ImageFitter::_allBeamsSter [private] |
Definition at line 202 of file ImageFitter.h.
vector<uInt> casa::ImageFitter::_allChanNums [private] |
Definition at line 203 of file ImageFitter.h.
String casa::ImageFitter::_bUnit [private] |
Definition at line 188 of file ImageFitter.h.
Int casa::ImageFitter::_chanPixNumber [private] |
Definition at line 213 of file ImageFitter.h.
Vector<uInt> casa::ImageFitter::_chanVec [private] |
Definition at line 209 of file ImageFitter.h.
const String casa::ImageFitter::_class [static, private] |
Definition at line 215 of file ImageFitter.h.
Referenced by getClass().
String casa::ImageFitter::_compListName [private] |
Definition at line 188 of file ImageFitter.h.
casa::ImageFitter::_correlatedNoise [private] |
Definition at line 193 of file ImageFitter.h.
uInt casa::ImageFitter::_curChan [private] |
Definition at line 210 of file ImageFitter.h.
casa::ImageFitter::_curConvolvedList [private] |
Definition at line 190 of file ImageFitter.h.
casa::ImageFitter::_curDeconvolvedList [private] |
Definition at line 190 of file ImageFitter.h.
casa::ImageFitter::_deconvolvedMessages [private] |
Definition at line 192 of file ImageFitter.h.
casa::ImageFitter::_fluxDensities [private] |
Definition at line 195 of file ImageFitter.h.
casa::ImageFitter::_fluxDensityErrors [private] |
Definition at line 195 of file ImageFitter.h.
vector<Bool> casa::ImageFitter::_isPoint [private] |
Definition at line 204 of file ImageFitter.h.
String casa::ImageFitter::_kludgedStokes [private] |
Definition at line 207 of file ImageFitter.h.
casa::ImageFitter::_majorAxes [private] |
Definition at line 195 of file ImageFitter.h.
casa::ImageFitter::_majorAxisErrors [private] |
Definition at line 195 of file ImageFitter.h.
casa::ImageFitter::_minorAxes [private] |
Definition at line 195 of file ImageFitter.h.
casa::ImageFitter::_minorAxisErrors [private] |
Definition at line 195 of file ImageFitter.h.
String casa::ImageFitter::_newEstimatesFileName [private] |
Definition at line 188 of file ImageFitter.h.
Record casa::ImageFitter::_output [private] |
Definition at line 205 of file ImageFitter.h.
Referenced by getOutputRecord().
casa::ImageFitter::_peakIntensityErrors [private] |
Definition at line 195 of file ImageFitter.h.
casa::ImageFitter::_positionAngleErrors [private] |
Definition at line 195 of file ImageFitter.h.
casa::ImageFitter::_positionAngles [private] |
Definition at line 195 of file ImageFitter.h.
String casa::ImageFitter::_regionString [private] |
Definition at line 187 of file ImageFitter.h.
Record casa::ImageFitter::_residStats [private] |
Definition at line 205 of file ImageFitter.h.
String casa::ImageFitter::_residual [private] |
Definition at line 188 of file ImageFitter.h.
Referenced by setResidual().
Definition at line 214 of file ImageFitter.h.
Double casa::ImageFitter::_rms [private] |
Definition at line 206 of file ImageFitter.h.
Int casa::ImageFitter::_stokesPixNumber [private] |
Definition at line 213 of file ImageFitter.h.
casa::ImageFitter::_useBeamForNoise [private] |
Definition at line 193 of file ImageFitter.h.
Definition at line 208 of file ImageFitter.h.
Referenced by setWriteControl().
vector<Double> casa::ImageFitter::_zeroLevelOffsetError [private] |
Definition at line 212 of file ImageFitter.h.
Double casa::ImageFitter::_zeroLevelOffsetEstimate [private] |
Definition at line 211 of file ImageFitter.h.
vector<Double> casa::ImageFitter::_zeroLevelOffsetSolution [private] |
Definition at line 212 of file ImageFitter.h.
Record casa::ImageFitter::inputStats [private] |
Definition at line 205 of file ImageFitter.h.