casa
5.7.0-16
|
#include <ImageProfileFitter.h>
Public Member Functions | |
ImageProfileFitter (const SPCIIF image, const casacore::String ®ion, const casacore::Record *const ®ionPtr, const casacore::String &box, const casacore::String &chans, const casacore::String &stokes, const casacore::String &mask, const casacore::Int axis, const casacore::uInt ngauss, casacore::Bool overwrite=false) | |
Top level interface for one-dimensional profile fits. More... | |
ImageProfileFitter (const SPCIIF image, const casacore::String ®ion, const casacore::Record *const ®ionPtr, const casacore::String &box, const casacore::String &chans, const casacore::String &stokes, const casacore::String &mask, const casacore::Int axis, const casacore::String &estimatesFilename, casacore::Bool overwrite=false) | |
Fit only Gaussian singlets and an optional polynomial. More... | |
ImageProfileFitter (const SPCIIF image, const casacore::String ®ion, const casacore::Record *const ®ionPtr, const casacore::String &box, const casacore::String &chans, const casacore::String &stokes, const casacore::String &mask, const casacore::Int axis, const SpectralList &spectralList, casacore::Bool overwrite=false) | |
Fit any permitted combination of spectral components and an optional polynomial. More... | |
~ImageProfileFitter () | |
destructor More... | |
casacore::Record | fit (casacore::Bool doDetailedResults=true) |
Do the fit. More... | |
casacore::Record | getResults () const |
get the fit results. More... | |
casacore::String | getClass () const |
void | setPolyOrder (casacore::Int p) |
set the order of a polynomial to be simultaneously fit. More... | |
void | setDoMultiFit (const casacore::Bool m) |
set whether to do a pixel by pixel fit. More... | |
void | setLogResults (const casacore::Bool logResults) |
set if results should be written to the logger More... | |
void | setMinGoodPoints (const casacore::uInt mgp) |
set minimum number of good points required to attempt a fit More... | |
void | setModel (const casacore::String &model) |
Solution images. More... | |
void | setResidual (const casacore::String &residual) |
residual image name More... | |
void | setAmpName (const casacore::String &s) |
gaussian amplitude image name More... | |
void | setAmpErrName (const casacore::String &s) |
gaussian amplitude error image name More... | |
void | setCenterName (const casacore::String &s) |
gaussian center image name More... | |
void | setCenterErrName (const casacore::String &s) |
gaussian center error image name More... | |
void | setFWHMName (const casacore::String &s) |
gaussian fwhm image name More... | |
void | setFWHMErrName (const casacore::String &s) |
gaussian fwhm error image name More... | |
void | setIntegralName (const casacore::String &s) |
gaussian integral image name More... | |
void | setIntegralErrName (const casacore::String &s) |
gaussian integral error image name More... | |
void | setPLPName (const casacore::String &s) |
set the name of the power logarithmic polynomial image. More... | |
void | setPLPErrName (const casacore::String &s) |
set the name of the power logarithmic polynomial image. More... | |
void | setLTPName (const casacore::String &s) |
set the name of the logarithmic transformed polynomial image. More... | |
void | setLTPErrName (const casacore::String &s) |
set the name of the logarithmic transformed polynomial image. More... | |
void | setGoodAmpRange (const casacore::Double min, const casacore::Double max) |
set the range over which PFC amplitude solutions are valid More... | |
void | setGoodCenterRange (const casacore::Double min, const casacore::Double max) |
set the range over which PFC center solutions are valid More... | |
void | setGoodFWHMRange (const casacore::Double min, const casacore::Double max) |
set the range over which PFC FWHM solutions are valid More... | |
void | setSigma (const casacore::Array< casacore::Float > &sigma) |
set standard deviation image More... | |
void | setSigma (const casacore::ImageInterface< casacore::Float > *const &sigma) |
void | setOutputSigmaImage (const casacore::String &s) |
const casacore::Array < std::shared_ptr < ProfileFitResults > > & | getFitters () const |
casacore::Double | getWorldValue (casacore::Double pixelVal, const casacore::IPosition &imPos, const casacore::String &units, casacore::Bool velocity, casacore::Bool wavelength, casacore::Int tabularIndex=-1, casacore::MFrequency::Types type=casacore::MFrequency::DEFAULT) const |
Converts a pixel value into a world value either in velocity, wavelength, or frequency units. More... | |
void | setAbscissaDivisor (casacore::Double d) |
void | setAbscissaDivisor (const casacore::Quantity &q) |
void | createResidualImage (casacore::Bool b) |
for backward compatibility with ia.continuumsub. More... | |
SPIIF | getResidual () const |
void | setGoodPlanes (const std::set< casacore::uInt > &planes) |
set the planes along the fit axis that are considered good for performing the fits. More... | |
Public Member Functions inherited from casa::ImageTask< casacore::Float > | |
virtual | ~ImageTask () |
void | setStretch (const casacore::Bool stretch) |
void | setLogfile (const casacore::String &lf) |
tacitly does nothing if lf is the empty string. More... | |
void | setLogfileAppend (const casacore::Bool a) |
void | setRegion (const casacore::Record ®ion) |
void | setMask (const casacore::String &mask) |
void | setVerbosity (Verbosity verbosity) |
void | addHistory (const std::vector< std::pair< casacore::String, casacore::String > > &msgs) const |
These messages will appear in the product image history upon the call to _prepareOutputImage(). More... | |
void | addHistory (const casacore::LogOrigin &origin, const casacore::String &msg) const |
void | addHistory (const casacore::LogOrigin &origin, const std::vector< casacore::String > &msgs) const |
void | addHistory (const casacore::LogOrigin &origin, const casacore::String &taskname, const std::vector< casacore::String > ¶mNames, const std::vector< casac::variant > ¶mValues) const |
This adds standard history messages regarding the task that was run and input parameters used. More... | |
void | suppressHistoryWriting (casacore::Bool b) |
suppress writing the history on _prepareOutputImage() call. More... | |
std::vector< std::pair < casacore::String, casacore::String > > | getHistory () |
get the history associated with the task. More... | |
void | setDropDegen (casacore::Bool d) |
Protected Member Functions | |
CasacRegionManager::StokesControl | _getStokesControl () const |
std::vector < casacore::Coordinate::Type > | _getNecessaryCoordinates () const |
Represents the minimum set of coordinates necessary for the task to function. More... | |
casacore::Bool | _hasLogfileSupport () const |
by default, derived classes are configured to have no log file support. More... | |
casacore::Bool | _supportsMultipleRegions () const |
Protected Member Functions inherited from casa::ImageTask< casacore::Float > | |
ImageTask (const SPCIIT image, const casacore::String ®ion, const casacore::Record *const ®ionPtr, const casacore::String &box, const casacore::String &chanInp, const casacore::String &stokes, const casacore::String &maskInp, const casacore::String &outname, casacore::Bool overwrite) | |
if outname is empty, no image will be written if overwrite is True, if image already exists it will be removed if overwrite is False, if image already exists exception will be thrown More... | |
ImageTask (const SPCIIT image, const casacore::Record *const ®ionPtr, const casacore::String &mask, const casacore::String &outname, casacore::Bool overwrite) | |
virtual void | _construct (casacore::Bool verbose=true) |
does the lion's share of constructing the object, ie checks validity of inputs, etc. More... | |
const SPCIIT | _getImage () const |
const casacore::String & | _getMask () const |
const casacore::Record * | _getRegion () const |
void | _setStokes (const casacore::String &stokes) |
const casacore::String & | _getStokes () const |
const casacore::String & | _getChans () const |
const casacore::String & | _getOutname () const |
casacore::Bool | _isPVImage () const |
Is the attached image a position-velocity (PV) image? More... | |
void | _removeExistingOutfileIfNecessary () const |
void | _removeExistingFileIfNecessary (const casacore::String &filename, const casacore::Bool overwrite, casacore::Bool warnOnly=false) const |
if warnOnly is true, log a warning message if file exists and overwrite is true, else throw an exception. More... | |
casacore::String | _summaryHeader () const |
const std::shared_ptr < casacore::LogIO > | _getLog () const |
casacore::Bool | _getStretch () const |
Bool | _getSuppressHistory () const |
const std::shared_ptr< LogFile > | _getLogFile () const |
casacore::Bool | _writeLogfile (const casacore::String &output, const casacore::Bool open=true, const casacore::Bool close=true) |
casacore::Bool | _openLogfile () |
void | _closeLogfile () const |
virtual casacore::Bool | _supportsMultipleBeams () const |
does this task support images with multiple beams? false means it never does. More... | |
SPIIT | _prepareOutputImage (const casacore::ImageInterface< casacore::Float > &image, const casacore::Array< casacore::Float > *const values, const casacore::ArrayLattice< casacore::Bool > *const mask=nullptr, const casacore::IPosition *const outShape=nullptr, const casacore::CoordinateSystem *const coordsys=nullptr, const casacore::String *const outname=nullptr, casacore::Bool overwrite=false, casacore::Bool dropDegen=false) const |
If outname != NULL, use the value supplied. More... | |
SPIIT | _prepareOutputImage (const casacore::ImageInterface< casacore::Float > &image, casacore::Bool dropDegen=false) const |
SPIIT | _prepareOutputImage (const casacore::ImageInterface< casacore::Float > &image, const casacore::String &outname, casacore::Bool overwrite, casacore::Bool warnOnly) const |
if warnOnly is true, only log a warning message if the file exists and overwrite is true, else throw an excepction More... | |
SPIIT | _prepareOutputImage (const casacore::ImageInterface< casacore::Float > &image, const casacore::Lattice< casacore::Float > &data) const |
data are copied to the output image from the data lattice. More... | |
Verbosity | _getVerbosity () const |
casacore::Bool | _getOverwrite () const |
virtual casacore::Bool | _mustHaveSquareDirectionPixels () const |
casacore::Bool | _getDropDegen () const |
void | _doHistory (std::shared_ptr< casacore::ImageInterface< U >> &image) const |
void | _reportOldNewImageShapes (const ImageInterface< casacore::Float > &out) const |
void | _reportOldNewImageShapes (const IPosition &outShape) const |
Static Private Attributes | |
static const casacore::String | _class |
Additional Inherited Members | |
Public Types inherited from casa::ImageTask< casacore::Float > | |
enum | Verbosity |
Virtual base class for image analysis tasks. More... | |
Static Protected Member Functions inherited from casa::ImageTask< casacore::Float > | |
static void | _copyMask (casacore::Lattice< casacore::Bool > &mask, const casacore::ImageInterface< casacore::Float > &image) |
static void | _copyData (casacore::Lattice< casacore::Float > &data, const casacore::Lattice< casacore::Float > &image) |
Definition at line 43 of file ImageProfileFitter.h.
casa::ImageProfileFitter::ImageProfileFitter | ( | const SPCIIF | image, |
const casacore::String & | region, | ||
const casacore::Record *const & | regionPtr, | ||
const casacore::String & | box, | ||
const casacore::String & | chans, | ||
const casacore::String & | stokes, | ||
const casacore::String & | mask, | ||
const casacore::Int | axis, | ||
const casacore::uInt | ngauss, | ||
casacore::Bool | overwrite = false |
||
) |
Top level interface for one-dimensional profile fits.
Fits one-dimensional profiles.
Top level interface for one-dimensional profile fits.
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
- casacore::Stokes plane on which to do the fit. Only a single casacore::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 casacore::String & | region, | ||
const casacore::Record *const & | regionPtr, | ||
const casacore::String & | box, | ||
const casacore::String & | chans, | ||
const casacore::String & | stokes, | ||
const casacore::String & | mask, | ||
const casacore::Int | axis, | ||
const casacore::String & | estimatesFilename, | ||
casacore::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 casacore::String & | region, | ||
const casacore::Record *const & | regionPtr, | ||
const casacore::String & | box, | ||
const casacore::String & | chans, | ||
const casacore::String & | stokes, | ||
const casacore::String & | mask, | ||
const casacore::Int | axis, | ||
const SpectralList & | spectralList, | ||
casacore::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
|
private |
|
private |
|
private |
moved from ImageAnalysis
|
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.
|
private |
casacore::Bool _inVelocitySpace() const;
|
inlineprotectedvirtual |
Represents the minimum set of coordinates necessary for the task to function.
Implements casa::ImageTask< casacore::Float >.
Definition at line 235 of file ImageProfileFitter.h.
|
privatevirtual |
Reimplemented from casa::ImageTask< casacore::Float >.
|
inlineprotectedvirtual |
Implements casa::ImageTask< casacore::Float >.
Definition at line 231 of file ImageProfileFitter.h.
References casa::CasacRegionManager::USE_FIRST_STOKES.
|
inlineprotectedvirtual |
by default, derived classes are configured to have no log file support.
Reimplemented from casa::ImageTask< casacore::Float >.
Definition at line 239 of file ImageProfileFitter.h.
|
private |
|
private |
|
private |
only implemented for the simplest cases so far
|
private |
|
private |
|
inlineprotectedvirtual |
Reimplemented from casa::ImageTask< casacore::Float >.
Definition at line 241 of file ImageProfileFitter.h.
|
private |
|
inline |
for backward compatibility with ia.continuumsub.
If no residual image has been provided, a casacore::TempImage is created.
Definition at line 219 of file ImageProfileFitter.h.
References _createResid.
casacore::Record casa::ImageProfileFitter::fit | ( | casacore::Bool | doDetailedResults = true | ) |
Do the fit.
If doDetailedResults is false, an empty casacore::Record is returned.
|
inlinevirtual |
Implements casa::ImageTask< casacore::Float >.
Definition at line 130 of file ImageProfileFitter.h.
References _class.
const casacore::Array<std::shared_ptr<ProfileFitResults> >& casa::ImageProfileFitter::getFitters | ( | ) | const |
|
inline |
Definition at line 221 of file ImageProfileFitter.h.
References _residImage.
casacore::Record casa::ImageProfileFitter::getResults | ( | ) | const |
get the fit results.
If fit was run with doDetailedResults=false, an empty casacore::Record is returned
casacore::Double casa::ImageProfileFitter::getWorldValue | ( | casacore::Double | pixelVal, |
const casacore::IPosition & | imPos, | ||
const casacore::String & | units, | ||
casacore::Bool | velocity, | ||
casacore::Bool | wavelength, | ||
casacore::Int | tabularIndex = -1 , |
||
casacore::MFrequency::Types | type = casacore::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 casacore::MFrequency type, otherwise, it uses the spectral axis for conversion.
void casa::ImageProfileFitter::setAbscissaDivisor | ( | casacore::Double | d | ) |
void casa::ImageProfileFitter::setAbscissaDivisor | ( | const casacore::Quantity & | q | ) |
|
inline |
gaussian amplitude error image name
Definition at line 156 of file ImageProfileFitter.h.
References _ampErrName.
|
inline |
gaussian amplitude image name
Definition at line 154 of file ImageProfileFitter.h.
References _ampName.
|
inline |
gaussian center error image name
Definition at line 160 of file ImageProfileFitter.h.
References _centerErrName.
|
inline |
gaussian center image name
Definition at line 158 of file ImageProfileFitter.h.
References _centerName.
|
inline |
set whether to do a pixel by pixel fit.
Definition at line 136 of file ImageProfileFitter.h.
References _multiFit.
|
inline |
gaussian fwhm error image name
Definition at line 164 of file ImageProfileFitter.h.
References _fwhmErrName.
|
inline |
void casa::ImageProfileFitter::setGoodAmpRange | ( | const casacore::Double | min, |
const casacore::Double | max | ||
) |
set the range over which PFC amplitude solutions are valid
void casa::ImageProfileFitter::setGoodCenterRange | ( | const casacore::Double | min, |
const casacore::Double | max | ||
) |
set the range over which PFC center solutions are valid
void casa::ImageProfileFitter::setGoodFWHMRange | ( | const casacore::Double | min, |
const casacore::Double | max | ||
) |
set the range over which PFC FWHM solutions are valid
|
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.
|
inline |
gaussian integral error image name
Definition at line 168 of file ImageProfileFitter.h.
References _integralErrName.
|
inline |
gaussian integral image name
Definition at line 166 of file ImageProfileFitter.h.
References _integralName.
|
inline |
set if results should be written to the logger
Definition at line 139 of file ImageProfileFitter.h.
References _logResults.
|
inline |
set the name of the logarithmic transformed polynomial image.
Definition at line 181 of file ImageProfileFitter.h.
References _ltpErrName.
|
inline |
set the name of the logarithmic transformed polynomial image.
Definition at line 178 of file ImageProfileFitter.h.
References _ltpName.
|
inline |
set minimum number of good points required to attempt a fit
Definition at line 142 of file ImageProfileFitter.h.
References _minGoodPoints, and ThrowIf.
|
inline |
Solution images.
Only written if _multifit is true model image name
Definition at line 150 of file ImageProfileFitter.h.
References _model.
|
inline |
Definition at line 198 of file ImageProfileFitter.h.
References _sigmaName.
|
inline |
set the name of the power logarithmic polynomial image.
Definition at line 175 of file ImageProfileFitter.h.
References _plpErrName.
|
inline |
set the name of the power logarithmic polynomial image.
Definition at line 172 of file ImageProfileFitter.h.
References _plpName.
void casa::ImageProfileFitter::setPolyOrder | ( | casacore::Int | p | ) |
set the order of a polynomial to be simultaneously fit.
|
inline |
void casa::ImageProfileFitter::setSigma | ( | const casacore::Array< casacore::Float > & | sigma | ) |
set standard deviation image
void casa::ImageProfileFitter::setSigma | ( | const casacore::ImageInterface< casacore::Float > *const & | sigma | ) |
|
private |
Definition at line 264 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setAmpErrName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setAmpName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setCenterErrName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setCenterName().
|
staticprivate |
Definition at line 270 of file ImageProfileFitter.h.
Referenced by getClass().
|
private |
Definition at line 249 of file ImageProfileFitter.h.
Referenced by createResidualImage().
|
private |
Definition at line 251 of file ImageProfileFitter.h.
|
private |
Definition at line 255 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setFWHMErrName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setFWHMName().
|
private |
Definition at line 261 of file ImageProfileFitter.h.
|
private |
Definition at line 261 of file ImageProfileFitter.h.
|
private |
Definition at line 261 of file ImageProfileFitter.h.
|
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().
|
mutableprivate |
Definition at line 272 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setIntegralErrName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setIntegralName().
|
private |
Definition at line 249 of file ImageProfileFitter.h.
|
private |
Definition at line 249 of file ImageProfileFitter.h.
Referenced by setLogResults().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setLTPErrName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setLTPName().
|
private |
Definition at line 252 of file ImageProfileFitter.h.
Referenced by setMinGoodPoints().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setModel().
|
private |
Definition at line 265 of file ImageProfileFitter.h.
|
private |
Definition at line 249 of file ImageProfileFitter.h.
Referenced by setDoMultiFit().
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 260 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 252 of file ImageProfileFitter.h.
|
private |
Definition at line 249 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setPLPErrName().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setPLPName().
|
private |
Definition at line 251 of file ImageProfileFitter.h.
|
private |
Definition at line 265 of file ImageProfileFitter.h.
Referenced by getResidual().
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setResidual().
|
private |
Definition at line 259 of file ImageProfileFitter.h.
|
private |
Definition at line 263 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.
Referenced by setOutputSigmaImage().
|
private |
Definition at line 249 of file ImageProfileFitter.h.
|
private |
subimage contains the region of the original image on which the fit is performed.
Definition at line 258 of file ImageProfileFitter.h.
|
private |
Definition at line 262 of file ImageProfileFitter.h.
|
private |
Definition at line 244 of file ImageProfileFitter.h.