LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::meas::modelfit::MultiModel Class Reference

A concrete Model class that simply concatenates several other Models. More...

#include <MultiModel.h>

Inheritance diagram for lsst::meas::modelfit::MultiModel:
lsst::meas::modelfit::Model

Public Types

enum  CenterEnum { FIXED_CENTER = 0x0 , SINGLE_CENTER = 0x1 , MULTI_CENTER = 0x2 }
 
typedef std::vector< std::stringNameVector
 
typedef std::vector< std::shared_ptr< shapelet::MultiShapeletBasis > > BasisVector
 
typedef std::vector< afw::geom::ellipses::EllipseEllipseVector
 
typedef std::vector< afw::geom::ellipses::Ellipse >::iterator EllipseIterator
 
typedef std::vector< afw::geom::ellipses::Ellipse >::const_iterator EllipseConstIterator
 

Public Member Functions

 MultiModel (ModelVector components, NameVector const &prefixes)
 Construct a new MultiModel.
 
ModelVector const & getComponents () const
 Return the vector of constituent models.
 
std::shared_ptr< PrioradaptPrior (std::shared_ptr< Prior > prior) const override
 Given an arbitrary prior, return one compatible with this Model or throw LogicError.
 
EllipseVector makeEllipseVector () const override
 Return an uninitialized vector of afw::geom::ellipses::Ellipse with the parametrization expected by readEllipses() and writeEllipses().
 
void writeEllipses (Scalar const *nonlinearIter, Scalar const *fixedIter, EllipseIterator ellipseIter) const override
 Convert a set of nonlinear+fixed parameter arrays to a vector of ellipses.
 
void readEllipses (EllipseConstIterator ellipseIter, Scalar *nonlinearIter, Scalar *fixedIter) const override
 Convert a vector of ellipses to a set of nonlinear+fixed parameter arrays.
 
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 &amplitudes, ndarray::Array< Scalar const, 1, 1 > const &fixed) const
 Create a MultiShapeletFunction object from a set of parameter vectors.
 
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.
 
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.
 
virtual void transformParameters (LocalUnitTransform const &transform, ndarray::Array< Scalar, 1, 1 > const &nonlinear, ndarray::Array< Scalar, 1, 1 > const &amplitudes, ndarray::Array< Scalar, 1, 1 > const &fixed) const
 Transform (in-place) parameter vectors from one unit system to another.
 

Static Public Member Functions

static std::shared_ptr< Modelmake (BasisVector basisVector, NameVector const &prefixes, CenterEnum center)
 Construct a concrete Model instance with multiple ellipses and multishapelet bases.
 
static std::shared_ptr< Modelmake (std::shared_ptr< shapelet::MultiShapeletBasis > basis, CenterEnum center)
 Construct a concrete Model instance with a single ellipse and multishapelet basis.
 
static std::shared_ptr< ModelmakeGaussian (CenterEnum center, double radius=1.0)
 Construct a concrete Model instance that represents a single elliptical Gaussian function.
 

Detailed Description

A concrete Model class that simply concatenates several other Models.

Definition at line 34 of file MultiModel.h.

Member Typedef Documentation

◆ BasisVector

Definition at line 66 of file Model.h.

◆ EllipseConstIterator

Definition at line 69 of file Model.h.

◆ EllipseIterator

Definition at line 68 of file Model.h.

◆ EllipseVector

Definition at line 67 of file Model.h.

◆ NameVector

Definition at line 65 of file Model.h.

Member Enumeration Documentation

◆ CenterEnum

Enumerator
FIXED_CENTER 
SINGLE_CENTER 
MULTI_CENTER 

Definition at line 59 of file Model.h.

Constructor & Destructor Documentation

◆ MultiModel()

lsst::meas::modelfit::MultiModel::MultiModel ( ModelVector components,
NameVector const & prefixes )
explicit

Construct a new MultiModel.

