Class Model¶
Defined in File Model.h
Inheritance Relationships¶
Derived Type¶
public lsst::meas::modelfit::MultiModel
(Class MultiModel)
Class Documentation¶
-
class
Model
¶ Abstract base class and concrete factories that define multi-shapelet galaxy models.
A Model provides a mapping from its parameters to ellipses and to a realization using shapelet objects. A Model does not “hold” its parameters; parameters are always stored in separate arrays.
Model parameters are split into three categories: nonlinear, amplitudes, and fixed. These are described more fully in modelfitParameters.
A few private concrete subclasses of Model have been provided that will meet most needs; instances can be constructed via the make() and makeGaussian()
Subclassed by lsst::meas::modelfit::MultiModel
Public Types
-
typedef std::vector<std::string>
NameVector
¶
-
typedef std::vector<PTR(shapelet::MultiShapeletBasis)>
BasisVector
¶
Public Functions
-
int
getNonlinearDim
() const¶ Return the number of free nonlinear parameters.
-
int
getAmplitudeDim
() const¶ Return the number of linear parameters.
-
int
getFixedDim
() const¶ Return the number of fixed nonlinear parameters.
-
int
getBasisCount
() const¶ Return the number of MultiShapeletBasis objects (equivalently, the number of ellipses)
-
NameVector const &
getNonlinearNames
() const¶ Return the names of the free nonlinear parameters.
-
NameVector const &
getAmplitudeNames
() const¶ Return the names of the amplitude parameters.
-
NameVector const &
getFixedNames
() const¶ Return the names of the fixed nonlinear parameters.
-
BasisVector const &
getBasisVector
() const¶ Return the MultiShapeletBasis objects that comprise the Model.
-
shapelet::MultiShapeletFunction
makeShapeletFunction
(ndarray::Array<Scalar const, 1, 1> const &nonlinear, ndarray::Array<Scalar const, 1, 1> const &litudes, ndarray::Array<Scalar const, 1, 1> const &fixed) const¶ Create a MultiShapeletFunction object from a set of parameter vectors.
-
virtual
PTR
(Prior) const = 0¶ Given an arbitrary prior, return one compatible with this Model or throw LogicError.
-
virtual EllipseVector
makeEllipseVector
() const = 0¶ Return an uninitialized vector of afw::geom::ellipses::Ellipse with the parametrization expected by readEllipses() and writeEllipses().
-
virtual void
writeEllipses
(Scalar const *nonlinearIter, Scalar const *fixedIter, EllipseIterator ellipseIter) const = 0¶ Convert a set of nonlinear+fixed parameter arrays to a vector of ellipses.
- Warning
The ellipse iterator must point to an EllipseVector originally constructed by makeEllipseVector()
- Warning
Calling writeEllipses() followed by readEllipses() does not guarantee that that the parameters on output will be the same as those on input, as the parameters may be degenerate. However, calling readEllipses() followed by writeEllipses() is guaranteed to round-trip the ellipses.
- Parameters
[in] nonlinearIter
: Pointer to the beginning of a nonlinear parameter array.[in] fixedIter
: Pointer to the beginning of a fixed parameter array.[out] ellipseIter
: Iterator to the beginning of an ellipse vector, as returned by makeEllipseVector().
-
virtual void
readEllipses
(EllipseConstIterator ellipseIter, Scalar *nonlinearIter, Scalar *fixedIter) const = 0¶ Convert a vector of ellipses to a set of nonlinear+fixed parameter arrays.
- Warning
The ellipse iterator must point to an EllipseVector originally constructed by makeEllipseVector()
- Warning
Calling writeEllipses() followed by readEllipses() does not guarantee that that the parameters on output will be the same as those on input, as the parameters may be degenerate. However, calling readEllipses() followed by writeEllipses() is guaranteed to round-trip the ellipses.
- Parameters
[in] ellipseIter
: Iterator to the beginning of an ellipse vector, as returned by makeEllipseVector().[out] nonlinearIter
: Pointer to the beginning of a nonlinear parameter array.[out] fixedIter
: Pointer to the beginning of a fixed parameter array.
-
EllipseVector
writeEllipses
(ndarray::Array<Scalar const, 1, 1> const &nonlinear, ndarray::Array<Scalar const, 1, 1> const &fixed) const¶ Convert a set of nonlinear+fixed parameter arrays to a vector of ellipses.
This is a convenient method that combines the call to
makeEllipseVector() with a call to the other overload of writeEllipses(), for cases when there is no need to reuse an existing ellipse vector.- Parameters
[in] nonlinear
: nonlinear parameter array.[in] fixed
: fixed parameter array.
-
void
readEllipses
(EllipseVector const &ellipses, ndarray::Array<Scalar, 1, 1> const &nonlinear, ndarray::Array<Scalar, 1, 1> const &fixed) const¶ Convert a vector of ellipses to a set of nonlinear+fixed parameter arrays.
- Warning
The EllipseVector must have been originally constructed by makeEllipseVector()
- Parameters
[in] ellipses
: An ellipse vector, as returned by makeEllipseVector().[out] nonlinear
: Output nonlinear parameter array.[out] fixed
: Output fixed parameter array.
-
virtual void
transformParameters
(LocalUnitTransform const &transform, ndarray::Array<Scalar, 1, 1> const &nonlinear, ndarray::Array<Scalar, 1, 1> const &litudes, ndarray::Array<Scalar, 1, 1> const &fixed) const¶ Transform (in-place) parameter vectors from one unit system to another.
The default implementation transforms nonlinear and fixed parameters by converting them to ellipses, transforming the ellipses, and converting back to parameters. The amplitudes are simply multiplied by transform.flux. Subclasses for which this isn’t appropriate should override.
-
virtual
~Model
()¶
Public Members
-
NameVector const &
prefixes
¶
-
NameVector const CenterEnum lsst::meas::modelfit::Model::center
-
static PTR (Model) make(PTR(shapelet double lsst::meas::modelfit::Model::radius =1.0)
Public Static Functions
-
static
PTR
(Model)¶ Construct a concrete Model instance with multiple ellipses and multishapelet bases
This can be used to construct a multi-component model (for instance, a bulge-disk decomposition), using MultiShapeletBasis objects such as those loaded by the lsst.shapelet.tractor module.
- Parameters
[in] basisVector
: A vector of MultiShapeletBasis objects, one for each component. Each component will have a separate set of ellipse parameters.[in] prefixes
: A vector of parameter name prefixes, one for each basis. These will be prepended to the names described in the documentation for the other overload of make().[in] center
: An enum specifying whether the different components should have a fixed center (FIXED_CENTER), the same center (SINGLE_CENTER), or independent centers (MULTI_CENTER).
-
static static PTR (Model) make(PTR(shapelet lsst::meas::modelfit::Model::PTR(Model)
Construct a concrete Model instance with a single ellipse and multishapelet basis
This can be used to construct a single-component model (e.g. a single fixed-index Sersic profile), or a linear combination model with only one ellipse.
The names of the nonlinear and fixed parameters will be [“eta1”, “eta2”, “logR”, “x”, “y”], with “x” and “y” in the fixed parameters if center==FIXED_CENTER. The amplitudes will be labeled “alphaN”, where “N” is an integer starting from 0.
- Parameters
[in] basis
: A MultiShapeletBasis object, of the sort provided by the lsst.shapelet.tractor module.[in] center
: An enum specifying whether the model should have a fixed center (FIXED_CENTER) or parametrized center (SINGLE_CENTER or MULTI_CENTER).
As implied by the parameter names, the ellipse is parametrized using afw::geom::ellipses::SeparableConformalShearLogTraceRadius. For the basis objects provided by lsst.shapelet.tractor, that generally means that logR=0 corresponds to the half-light radius. Construct a concrete Model instance that represents a single elliptical Gaussian function.
The Models returned by this method use the same ellipse parametrization and naming schemes as those returned by make().
- Parameters
[in] center
: An enum specifying whether the model should have a fixed center (FIXED_CENTER) or parametrized center (SINGLE_CENTER or MULTI_CENTER).[in] radius
: The radius at which logR=0, in units of the Gaussian sigma parameter (i.e. radius=1 corresponds to a model in which the radius parameter is ln(sigma)).
Protected Functions
-
Model
(BasisVector basisVector, NameVector nonlinearNames, NameVector amplitudeNames, NameVector fixedNames)¶
-
typedef std::vector<std::string>