LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Types | Public Member Functions | List of all members
lsst::meas::modelfit::SoftenedLinearPrior Class Reference

A prior that's linear in radius and flat in ellipticity, with a cubic roll-off at the edges. More...

#include <SoftenedLinearPrior.h>

Inheritance diagram for lsst::meas::modelfit::SoftenedLinearPrior:
lsst::meas::modelfit::Prior

Public Types

typedef SoftenedLinearPriorControl Control
 

Public Member Functions

 SoftenedLinearPrior (Control const &ctrl=Control())
 
Scalar evaluate (ndarray::Array< Scalar const, 1, 1 > const &nonlinear, ndarray::Array< Scalar const, 1, 1 > const &amplitudes) const override
 Evaluate the prior at the given point in nonlinear and amplitude space. More...
 
void evaluateDerivatives (ndarray::Array< Scalar const, 1, 1 > const &nonlinear, ndarray::Array< Scalar const, 1, 1 > const &amplitudes, ndarray::Array< Scalar, 1, 1 > const &nonlinearGradient, ndarray::Array< Scalar, 1, 1 > const &amplitudeGradient, ndarray::Array< Scalar, 2, 1 > const &nonlinearHessian, ndarray::Array< Scalar, 2, 1 > const &amplitudeHessian, ndarray::Array< Scalar, 2, 1 > const &crossHessian) const override
 Evaluate the derivatives of the prior at the given point in nonlinear and amplitude space. More...
 
Scalar marginalize (Vector const &gradient, Matrix const &hessian, ndarray::Array< Scalar const, 1, 1 > const &nonlinear) const override
 Return the -log amplitude integral of the prior*likelihood product. More...
 
Scalar maximize (Vector const &gradient, Matrix const &hessian, ndarray::Array< Scalar const, 1, 1 > const &nonlinear, ndarray::Array< Scalar, 1, 1 > const &amplitudes) const override
 Compute the amplitude vector that maximizes the prior x likelihood product. More...
 
void drawAmplitudes (Vector const &gradient, Matrix const &fisher, ndarray::Array< Scalar const, 1, 1 > const &nonlinear, afw::math::Random &rng, ndarray::Array< Scalar, 2, 1 > const &amplitudes, ndarray::Array< Scalar, 1, 1 > const &weights, bool multiplyWeights=false) const override
 Draw a set of Monte Carlo amplitude vectors. More...
 
Control const & getControl () const
 
std::string const & getTag () const
 

Detailed Description

A prior that's linear in radius and flat in ellipticity, with a cubic roll-off at the edges.

Definition at line 81 of file SoftenedLinearPrior.h.

Member Typedef Documentation

◆ Control

Definition at line 84 of file SoftenedLinearPrior.h.

Constructor & Destructor Documentation

◆ SoftenedLinearPrior()

lsst::meas::modelfit::SoftenedLinearPrior::SoftenedLinearPrior ( Control const &  ctrl = Control())
explicit

Member Function Documentation

◆ drawAmplitudes()

void lsst::meas::modelfit::SoftenedLinearPrior::drawAmplitudes ( Vector const &  gradient,
Matrix const &  fisher,
ndarray::Array< Scalar const, 1, 1 > const &  nonlinear,
afw::math::Random rng,
ndarray::Array< Scalar, 2, 1 > const &  amplitudes,
ndarray::Array< Scalar, 1, 1 > const &  weights,
bool  multiplyWeights = false 
) const
overridevirtual

Draw a set of Monte Carlo amplitude vectors.

This provides a Monte Carlo approach to extracting the conditional amplitude distribution that is integrated by the marginalize() method.

Parameters
[in]gradientGradient of the -log likelihood in \(\alpha\) at fixed \(\theta\).
[in]hessianSecond derivatives of of the -log likelihood in \(\alpha\) at fixed \(\theta\).
[in]nonlinearThe nonlinear parameters \(\theta\) at which we are evaluating the conditional distribution \(P(\alpha|\theta)\).
[in,out]rngRandom number generator.
[out]amplitudesThe Monte Carlo sample of amplitude parameters \(\alpha\). The number of rows sets the number of samples, while the number of columns must match the dimensionality of \(\alpha\).
[out]weightsThe weights of the Monte Carlo samples; should asymptotically average to one.
[in]multiplyWeightsIf true, multiply weight vector instead of overwriting it.

Implements lsst::meas::modelfit::Prior.

◆ evaluate()

Scalar lsst::meas::modelfit::SoftenedLinearPrior::evaluate ( ndarray::Array< Scalar const, 1, 1 > const &  nonlinear,
ndarray::Array< Scalar const, 1, 1 > const &  amplitudes 
) const
overridevirtual

Evaluate the prior at the given point in nonlinear and amplitude space.

Parameters
[in]nonlinearVector of nonlinear parameters
[in]amplitudesVector of linear parameters

Implements lsst::meas::modelfit::Prior.

◆ evaluateDerivatives()

