casa
$Rev:20696$
|
#include <ImageProfileFitter.h>
Public Member Functions | |
ImageProfileFitter (const ImageInterface< Float > *const &image, const String ®ion, const Record *const ®ionPtr, const String &box, const String &chans, const String &stokes, const String &mask, const Int axis, const uInt ngauss, const String &estimatesFilename, const SpectralList &spectralList) | |
Top level interface for one-dimensional profile fits. | |
~ImageProfileFitter () | |
destructor | |
Record | fit () |
Do the fit. | |
Record | getResults () const |
get the fit results | |
String | getClass () const |
CasacRegionManager::StokesControl | _getStokesControl () const |
vector< Coordinate::Type > | _getNecessaryCoordinates () const |
Represents the minimum set of coordinates necessary for the task to function. | |
void | setPolyOrder (const 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 | setGoodAmpRange (const Double min, const Double max) |
void | setGoodCenterRange (const Double min, const Double max) |
void | setGoodFWHMRange (const Double min, const Double max) |
void | setSigma (const Array< Float > &sigma) |
set standard deviation image | |
void | setSigma (const ImageInterface< Float > *const &sigma) |
void | setOutputSigmaImage (const String &s) |
const Array< ImageFit1D< Float > > & | getFitters () const |
const Vector< Double > | getPixelCenter (uint index) const |
Returns the center, in pixels of the indexth fit. | |
Double | getWorldValue (double pixelVal, const IPosition &imPos, const String &units, bool velocity, bool wavelength) const |
Converts a pixel value into a world value either in velocity, wavelength, or frequency units. | |
Static Public Attributes | |
static const String | _CONVERGED |
static const String | _SUCCEEDED |
static const String | _VALID |
Private Types | |
enum | gaussSols { AMP, CENTER, FWHM, INTEGRAL, AMPERR, CENTERERR, FWHMERR, INTEGRALERR, NGSOLMATRICES } |
Private Member Functions | |
void | _getOutputStruct (vector< ImageInputProcessor::OutputStruct > &outputs) |
void | _checkNGaussAndPolyOrder () const |
void | _finishConstruction () |
void | _setResults () |
String | _radToRa (const Float ras) const |
void | _resultsToLog () |
String | _getTag (const uInt i) const |
String | _elementToString (const Double value, const Double error, const String &unit) const |
String | _pcfToString (const PCFSpectralElement *const &pcf, const CoordinateSystem &csys, const Vector< Double > world, const IPosition imPos, const Bool showTypeString=True, const String &indent="") const |
String | _gaussianMultipletToString (const GaussianMultipletSpectralElement &gm, const CoordinateSystem &csys, const Vector< Double > world, const IPosition imPos) const |
String | _polynomialToString (const PolynomialSpectralElement &poly, const CoordinateSystem &csys, const Vector< Double > imPix, const Vector< Double > world) const |
void | _insertPCF (vector< vector< Matrix< Double > > > &pcfMatrices, const uInt idx, const PCFSpectralElement &pcf, const uInt row, const uInt col, const IPosition &pos, const Double increment) const |
void | _writeImages (const CoordinateSystem &csys, const Array< Bool > &mask, const String &yUnit) const |
void | _fitProfile (const Bool fitIt=True) |
*void | _fitallprofiles () |
moved from ImageAnalysis | |
void | _fitProfiles (std::auto_ptr< ImageInterface< Float > > &pFit, std::auto_ptr< ImageInterface< Float > > &pResid, const Bool showProgress=False) |
Fit all profiles in image. | |
Double | _fitAxisIncrement () const |
Double | _centerWorld (const PCFSpectralElement &solution, const IPosition &imPos) const |
Bool | _inVelocitySpace () const |
void | _flagFitterIfNecessary (ImageFit1D< Float > &fitter) const |
Bool | _isPCFSolutionOK (const PCFSpectralElement *const &pcf) const |
Static Private Member Functions | |
static void | _makeSolutionImage (const String &name, const CoordinateSystem &csys, const Array< Double > &values, const String &unit, const Array< Bool > &mask) |
Private Attributes | |
String | _residual |
String | _model |
String | _regionString |
String | _xUnit |
String | _centerName |
String | _centerErrName |
String | _fwhmName |
String | _fwhmErrName |
String | _ampName |
String | _ampErrName |
String | _integralName |
String | _integralErrName |
String | _sigmaName |
Bool | _logfileAppend |
Bool | _fitConverged |
Bool | _fitDone |
Bool | _multiFit |
Bool | _deleteImageOnDestruct |
Bool | _logResults |
Int | _polyOrder |
Int | _fitAxis |
uInt | _nGaussSinglets |
uInt | _nGaussMultiplets |
uInt | _nLorentzSinglets |
uInt | _minGoodPoints |
Array< ImageFit1D< Float > > | _fitters |
SubImage< Float > | _subImage |
subimage contains the region of the original image on which the fit is performed. | |
Record | _results |
SpectralList | _nonPolyEstimates |
Vector< Double > | _goodAmpRange |
Vector< Double > | _goodCenterRange |
Vector< Double > | _goodFWHMRange |
std::auto_ptr< TempImage< Float > > | _sigma |
Vector< Vector< Double > > | _pixelPositions |
Static Private Attributes | |
static const String | _class |
static const uInt | _nOthers |
static const uInt | _gsPlane |
static const uInt | _lsPlane |
Definition at line 41 of file ImageProfileFitter.h.
enum casa::ImageProfileFitter::gaussSols [private] |
Definition at line 206 of file ImageProfileFitter.h.
casa::ImageProfileFitter::ImageProfileFitter | ( | const ImageInterface< Float > *const & | 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, | ||
const String & | estimatesFilename, | ||
const SpectralList & | spectralList | ||
) |
Top level interface for one-dimensional profile fits.
Fits one-dimensional profiles.
Top level interface for one-dimensional profile fits.
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 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. 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. Not used if estimatesFile
or spectralList
is specified. 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(). Only one of a non-empty estimatesFilename
or a non-empty spectralList
can be specified.
destructor
Double casa::ImageProfileFitter::_centerWorld | ( | const PCFSpectralElement & | solution, |
const IPosition & | imPos | ||
) | const [private] |
void casa::ImageProfileFitter::_checkNGaussAndPolyOrder | ( | ) | const [private] |
String casa::ImageProfileFitter::_elementToString | ( | const Double | value, |
const Double | error, | ||
const String & | unit | ||
) | const [private] |
void casa::ImageProfileFitter::_finishConstruction | ( | ) | [private] |
* void casa::ImageProfileFitter::_fitallprofiles | ( | ) | [private] |
moved from ImageAnalysis
Double casa::ImageProfileFitter::_fitAxisIncrement | ( | ) | const [private] |
void casa::ImageProfileFitter::_fitProfile | ( | const Bool | fitIt = True | ) | [private] |
void casa::ImageProfileFitter::_fitProfiles | ( | std::auto_ptr< ImageInterface< Float > > & | pFit, |
std::auto_ptr< ImageInterface< Float > > & | pResid, | ||
const Bool | showProgress = False |
||
) | [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] |
String casa::ImageProfileFitter::_gaussianMultipletToString | ( | const GaussianMultipletSpectralElement & | gm, |
const CoordinateSystem & | csys, | ||
const Vector< Double > | world, | ||
const IPosition | imPos | ||
) | const [private] |
vector<Coordinate::Type> casa::ImageProfileFitter::_getNecessaryCoordinates | ( | ) | const [inline, virtual] |
Represents the minimum set of coordinates necessary for the task to function.
Implements casa::ImageTask.
Definition at line 110 of file ImageProfileFitter.h.
void casa::ImageProfileFitter::_getOutputStruct | ( | vector< ImageInputProcessor::OutputStruct > & | outputs | ) | [private] |
CasacRegionManager::StokesControl casa::ImageProfileFitter::_getStokesControl | ( | ) | const [inline, virtual] |
Implements casa::ImageTask.
Definition at line 106 of file ImageProfileFitter.h.
References casa::CasacRegionManager::USE_FIRST_STOKES.
String casa::ImageProfileFitter::_getTag | ( | const uInt | i | ) | const [private] |
void casa::ImageProfileFitter::_insertPCF | ( | vector< vector< Matrix< Double > > > & | pcfMatrices, |
const uInt | idx, | ||
const PCFSpectralElement & | pcf, | ||
const uInt | row, | ||
const uInt | col, | ||
const IPosition & | pos, | ||
const Double | increment | ||
) | const [private] |
Bool casa::ImageProfileFitter::_inVelocitySpace | ( | ) | const [private] |
Bool casa::ImageProfileFitter::_isPCFSolutionOK | ( | const PCFSpectralElement *const & | pcf | ) | const [private] |
static void casa::ImageProfileFitter::_makeSolutionImage | ( | const String & | name, |
const CoordinateSystem & | csys, | ||
const Array< Double > & | values, | ||
const String & | unit, | ||
const Array< Bool > & | mask | ||
) | [static, private] |
String casa::ImageProfileFitter::_pcfToString | ( | const PCFSpectralElement *const & | pcf, |
const CoordinateSystem & | csys, | ||
const Vector< Double > | world, | ||
const IPosition | imPos, | ||
const Bool | showTypeString = True , |
||
const String & | indent = "" |
||
) | const [private] |
String casa::ImageProfileFitter::_polynomialToString | ( | const PolynomialSpectralElement & | poly, |
const CoordinateSystem & | csys, | ||
const Vector< Double > | imPix, | ||
const Vector< Double > | world | ||
) | const [private] |
String casa::ImageProfileFitter::_radToRa | ( | const Float | ras | ) | const [private] |
void casa::ImageProfileFitter::_resultsToLog | ( | ) | [private] |
void casa::ImageProfileFitter::_setResults | ( | ) | [private] |
void casa::ImageProfileFitter::_writeImages | ( | const CoordinateSystem & | csys, |
const Array< Bool > & | mask, | ||
const String & | yUnit | ||
) | const [private] |
Do the fit.
String casa::ImageProfileFitter::getClass | ( | ) | const [inline, virtual] |
const Array<ImageFit1D<Float> >& casa::ImageProfileFitter::getFitters | ( | ) | const |
const Vector<Double> casa::ImageProfileFitter::getPixelCenter | ( | uint | index | ) | const |
Returns the center, in pixels of the indexth fit.
Record casa::ImageProfileFitter::getResults | ( | ) | const |
get the fit results
Double casa::ImageProfileFitter::getWorldValue | ( | double | pixelVal, |
const IPosition & | imPos, | ||
const String & | units, | ||
bool | velocity, | ||
bool | wavelength | ||
) | const |
Converts a pixel value into a world value either in velocity, wavelength, or frequency units.
void casa::ImageProfileFitter::setAmpErrName | ( | const String & | s | ) | [inline] |
gaussian amplitude error image name
Definition at line 135 of file ImageProfileFitter.h.
References _ampErrName.
void casa::ImageProfileFitter::setAmpName | ( | const String & | s | ) | [inline] |
gaussian amplitude image name
Definition at line 133 of file ImageProfileFitter.h.
References _ampName.
void casa::ImageProfileFitter::setCenterErrName | ( | const String & | s | ) | [inline] |
gaussian center error image name
Definition at line 139 of file ImageProfileFitter.h.
References _centerErrName.
void casa::ImageProfileFitter::setCenterName | ( | const String & | s | ) | [inline] |
gaussian center image name
Definition at line 137 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 118 of file ImageProfileFitter.h.
References _multiFit.
void casa::ImageProfileFitter::setFWHMErrName | ( | const String & | s | ) | [inline] |
gaussian fwhm error image name
Definition at line 143 of file ImageProfileFitter.h.
References _fwhmErrName.
void casa::ImageProfileFitter::setFWHMName | ( | const String & | s | ) | [inline] |
void casa::ImageProfileFitter::setGoodAmpRange | ( | const Double | min, |
const Double | max | ||
) |
void casa::ImageProfileFitter::setGoodCenterRange | ( | const Double | min, |
const Double | max | ||
) |
void casa::ImageProfileFitter::setGoodFWHMRange | ( | const Double | min, |
const Double | max | ||
) |
void casa::ImageProfileFitter::setIntegralErrName | ( | const String & | s | ) | [inline] |
gaussian integral error image name
Definition at line 147 of file ImageProfileFitter.h.
References _integralErrName.
void casa::ImageProfileFitter::setIntegralName | ( | const String & | s | ) | [inline] |
gaussian integral image name
Definition at line 145 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 121 of file ImageProfileFitter.h.
References _logResults.
void casa::ImageProfileFitter::setMinGoodPoints | ( | const uInt | mgp | ) | [inline] |
set minimum number of good points required to attempt a fit
Definition at line 124 of file ImageProfileFitter.h.
References _minGoodPoints.
void casa::ImageProfileFitter::setModel | ( | const String & | model | ) | [inline] |
Solution images.
Only written if _multifit is True model image name
Definition at line 129 of file ImageProfileFitter.h.
References _model.
void casa::ImageProfileFitter::setOutputSigmaImage | ( | const String & | s | ) | [inline] |
Definition at line 162 of file ImageProfileFitter.h.
References _sigmaName.
void casa::ImageProfileFitter::setPolyOrder | ( | const Int | p | ) | [inline] |
set the order of a polynomial to be simultaneously fit.
Definition at line 115 of file ImageProfileFitter.h.
References _polyOrder.
void casa::ImageProfileFitter::setResidual | ( | const String & | residual | ) | [inline] |
void casa::ImageProfileFitter::setSigma | ( | const Array< Float > & | sigma | ) |
set standard deviation image
void casa::ImageProfileFitter::setSigma | ( | const ImageInterface< Float > *const & | sigma | ) |
String casa::ImageProfileFitter::_ampErrName [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setAmpErrName().
String casa::ImageProfileFitter::_ampName [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setAmpName().
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setCenterErrName().
String casa::ImageProfileFitter::_centerName [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setCenterName().
const String casa::ImageProfileFitter::_class [static, private] |
Definition at line 199 of file ImageProfileFitter.h.
Referenced by getClass().
const String casa::ImageProfileFitter::_CONVERGED [static] |
Definition at line 166 of file ImageProfileFitter.h.
Definition at line 184 of file ImageProfileFitter.h.
Int casa::ImageProfileFitter::_fitAxis [private] |
Definition at line 186 of file ImageProfileFitter.h.
Bool casa::ImageProfileFitter::_fitConverged [private] |
Definition at line 184 of file ImageProfileFitter.h.
Bool casa::ImageProfileFitter::_fitDone [private] |
Definition at line 184 of file ImageProfileFitter.h.
Array<ImageFit1D<Float> > casa::ImageProfileFitter::_fitters [private] |
Definition at line 189 of file ImageProfileFitter.h.
String casa::ImageProfileFitter::_fwhmErrName [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setFWHMErrName().
String casa::ImageProfileFitter::_fwhmName [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setFWHMName().
Vector<Double> casa::ImageProfileFitter::_goodAmpRange [private] |
Definition at line 195 of file ImageProfileFitter.h.
Definition at line 195 of file ImageProfileFitter.h.
Vector<Double> casa::ImageProfileFitter::_goodFWHMRange [private] |
Definition at line 195 of file ImageProfileFitter.h.
const uInt casa::ImageProfileFitter::_gsPlane [static, private] |
Definition at line 202 of file ImageProfileFitter.h.
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setIntegralErrName().
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setIntegralName().
Bool casa::ImageProfileFitter::_logfileAppend [private] |
Reimplemented from casa::ImageTask.
Definition at line 184 of file ImageProfileFitter.h.
Bool casa::ImageProfileFitter::_logResults [private] |
Definition at line 184 of file ImageProfileFitter.h.
Referenced by setLogResults().
const uInt casa::ImageProfileFitter::_lsPlane [static, private] |
Definition at line 203 of file ImageProfileFitter.h.
uInt casa::ImageProfileFitter::_minGoodPoints [private] |
Definition at line 187 of file ImageProfileFitter.h.
Referenced by setMinGoodPoints().
String casa::ImageProfileFitter::_model [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setModel().
Bool casa::ImageProfileFitter::_multiFit [private] |
Definition at line 184 of file ImageProfileFitter.h.
Referenced by setDoMultiFit().
Definition at line 187 of file ImageProfileFitter.h.
Definition at line 187 of file ImageProfileFitter.h.
Definition at line 187 of file ImageProfileFitter.h.
Definition at line 194 of file ImageProfileFitter.h.
const uInt casa::ImageProfileFitter::_nOthers [static, private] |
Definition at line 201 of file ImageProfileFitter.h.
Vector< Vector<Double> > casa::ImageProfileFitter::_pixelPositions [private] |
Definition at line 310 of file ImageProfileFitter.h.
Int casa::ImageProfileFitter::_polyOrder [private] |
Definition at line 186 of file ImageProfileFitter.h.
Referenced by setPolyOrder().
Definition at line 180 of file ImageProfileFitter.h.
String casa::ImageProfileFitter::_residual [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setResidual().
Record casa::ImageProfileFitter::_results [private] |
Definition at line 193 of file ImageProfileFitter.h.
std::auto_ptr<TempImage<Float> > casa::ImageProfileFitter::_sigma [private] |
Definition at line 197 of file ImageProfileFitter.h.
String casa::ImageProfileFitter::_sigmaName [private] |
Definition at line 180 of file ImageProfileFitter.h.
Referenced by setOutputSigmaImage().
SubImage<Float> casa::ImageProfileFitter::_subImage [private] |
subimage contains the region of the original image on which the fit is performed.
Definition at line 192 of file ImageProfileFitter.h.
const String casa::ImageProfileFitter::_SUCCEEDED [static] |
Definition at line 167 of file ImageProfileFitter.h.
const String casa::ImageProfileFitter::_VALID [static] |
Definition at line 168 of file ImageProfileFitter.h.
String casa::ImageProfileFitter::_xUnit [private] |
Definition at line 180 of file ImageProfileFitter.h.