Parameters
[in]componentsA vector of other Models to combine
[in]prefixesA vector of name prefixes used to construct parameter names, one for each element in components.

Member Function Documentation

◆ adaptPrior()

std::shared_ptr< Prior > lsst::meas::modelfit::MultiModel::adaptPrior ( std::shared_ptr< Prior > prior) const
overridevirtual

Given an arbitrary prior, return one compatible with this Model or throw LogicError.

Implements lsst::meas::modelfit::Model.

◆ getAmplitudeDim()

int lsst::meas::modelfit::Model::getAmplitudeDim ( ) const
inlineinherited

Return the number of linear parameters.

Definition at line 127 of file Model.h.

127{ return _amplitudeNames.size(); }
T size(T... args)

◆ getAmplitudeNames()

NameVector const & lsst::meas::modelfit::Model::getAmplitudeNames ( ) const
inlineinherited

Return the names of the amplitude parameters.

Definition at line 139 of file Model.h.

139{ return _amplitudeNames; }

◆ getBasisCount()

int lsst::meas::modelfit::Model::getBasisCount ( ) const
inlineinherited

Return the number of MultiShapeletBasis objects (equivalently, the number of ellipses)

Definition at line 133 of file Model.h.

133{ return _basisVector.size(); }

◆ getBasisVector()

BasisVector const & lsst::meas::modelfit::Model::getBasisVector ( ) const
inlineinherited

Return the MultiShapeletBasis objects that comprise the Model.

Definition at line 145 of file Model.h.

145{ return _basisVector; }

◆ getComponents()

ModelVector const & lsst::meas::modelfit::MultiModel::getComponents ( ) const
inline

Return the vector of constituent models.

Definition at line 47 of file MultiModel.h.

47{ return _components; }

◆ getFixedDim()

int lsst::meas::modelfit::Model::getFixedDim ( ) const
inlineinherited

Return the number of fixed nonlinear parameters.

Definition at line 130 of file Model.h.

130{ return _fixedNames.size(); }

◆ getFixedNames()

NameVector const & lsst::meas::modelfit::Model::getFixedNames ( ) const
inlineinherited

Return the names of the fixed nonlinear parameters.

Definition at line 142 of file Model.h.

142{ return _fixedNames; }

◆ getNonlinearDim()

int lsst::meas::modelfit::Model::getNonlinearDim ( ) const
inlineinherited

Return the number of free nonlinear parameters.

Definition at line 124 of file Model.h.

124{ return _nonlinearNames.size(); }

◆ getNonlinearNames()

NameVector const & lsst::meas::modelfit::Model::getNonlinearNames ( ) const
inlineinherited

Return the names of the free nonlinear parameters.

Definition at line 136 of file Model.h.

136{ return _nonlinearNames; }

◆ make() [1/2]

static std::shared_ptr< Model > lsst::meas::modelfit::Model::make ( BasisVector basisVector,
NameVector const & prefixes,
CenterEnum center )
staticinherited

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]basisVectorA vector of MultiShapeletBasis objects, one for each component. Each component will have a separate set of ellipse parameters.
[in]prefixesA 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]centerAn enum specifying whether the different components should have a fixed center (FIXED_CENTER), the same center (SINGLE_CENTER), or independent centers (MULTI_CENTER).

◆ make() [2/2]

static std::shared_ptr< Model > lsst::meas::modelfit::Model::make ( std::shared_ptr< shapelet::MultiShapeletBasis > basis,
CenterEnum center )
staticinherited

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.

Parameters
[in]basisA MultiShapeletBasis object, of the sort provided by the lsst.shapelet.tractor module.
[in]centerAn enum specifying whether the model should have a fixed center (FIXED_CENTER) or parametrized center (SINGLE_CENTER or MULTI_CENTER).

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.

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.

◆ makeEllipseVector()

EllipseVector lsst::meas::modelfit::MultiModel::makeEllipseVector ( ) const
overridevirtual

