12 #include "boost/shared_ptr.hpp"
13 #include "boost/timer.hpp"
16 #include "Eigen/Cholesky"
30 namespace afwMath = lsst::afw::math;
31 namespace afwGeom = lsst::afw::geom;
32 namespace pexLogging = lsst::pex::logging;
33 namespace pexPolicy = lsst::pex::policy;
34 namespace pexExcept = lsst::pex::exceptions;
73 template<
typename PixelT>
79 afwMath::CandidateVisitor(),
83 int spatialKernelOrder = policy.
getInt(
"spatialKernelOrder");
86 int fitForBackground = policy.
getBool(
"fitForBackground");
87 int spatialBgOrder = fitForBackground ? policy.
getInt(
"spatialBgOrder") : 0;
90 std::string spatialModelType = policy.
getString(
"spatialModelType");
91 if (spatialModelType ==
"chebyshev1") {
100 else if (spatialModelType ==
"polynomial") {
121 template<
typename PixelT>
126 if (kCandidate == NULL) {
128 "Failed to cast SpatialCellCandidate to KernelCandidate");
132 pexLogging::TTrace<3>(
"lsst.ip.diffim.BuildSpatialKernelVisitor.processCandidate",
133 "Cannot process candidate %d, continuing", kCandidate->
getId());
137 pexLogging::TTrace<6>(
"lsst.ip.diffim.BuildSpatialKernelVisitor.processCandidate",
138 "Processing candidate %d", kCandidate->
getId());
146 _kernelSolution->addConstraint(kCandidate->
getXCenter(),
157 template<
typename PixelT>
159 _kernelSolution->solve();
162 template<
typename PixelT>
163 std::pair<afwMath::LinearCombinationKernel::Ptr, afwMath::Kernel::SpatialFunctionPtr>
165 return _kernelSolution->getSolutionPair();
2-dimensional weighted sum of Chebyshev polynomials of the first kind.
An include file to include the public header files for lsst::afw::math.
An include file to include the header files for lsst::afw::geom.
Creates a spatial kernel and background from a list of candidates.
boost::shared_ptr< lsst::afw::math::Function2< double > > SpatialFunctionPtr
float getYCenter() const
Return the object's row-centre.
Class stored in SpatialCells for spatial Kernel fitting.
boost::shared_ptr< SpatialKernelSolution > _kernelSolution
a container for holding hierarchical configuration data in memory.
2-dimensional polynomial function with cross terms
const std::string getString(const std::string &name) const
int getId() const
Return the candidate's unique ID.
definition of the Trace messaging facilities
Implementation of BuildSpatialKernelVisitor.
void setStatus(Status status)
Set the candidate's status.
void solveLinearEquation()
int getInt(const std::string &name) const
An integer coordinate rectangle.
Declaration of classes to store the solution for convolution kernels.
bool isInitialized() const
BuildSpatialKernelVisitor(lsst::afw::math::KernelList const &basisList, lsst::afw::geom::Box2I const ®ionBBox, lsst::pex::policy::Policy policy)
Class used by SpatialModelCell for spatial Kernel fitting.
bool getBool(const std::string &name) const
boost::shared_ptr< StaticKernelSolution< PixelT > > getKernelSolution(CandidateSwitch cand) const
std::pair< lsst::afw::math::LinearCombinationKernel::Ptr, lsst::afw::math::Kernel::SpatialFunctionPtr > getSolutionPair()
#define LSST_EXCEPT(type,...)
std::vector< boost::shared_ptr< Kernel > > KernelList
A floating-point coordinate rectangle geometry.
void processCandidate(lsst::afw::math::SpatialCellCandidate *candidate)
float getXCenter() const
Return the object's column-centre.