lsst.ip.diffim  14.0-6-gf4bc96c+10
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT > Class Template Reference

Builds the convolution kernel for a given candidate. More...

#include <BuildSingleKernelVisitor.h>

Inheritance diagram for lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >:
lsst::afw::math::CandidateVisitor

Public Types

typedef std::shared_ptr< BuildSingleKernelVisitor< PixelT > > Ptr
 

Public Member Functions

 BuildSingleKernelVisitor (lsst::afw::math::KernelList const &basisList, lsst::pex::policy::Policy const &policy)
 
 BuildSingleKernelVisitor (lsst::afw::math::KernelList const &basisList, lsst::pex::policy::Policy const &policy, Eigen::MatrixXd const &hMat)
 
virtual ~BuildSingleKernelVisitor ()
 
void setSkipBuilt (bool skip)
 
int getNRejected ()
 
int getNProcessed ()
 
void reset ()
 
void processCandidate (lsst::afw::math::SpatialCellCandidate *candidate)
 

Private Types

typedef lsst::afw::image::MaskedImage< PixelTMaskedImageT
 

Private Attributes

lsst::afw::math::KernelList const _basisList
 Basis set. More...
 
lsst::pex::policy::Policy _policy
 Policy controlling behavior. More...
 
Eigen::MatrixXd const _hMat
 Regularization matrix. More...
 
ImageStatistics< PixelT_imstats
 To calculate statistics of difference image. More...
 
bool _skipBuilt
 Skip over built candidates during processCandidate() More...
 
int _nRejected
 Number of candidates rejected during processCandidate() More...
 
int _nProcessed
 Number of candidates processed during processCandidate() More...
 
bool _useRegularization
 Regularize if delta function basis. More...
 
bool _useCoreStats
 Extracted from _policy. More...
 
int _coreRadius
 Extracted from _policy. More...
 

Detailed Description

template<typename PixelT>
class lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >

Builds the convolution kernel for a given candidate.

std::shared_ptr<Policy> policy(new Policy);
policy->set("constantVarianceWeighting", false);
policy->set("iterateSingleKernel", false);
policy->set("singleKernelClipping", true);
policy->set("candidateResidualMeanMax", 0.25);
policy->set("candidateResidualStdMax", 1.25);
detail::BuildSingleKernelVisitor<PixelT> singleKernelFitter(*policy);
int nRejected = -1;
while (nRejected != 0) {
singleKernelFitter.reset();
kernelCells.visitCandidates(&singleKernelFitter, nStarPerCell);
nRejected = singleKernelFitter.getNRejected();
}
Note
Visits each current candidate in a afwMath::SpatialCellSet, and builds its kernel using its build() method. We don't build the kernel for every candidate since this is computationally expensive, only when its the current candidate in the cell. During the course of building the kernel, it also assesses the quality of the difference image. If it is determined to be bad (based on the Policy paramters) the candidate is flagged as afwMath::SpatialCellCandidate::BAD; otherwise its marked as afwMath::SpatialCellCandidate::GOOD. Keeps a running sample of all the new candidates it visited that turned out to be bad.
Because this visitor does not have access to the next candidate in the cell, it must be called iteratively until no candidates are rejected. This ensures that the current candidate of every cell has an initialized Kernel. This also requires that this class re-Visit all the cells after any other Visitors with the ability to mark something as BAD.
Because we are frequently re-Visiting entirely GOOD candidates during these iterations, the option of _skipBuilt=true will enable the user to not rebuilt the kernel on every visit.
For the particular use case of creating a Pca basis from the raw kernels, we want to re-Visit each candidate and re-fit the kernel using this Pca basis. This requires the user to setSkipBuilt(false) so that the candidate is reprocessed with this new basis.

Definition at line 30 of file BuildSingleKernelVisitor.h.

Member Typedef Documentation

◆ MaskedImageT

Definition at line 31 of file BuildSingleKernelVisitor.h.

◆ Ptr