Return an uninitialized vector of afw::geom::ellipses::Ellipse with the parametrization expected by readEllipses() and writeEllipses().

Implements lsst::meas::modelfit::Model.

◆ makeGaussian()

static std::shared_ptr< Model > lsst::meas::modelfit::Model::makeGaussian ( CenterEnum center,
double radius = 1.0 )
staticinherited

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]centerAn enum specifying whether the model should have a fixed center (FIXED_CENTER) or parametrized center (SINGLE_CENTER or MULTI_CENTER).
[in]radiusThe 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)).

◆ makeShapeletFunction()

shapelet::MultiShapeletFunction lsst::meas::modelfit::Model::makeShapeletFunction ( ndarray::Array< Scalar const, 1, 1 > const & nonlinear,
ndarray::Array< Scalar const, 1, 1 > const & amplitudes,
ndarray::Array< Scalar const, 1, 1 > const & fixed ) const
inherited

Create a MultiShapeletFunction object from a set of parameter vectors.

◆ readEllipses() [1/2]

void lsst::meas::modelfit::MultiModel::readEllipses ( EllipseConstIterator ellipseIter,
Scalar * nonlinearIter,
Scalar * fixedIter ) const
overridevirtual

Convert a vector of ellipses to a set of nonlinear+fixed parameter arrays.

Parameters
[in]ellipseIterIterator to the beginning of an ellipse vector, as returned by makeEllipseVector().
[out]nonlinearIterPointer to the beginning of a nonlinear parameter array.
[out]fixedIterPointer to the beginning of a fixed parameter array.
Warning
The ellipse iterator must point to an EllipseVector originally constructed by makeEllipseVector()
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.

Implements lsst::meas::modelfit::Model.

◆ readEllipses() [2/2]

void lsst::meas::modelfit::Model::readEllipses ( EllipseVector const & ellipses,
ndarray::Array< Scalar, 1, 1 > const & nonlinear,
ndarray::Array< Scalar, 1, 1 > const & fixed ) const
inherited

Convert a vector of ellipses to a set of nonlinear+fixed parameter arrays.

Parameters
[in]ellipsesAn ellipse vector, as returned by makeEllipseVector().
[out]nonlinearOutput nonlinear parameter array.
[out]fixedOutput fixed parameter array.
Warning
The EllipseVector must have been originally constructed by makeEllipseVector()

◆ transformParameters()

virtual void lsst::meas::modelfit::Model::transformParameters ( LocalUnitTransform const & transform,
ndarray::Array< Scalar, 1, 1 > const & nonlinear,
ndarray::Array< Scalar, 1, 1 > const & amplitudes,
ndarray::Array< Scalar, 1, 1 > const & fixed ) const
virtualinherited

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.

◆ writeEllipses() [1/2]

EllipseVector lsst::meas::modelfit::Model::writeEllipses ( ndarray::Array< Scalar const, 1, 1 > const & nonlinear,
ndarray::Array< Scalar const, 1, 1 > const & fixed ) const
inherited

Convert a set of nonlinear+fixed parameter arrays to a vector of ellipses.

Parameters
[in]nonlinearnonlinear parameter array.
[in]fixedfixed parameter array.

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.

◆ writeEllipses() [2/2]

void lsst::meas::modelfit::MultiModel::writeEllipses ( Scalar const * nonlinearIter,
Scalar const * fixedIter,
EllipseIterator ellipseIter ) const
overridevirtual

Convert a set of nonlinear+fixed parameter arrays to a vector of ellipses.

Parameters
[in]nonlinearIterPointer to the beginning of a nonlinear parameter array.
[in]fixedIterPointer to the beginning of a fixed parameter array.
[out]ellipseIterIterator to the beginning of an ellipse vector, as returned by makeEllipseVector().
Warning
The ellipse iterator must point to an EllipseVector originally constructed by makeEllipseVector()
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.

Implements lsst::meas::modelfit::Model.


The documentation for this class was generated from the following file: