lsst.ip.diffim  21.0.0-6-g00874e7+793c1c31cc
Public Types | Public Member Functions | List of all members
lsst::ip::diffim::detail::BuildSpatialKernelVisitor< PixelT > Class Template Reference

Creates a spatial kernel and background from a list of candidates. More...

#include <BuildSpatialKernelVisitor.h>

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

Public Types

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

Public Member Functions

 BuildSpatialKernelVisitor (lsst::afw::math::KernelList const &basisList, lsst::geom::Box2I const &regionBBox, lsst::daf::base::PropertySet const &ps)
 
int getNCandidates ()
 
void processCandidate (lsst::afw::math::SpatialCellCandidate *candidate)
 
void solveLinearEquation ()
 
std::shared_ptr< SpatialKernelSolutiongetKernelSolution ()
 
std::pair< std::shared_ptr< lsst::afw::math::LinearCombinationKernel >, lsst::afw::math::Kernel::SpatialFunctionPtrgetSolutionPair ()
 
virtual void reset ()
 

Detailed Description

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

Creates a spatial kernel and background from a list of candidates.

std::shared_ptr<PropertySet> ps(new PropertySet);
ps->set("spatialKernelOrder", spatialKernelOrder);
ps->set("spatialBgOrder", spatialBgOrder);
ps->set("kernelBasisSet", "delta-function");
ps->set("usePcaForSpatialKernel", true);
detail::BuildSpatialKernelVisitor<PixelT> spatialKernelFitter(*basisListToUse,
*ps);
kernelCells.visitCandidates(&spatialKernelFitter, nStarPerCell);
spatialKernelFitter.solveLinearEquation();
afwMath::Kernel::SpatialFunctionPtr> kb = spatialKernelFitter.getKernelSolution();
spatialKernel = kb.first;
spatialBackground = kb.second;
std::shared_ptr< lsst::afw::math::Function2< double > > SpatialFunctionPtr
Note
After visiting all candidates, solveLinearEquation() must be called to trigger the matrix math.
The user has the option to enfore conservation of the kernel sum across the image through the property set. In this case, all terms but the first are fit for spatial variation. This requires a little extra code to make sure the matrices are the correct size, and that it is accessing the appropriate terms in the matrices when creating the spatial models.

Definition at line 28 of file BuildSpatialKernelVisitor.h.

Member Typedef Documentation

◆ Ptr

Definition at line 30 of file BuildSpatialKernelVisitor.h.

Constructor & Destructor Documentation

◆ BuildSpatialKernelVisitor()

Parameters
basisListBasis functions
regionBBoxSpatial region over which the function is fit
psPropertySet directing behavior

Definition at line 73 of file BuildSpatialKernelVisitor.cc.

Member Function Documentation

◆ getKernelSolution()

template<typename PixelT >
std::shared_ptr<SpatialKernelSolution> lsst::ip::diffim::detail::BuildSpatialKernelVisitor< PixelT >::getKernelSolution ( )
inline

Definition at line 44 of file BuildSpatialKernelVisitor.h.

◆ getNCandidates()

template<typename PixelT >
int lsst::ip::diffim::detail::BuildSpatialKernelVisitor< PixelT >::getNCandidates ( )
inline

Definition at line 38 of file BuildSpatialKernelVisitor.h.

◆ getSolutionPair()

Definition at line 163 of file BuildSpatialKernelVisitor.cc.

◆ processCandidate()

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

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

Definition at line 121 of file BuildSpatialKernelVisitor.cc.

◆ solveLinearEquation()

template<typename PixelT >
void lsst::ip::diffim::detail::BuildSpatialKernelVisitor< PixelT >::solveLinearEquation

Definition at line 157 of file BuildSpatialKernelVisitor.cc.


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