File KernelCandidate.h¶
Class used by SpatialModelCell for spatial Kernel fitting.
- 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 Functions
Return a KernelCandidate pointer of the right sort.
- Parameters
xCenter: X-center of candidateyCenter: Y-center of candidatetemplateMaskedImage: Template subimagescienceMaskedImage: Science image subimageps: PropertySet for creation of rating
Return a KernelCandidate pointer of the right sort.
- Parameters
source: afw::table::SourceRecord used to construct the KernelCandidatetemplateMaskedImage: Template subimagescienceMaskedImage: Science image subimageps: PropertySet for creation of rating
-
template<typename
_PixelT>
classKernelCandidate: public lsst::afw::math::SpatialCellImageCandidate - #include <KernelCandidate.h>
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::image::MaskedImage<PixelT>>
MaskedImagePtr
-
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
-
SourcePtr
getSource() const Return the original source.
-
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
-
PTR(ImageT) const
-
CONST_PTR(ImageT) 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)
Private Functions
-
void
_buildKernelSolution(afw::math::KernelList const &basisList, Eigen::MatrixXd const &hMat)¶
Private Members
-
MaskedImagePtr
_templateMaskedImage¶ Subimage around which you build kernel.
-
MaskedImagePtr
_scienceMaskedImage¶ Subimage around which you build kernel.
-
VariancePtr
_varianceEstimate¶ Estimate of the local variance.
-
double
_coreFlux¶ Mean S/N in the science image.
-
bool
_isInitialized¶ Has the kernel been built.
-
bool
_useRegularization¶ Use regularization?
-
bool
_fitForBackground¶
-
std::shared_ptr<StaticKernelSolution<PixelT>>
_kernelSolutionOrig¶ Original basis solution.
-
std::shared_ptr<StaticKernelSolution<PixelT>>
_kernelSolutionPca¶ Most recent solution.
-
namespace