File KernelSolution.h

Declaration of classes to store the solution for convolution kernels.

Author

Andrew Becker, University of Washington

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace ip
namespace diffim
class KernelSolution

Subclassed by lsst::ip::diffim::SpatialKernelSolution, lsst::ip::diffim::StaticKernelSolution< InputT >

Public Types

enum KernelSolvedBy

Values:

NONE = 0
CHOLESKY_LDLT = 1
CHOLESKY_LLT = 2
LU = 3
EIGENVECTOR = 4
enum ConditionNumberType

Values:

EIGENVALUE = 0
SVD = 1
typedef std::shared_ptr<KernelSolution> Ptr
typedef lsst::afw::math::Kernel::Pixel PixelT
typedef lsst::afw::image::Image<lsst::afw::math::Kernel::Pixel> ImageT

Public Functions

KernelSolution(Eigen::MatrixXd mMat, Eigen::VectorXd bVec, bool fitForBackground)
KernelSolution(bool fitForBackground)
KernelSolution()
virtual ~KernelSolution()
virtual void solve()
virtual void solve(Eigen::MatrixXd const &mMat, Eigen::VectorXd const &bVec)
KernelSolvedBy getSolvedBy()
virtual double getConditionNumber(ConditionNumberType conditionType)
virtual double getConditionNumber(Eigen::MatrixXd const &mMat, ConditionNumberType conditionType)
Eigen::MatrixXd const &getM()
Eigen::VectorXd const &getB()
void printM()
void printB()
void printA()
int getId() const

Protected Attributes

int _id

Unique ID for object.

Eigen::MatrixXd _mMat

Derived least squares M matrix.

Eigen::VectorXd _bVec

Derived least squares B vector.

Eigen::VectorXd _aVec

Derived least squares solution matrix.

KernelSolvedBy _solvedBy

Type of algorithm used to make solution.

bool _fitForBackground

Background terms included in fit.

Protected Static Attributes

int _SolutionId

Unique identifier for solution.

template<typename InputT>
class MaskedKernelSolution : public lsst::ip::diffim::StaticKernelSolution<InputT>

Public Types

typedef std::shared_ptr<MaskedKernelSolution<InputT>> Ptr

Public Functions

MaskedKernelSolution(lsst::afw::math::KernelList const &basisList, bool fitForBackground)
virtual ~MaskedKernelSolution()
virtual void buildOrig(lsst::afw::image::Image<InputT> const &templateImage, lsst::afw::image::Image<InputT> const &scienceImage, lsst::afw::image::Image<lsst::afw::image::VariancePixel> const &varianceEstimate, lsst::afw::image::Mask<lsst::afw::image::MaskPixel> pixelMask)
virtual void buildWithMask(lsst::afw::image::Image<InputT> const &templateImage, lsst::afw::image::Image<InputT> const &scienceImage, lsst::afw::image::Image<lsst::afw::image::VariancePixel> const &varianceEstimate, lsst::afw::image::Mask<lsst::afw::image::MaskPixel> const &pixelMask)
virtual void buildSingleMaskOrig(lsst::afw::image::Image<InputT> const &templateImage, lsst::afw::image::Image<InputT> const &scienceImage, lsst::afw::image::Image<lsst::afw::image::VariancePixel> const &varianceEstimate, lsst::geom::Box2I maskBox)
template<typename InputT>
class RegularizedKernelSolution : public lsst::ip::diffim::StaticKernelSolution<InputT>

Public Types

typedef std::shared_ptr<RegularizedKernelSolution<InputT>> Ptr

Public Functions

RegularizedKernelSolution(lsst::afw::math::KernelList const &basisList, bool fitForBackground, Eigen::MatrixXd const &hMat, lsst::daf::base::PropertySet const &ps)
virtual ~RegularizedKernelSolution()
void solve()
double getLambda()
double estimateRisk(double maxCond)
Eigen::MatrixXd getM(bool includeHmat = true)

Private Functions

std::vector<double> _createLambdaSteps()

Private Members

Eigen::MatrixXd const _hMat

Regularization weights.

double _lambda

Overall regularization strength.

lsst::daf::base::PropertySet::Ptr _ps
class SpatialKernelSolution : public lsst::ip::diffim::KernelSolution

Public Types

typedef std::shared_ptr<SpatialKernelSolution> Ptr

Public Functions

SpatialKernelSolution(lsst::afw::math::KernelList const &basisList, lsst::afw::math::Kernel::SpatialFunctionPtr spatialKernelFunction, lsst::afw::math::Kernel::SpatialFunctionPtr background, lsst::daf::base::PropertySet const &ps)
virtual ~SpatialKernelSolution()
void addConstraint(float xCenter, float yCenter, Eigen::MatrixXd const &qMat, Eigen::VectorXd const &wVec)
void solve()
std::shared_ptr<lsst::afw::image::Image<lsst::afw::math::Kernel::Pixel>> makeKernelImage(lsst::geom::Point2D const &pos)
std::pair<std::shared_ptr<lsst::afw::math::LinearCombinationKernel>, lsst::afw::math::Kernel::SpatialFunctionPtr> getSolutionPair()

Private Functions

void _setKernel()

Set kernel after solution.

void _setKernelUncertainty()

Not implemented.

Private Members

lsst::afw::math::Kernel::SpatialFunctionPtr _spatialKernelFunction

Spatial function for Kernel.

bool _constantFirstTerm

Is the first term constant.

std::shared_ptr<lsst::afw::math::LinearCombinationKernel> _kernel

Spatial convolution kernel.

lsst::afw::math::Kernel::SpatialFunctionPtr _background

Spatial background model.

double _kSum

Derived kernel sum.

lsst::daf::base::PropertySet::Ptr _ps

Config to control processing.

int _nbases

Number of basis functions.

int _nkt

Number of kernel terms.

int _nbt

Number of background terms.

int _nt

Total number of terms.

template<typename InputT>
class StaticKernelSolution : public lsst::ip::diffim::KernelSolution

Subclassed by lsst::ip::diffim::MaskedKernelSolution< InputT >, lsst::ip::diffim::RegularizedKernelSolution< InputT >

Public Types

typedef std::shared_ptr<StaticKernelSolution<InputT>> Ptr

Public Functions

StaticKernelSolution(lsst::afw::math::KernelList const &basisList, bool fitForBackground)
virtual ~StaticKernelSolution()
void solve()
virtual void build(lsst::afw::image::Image<InputT> const &templateImage, lsst::afw::image::Image<InputT> const &scienceImage, lsst::afw::image::Image<lsst::afw::image::VariancePixel> const &varianceEstimate)
virtual std::shared_ptr<lsst::afw::math::Kernel> getKernel()
virtual std::shared_ptr<lsst::afw::image::Image<lsst::afw::math::Kernel::Pixel>> makeKernelImage()
virtual double getBackground()
virtual double getKsum()
virtual std::pair<std::shared_ptr<lsst::afw::math::Kernel>, double> getSolutionPair()

Protected Functions

void _setKernel()

Set kernel after solution.

void _setKernelUncertainty()

Not implemented.

Protected Attributes

Eigen::MatrixXd _cMat

K_i x R.

Eigen::VectorXd _iVec

Vectorized I.

Eigen::VectorXd _ivVec

Inverse variance.

std::shared_ptr<lsst::afw::math::Kernel> _kernel

Derived single-object convolution kernel.

double _background

Derived differential background estimate.

double _kSum

Derived kernel sum.