Template Class KernelCandidate¶
Defined in File KernelCandidate.h
Inheritance Relationships¶
Base Type¶
public lsst::afw::math::SpatialCellImageCandidate(Class SpatialCellImageCandidate)
Class Documentation¶
-
template<typename
_PixelT>
classKernelCandidate: public lsst::afw::math::SpatialCellImageCandidate¶ Class stored in SpatialCells for spatial Kernel fitting.
- Note
KernelCandidate is a single Kernel derived around a source. We’ll assign them to sets of SpatialCells; these sets will then be used to fit a spatial model to the Kernel.
Public Types
-
typedef _PixelT
PixelT¶
-
typedef std::shared_ptr<KernelCandidate>
Ptr¶
-
typedef std::shared_ptr<afw::table::SourceRecord>
SourcePtr¶
Public Functions
-
KernelCandidate(float const xCenter, float const yCenter, MaskedImagePtr const &templateMaskedImage, MaskedImagePtr const &scienceMaskedImage, daf::base::PropertySet const &ps)¶ Constructor.
- Parameters
xCenter: Col position of objectyCenter: Row position of objecttemplateMaskedImage: Pointer to template imagescienceMaskedImage: Pointer to science imageps: PropertySet
-
KernelCandidate(SourcePtr const &source, MaskedImagePtr const &templateMaskedImage, MaskedImagePtr const &scienceMaskedImage, daf::base::PropertySet const &ps)¶ Constructor.
- Parameters
source: Pointer to a source to use in constructing the candidatetemplateMaskedImage: Pointer to template imagescienceMaskedImage: Pointer to science imageps: PropertySet
-
virtual
~KernelCandidate()¶ Destructor.
-
double
getCandidateRating() const¶ Return Candidate rating.
- Note
Required method for use by SpatialCell; e.g. total flux
-
MaskedImagePtr
getTemplateMaskedImage()¶ Return pointers to the image pixels used in kernel determination.
-
MaskedImagePtr
getScienceMaskedImage()¶
-
std::shared_ptr<afw::math::Kernel>
getKernel(CandidateSwitch cand) const¶ Return results of kernel solution.
-
double
getBackground(CandidateSwitch cand) const¶
-
double
getKsum(CandidateSwitch cand) const¶
-
std::shared_ptr<StaticKernelSolution<PixelT>>
getKernelSolution(CandidateSwitch cand) const¶
-
afw::image::MaskedImage<PixelT>
getDifferenceImage(CandidateSwitch cand)¶ Calculate associated difference image using internal solutions.
Calculate associated difference image using input kernel and background.
- Note
Useful for spatial modeling
-
bool
isInitialized() const¶
-
void
build(afw::math::KernelList const &basisList)¶ Core functionality of KernelCandidate, to build and fill a KernelSolution.
o _isInitialized = false. This is a constructed but not initialized
KernelCandidate. When build() is called, M and B are derived from the MaskedImages and the basisList. KernelCandidate owns the knowledge of how to fill this KernelSolution; the solution knows how to solve itself and how to turn that into an output kernel. This solution ends up being _kernelSolution0.- Note
This is an expensive step involving matrix math, and one that may be called multiple times per candidate. Use cases are:
o _isInitialized = true. This is for when build() is re-called using a different basis list, e.g. one based on Pca. We need to use M and B for the spatial modeling, but do not want to override the original KernelSolution. This solution ends up as _kernelSolutionCurrent. Build KernelSolution matrices for M x = B with regularization matrix H
- Note
Modified equation is (Mt.M + lambda H) x = Mt.B with lambda a degree of freedom describing the “strength” of the regularization. The larger the value of lambda, the smoother the kernel, but the larger the residuals in the difference image.
- Note
A value of lambda = Trace(Mt.M) / Tr(H) will yield essentially equivalent power in the kernel smoothness and in the diffim quality. We scale this estimate by lambdaScaling to give more/less consideration to the smoothness of the kernel.
-
void
build(afw::math::KernelList const &basisList, Eigen::MatrixXd const &hMat)¶