28 #ifndef LATTICES_FIT2D_H
29 #define LATTICES_FIT2D_H
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Arrays/ArrayFwd.h>
34 #include <casacore/scimath/Functionals/CompoundFunction.h>
35 #include <casacore/casa/BasicSL/Constants.h>
36 #include <casacore/scimath/Fitting/NonLinearFitLM.h>
37 #include <casacore/casa/Logging/LogIO.h>
41 template<
class T>
class Lattice;
42 template<
class T>
class MaskedLattice;
331 }
else if (
value < range(0) ||
value > range(1)) {
340 #ifndef CASACORE_NO_AUTO_TEMPLATES
341 #include <casacore/lattices/LatticeMath/Fit2D2.tcc>
Fit2D::ErrorTypes fit(const Array< T > &data, const Array< Bool > &mask, const Array< T > &sigma)
Fit2D::ErrorTypes residual(Array< Float > &resid, Array< Float > &model, const Lattice< Float > &data)
Vector< Double > estimate(Fit2D::Types type, const Lattice< T > &data)
Bool selectData(Matrix< Double > &pos, Vector< Double > &values, Vector< Double > &weights, const Array< T > &pixels, const Array< Bool > &mask, const Array< T > &sigma)
Vector< Double > estimate(Fit2D::Types type, const Array< T > &data)
Vector< Double > availableSolution(uInt &iStart, uInt which) const
Returns available (adjustable + fixed) solution for model of interest and tells you where it began in...
uInt addModel(Fit2D::Types type, const Vector< Double > ¶meters, const Vector< Bool > ¶meterMask)
Add a model to the list to be simultaneously fit and return its index.
String errorMessage() const
If function fit failed, you will find a message here saying why it failed.
Vector< Double > estimate(Fit2D::Types type, const MaskedLattice< T > &data)
Determine an initial estimate for the solution of the specified model type to the given data - no com...
Fit2D::ErrorTypes fit(const Lattice< T > &data, const Lattice< T > &sigma)
Fit2D(LogIO &logger)
Constructor.
static Double paToGauss2D(Double pa)
Convert p.a.
Fit2D(const Fit2D &other)
Copy constructor.
Vector< Double > itsSolution
void setIncludeRange(Double minVal, Double maxVal)
Set a pixel selection range.
NonLinearFitLM< Double > itsFitter
static uInt nParameters(Fit2D::Types type)
Return number of parameters for this type of model.
Vector< Double > availableSolution() const
Recover solution for either all model components or a specific one.
Vector< uInt > itsTypeList
Vector< Double > availableErrors() const
The errors.
Double chiSquared() const
The chi squared of the fit.
Fit2D::ErrorTypes fit(const MaskedLattice< T > &data, const Lattice< T > &sigma)
Do the fit.
static Vector< Bool > convertMask(const String fixedmask, Fit2D::Types type)
Convert mask from a string to a vector.
CompoundFunction< AutoDiff< Double > > itsFunction
static String type(Fit2D::Types type)
Return type as a string.
void setExcludeRange(Double minVal, Double maxVal)
uInt addModel(Fit2D::Types type, const Vector< Double > ¶meters)
Fit2D::ErrorTypes residual(Array< Float > &resid, Array< Float > &model, const MaskedLattice< Float > &data)
Vector< Double > availableErrors(uInt &iStart, uInt which) const
uInt numberIterations() const
The number of iterations that the fitter finished with.
Fit2D::ErrorTypes fitData(const Vector< Double > &values, const Matrix< Double > &pos, const Vector< Double > &sigma)
Vector< Double > estimate(Fit2D::Types type, const Array< T > &data, const Array< Bool > &mask)
Vector< Double > getParams(uInt which) const
Types
Enum describing the different models you can fit.
void piRange(Double &pa) const
static Fit2D::Types type(const String &type)
Return string type as enum (min match)
Fit2D::Types type(uInt which)
Find type of specific model.
uInt nModels() const
Recover number of models.
Fit2D & operator=(const Fit2D &other)
Assignment operator.
Vector< Double > itsErrors
Vector< Double > availableErrors(uInt which) const
void setParams(const Vector< Double > ¶ms, uInt which)
Fit2D::ErrorTypes fit(const Array< T > &data, const Array< T > &sigma)
ErrorTypes
Enum describing output error conditions.
@ NOGOOD
There were no unmasked points.
@ NOCONVERGE
Did not converge.
@ nErrorTypes
Number of conditions.
Vector< Double > availableSolution(uInt which) const
Vector< Double > itsPixelRange
Fit2D::ErrorTypes residual(Array< T > &resid, Array< T > &model, const Array< T > &data, Int xOffset=0, int yOffset=0) const
Find the residuals to the fit.
uInt numberPoints() const
The number of points used for the last fit.
Bool includeIt(Double value, const Vector< Double > &range, Int includeIt) const
static Double paFromGauss2D(Double pa)
Convert p.a.
String: the storage and methods of handling collections of characters.
this file contains all the compiler specific defines
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.