Definition at line 33 of file BuildSingleKernelVisitor.h.

Constructor & Destructor Documentation

◆ BuildSingleKernelVisitor() [1/2]

Parameters
basisListList of basis kernels for resulting LinearCombinationKernel
policyPolicy file directing behavior

Definition at line 88 of file BuildSingleKernelVisitor.cc.

◆ BuildSingleKernelVisitor() [2/2]

template<typename PixelT >
lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::BuildSingleKernelVisitor ( lsst::afw::math::KernelList const &  basisList,
lsst::pex::policy::Policy const &  policy,
Eigen::MatrixXd const &  hMat 
)
Parameters
basisListList of basis kernels for resulting LinearCombinationKernel
policyPolicy file directing behavior
hMatRegularization matrix

Definition at line 107 of file BuildSingleKernelVisitor.cc.

◆ ~BuildSingleKernelVisitor()

template<typename PixelT >
virtual lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::~BuildSingleKernelVisitor ( )
inlinevirtual

Definition at line 44 of file BuildSingleKernelVisitor.h.

Member Function Documentation

◆ getNProcessed()

template<typename PixelT >
int lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::getNProcessed ( )
inline

Definition at line 56 of file BuildSingleKernelVisitor.h.

◆ getNRejected()

template<typename PixelT >
int lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::getNRejected ( )
inline

Definition at line 55 of file BuildSingleKernelVisitor.h.

◆ processCandidate()

template<typename PixelT >
void lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::processCandidate ( lsst::afw::math::SpatialCellCandidate candidate)
virtual

Reimplemented from lsst::afw::math::CandidateVisitor.

Definition at line 128 of file BuildSingleKernelVisitor.cc.

◆ reset()

template<typename PixelT >
void lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::reset ( )
inlinevirtual

Reimplemented from lsst::afw::math::CandidateVisitor.

Definition at line 57 of file BuildSingleKernelVisitor.h.

◆ setSkipBuilt()

template<typename PixelT >
void lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::setSkipBuilt ( bool  skip)
inline

Definition at line 53 of file BuildSingleKernelVisitor.h.

Member Data Documentation

◆ _basisList

template<typename PixelT >
lsst::afw::math::KernelList const lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_basisList
private

Basis set.

Definition at line 62 of file BuildSingleKernelVisitor.h.

◆ _coreRadius

template<typename PixelT >
int lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_coreRadius
private

Extracted from _policy.

Definition at line 72 of file BuildSingleKernelVisitor.h.

◆ _hMat

template<typename PixelT >
Eigen::MatrixXd const lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_hMat
private

Regularization matrix.

Definition at line 64 of file BuildSingleKernelVisitor.h.

◆ _imstats

template<typename PixelT >
ImageStatistics<PixelT> lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_imstats
private

To calculate statistics of difference image.

Definition at line 65 of file BuildSingleKernelVisitor.h.

◆ _nProcessed

template<typename PixelT >
int lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_nProcessed
private

Number of candidates processed during processCandidate()

Definition at line 68 of file BuildSingleKernelVisitor.h.

◆ _nRejected

template<typename PixelT >
int lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_nRejected
private

Number of candidates rejected during processCandidate()

Definition at line 67 of file BuildSingleKernelVisitor.h.

◆ _policy

Policy controlling behavior.

Definition at line 63 of file BuildSingleKernelVisitor.h.

◆ _skipBuilt

template<typename PixelT >
bool lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_skipBuilt
private

Skip over built candidates during processCandidate()

Definition at line 66 of file BuildSingleKernelVisitor.h.

◆ _useCoreStats

template<typename PixelT >
bool lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_useCoreStats
private

Extracted from _policy.

Definition at line 71 of file BuildSingleKernelVisitor.h.

◆ _useRegularization

template<typename PixelT >
bool lsst::ip::diffim::detail::BuildSingleKernelVisitor< PixelT >::_useRegularization
private

Regularize if delta function basis.

Definition at line 69 of file BuildSingleKernelVisitor.h.


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