void lsst::meas::modelfit::SoftenedLinearPrior::evaluateDerivatives ( ndarray::Array< Scalar const, 1, 1 > const &  nonlinear,
ndarray::Array< Scalar const, 1, 1 > const &  amplitudes,
ndarray::Array< Scalar, 1, 1 > const &  nonlinearGradient,
ndarray::Array< Scalar, 1, 1 > const &  amplitudeGradient,
ndarray::Array< Scalar, 2, 1 > const &  nonlinearHessian,
ndarray::Array< Scalar, 2, 1 > const &  amplitudeHessian,
ndarray::Array< Scalar, 2, 1 > const &  crossHessian 
) const
overridevirtual

Evaluate the derivatives of the prior at the given point in nonlinear and amplitude space.

Note that while the model is linear in the amplitudes, the prior is not necessarily linear in the amplitudes, so we do care about second derivatives w.r.t. amplitudes.

Parameters
[in]nonlinearVector of nonlinear parameters
[in]amplitudesVector of linear parameters
[in]nonlinearGradientFirst derivative w.r.t. nonlinear parameters
[in]amplitudeGradientFirst derivative w.r.t. linear parameters parameters
[in]nonlinearHessianSecond derivative w.r.t. nonlinear parameters
[in]amplitudeHessianSecond derivative w.r.t. linear parameters parameters
[in]crossHessianSecond derivative cross term of d(nonlinear)d(amplitudes); shape is [nonlinearDim, amplitudeDim].

Implements lsst::meas::modelfit::Prior.

◆ getControl()

Control const& lsst::meas::modelfit::SoftenedLinearPrior::getControl ( ) const
inline

Definition at line 128 of file SoftenedLinearPrior.h.

128 { return _ctrl; }

◆ getTag()

std::string const& lsst::meas::modelfit::Prior::getTag ( ) const
inlineinherited

Definition at line 39 of file Prior.h.

39 { return _tag; }

◆ marginalize()

Scalar lsst::meas::modelfit::SoftenedLinearPrior::marginalize ( Vector const &  gradient,
Matrix const &  hessian,
ndarray::Array< Scalar const, 1, 1 > const &  nonlinear 
) const
overridevirtual

Return the -log amplitude integral of the prior*likelihood product.

If \(\alpha\) are the amplitudes, \(\theta\) are the nonlinear parameters, and \(D\) is the data, then this method represents \(P(\alpha,\theta)\) by computing

\[ -\ln\left[\int\!P(D|\alpha,\theta)\,P(\alpha,\theta)\,d\alpha\right] \]

at fixed \(\theta\). Because \(\alpha\) are linear parameters, \(P(D|\alpha,\theta)\) is Gaussian in \(\alpha\), and because \(\theta\) is fixed, it's usually convenient to think of the integral as:

\[ -ln\left[P(\theta)\int\!P(D|\alpha,\theta)\,P(\alpha|\theta)\,d\alpha\right] \]

Thus, we marginalize the likelihood in \(\alpha\) at fixed \(\theta\), and then multiply by the prior on \(\theta\).

We also assume the likelihood \(P(D|\alpha,\theta)\) is Gaussian in \(\alpha\), which is generally true because \(\alpha\) defined such that the model is linear in them, and the noise on the data is generally Gaussian. In detail, we represent the likelihood at fixed \(\theta\) as

\[ P(D|\alpha,\theta) = A e^{-g^T\alpha - \frac{1}{2}\alpha^T H \alpha} \]

The normalization \(A\) can be brought outside the integral as a constant to be added to the return value, so it is not passed as an argument to this function.

Parameters
[in]gradientGradient of the -log likelihood in \(\alpha\) at fixed \(\theta\); the vector \(g\) in the equation above.
[in]hessianSecond derivatives of of the -log likelihood in \(\alpha\) at fixed \(\theta\); the matrix \(H\) in the equation above.
[in]nonlinearThe nonlinear parameters \(\theta\).

Implements lsst::meas::modelfit::Prior.

◆ maximize()

Scalar lsst::meas::modelfit::SoftenedLinearPrior::maximize ( Vector const &  gradient,
Matrix const &  hessian,
ndarray::Array< Scalar const, 1, 1 > const &  nonlinear,
ndarray::Array< Scalar, 1, 1 > const &  amplitudes 
) const
overridevirtual

Compute the amplitude vector that maximizes the prior x likelihood product.

Parameters
[in]gradientGradient of the -log likelihood in \(\alpha\) at fixed \(\theta\); the vector \(g\) in the equation above.
[in]hessianSecond derivatives of of the -log likelihood in \(\alpha\) at fixed \(\theta\); the matrix \(H\) in the equation above.
[in]nonlinearThe nonlinear parameters \(\theta\).
[out]amplitudesThe posterior-maximum amplitude parameters \(\alpha\).
Returns
The -log(posterior) at the computed amplitude point.

Implements lsst::meas::modelfit::Prior.


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