LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::ip::diffim::KernelCandidate< _PixelT > Class Template Reference

Class stored in SpatialCells for spatial Kernel fitting. More...

#include <KernelCandidate.h>

Inheritance diagram for lsst::ip::diffim::KernelCandidate< _PixelT >:
lsst::afw::math::SpatialCellImageCandidate lsst::afw::math::SpatialCellCandidate

Public Types

enum  CandidateSwitch { ORIG = 0 , PCA = 1 , RECENT = 2 }
 
typedef afw::image::Image< afw::math::Kernel::PixelImageT
 
typedef _PixelT PixelT
 
typedef std::shared_ptr< KernelCandidatePtr
 
typedef std::shared_ptr< afw::image::MaskedImage< PixelT > > MaskedImagePtr
 
typedef std::shared_ptr< afw::image::Image< afw::image::VariancePixel > > VariancePtr
 
typedef std::shared_ptr< afw::table::SourceRecordSourcePtr
 
enum  Status { BAD = 0 , GOOD = 1 , UNKNOWN = 2 }
 

Public Member Functions

 KernelCandidate (float const xCenter, float const yCenter, MaskedImagePtr const &templateMaskedImage, MaskedImagePtr const &scienceMaskedImage, daf::base::PropertySet const &ps)
 Constructor. More...
 
 KernelCandidate (SourcePtr const &source, MaskedImagePtr const &templateMaskedImage, MaskedImagePtr const &scienceMaskedImage, daf::base::PropertySet const &ps)
 Constructor. More...
 
virtual ~KernelCandidate ()
 Destructor. More...
 
double getCandidateRating () const
 Return Candidate rating. More...
 
SourcePtr getSource () const
 Return the original source. More...
 
MaskedImagePtr getTemplateMaskedImage ()
 Return pointers to the image pixels used in kernel determination. More...
 
MaskedImagePtr getScienceMaskedImage ()
 
std::shared_ptr< afw::math::KernelgetKernel (CandidateSwitch cand) const
 Return results of kernel solution. More...
 
double getBackground (CandidateSwitch cand) const
 
double getKsum (CandidateSwitch cand) const
 
std::shared_ptr< ImageTgetKernelImage (CandidateSwitch cand) const
 
std::shared_ptr< ImageT const > getImage () const
 
std::shared_ptr< StaticKernelSolution< PixelT > > getKernelSolution (CandidateSwitch cand) const
 
afw::image::MaskedImage< PixelTgetDifferenceImage (CandidateSwitch cand)
 Calculate associated difference image using internal solutions. More...
 
afw::image::MaskedImage< PixelTgetDifferenceImage (std::shared_ptr< afw::math::Kernel > kernel, double background)
 Calculate associated difference image using input kernel and background. More...
 
bool isInitialized () const
 
void build (afw::math::KernelList const &basisList)
 Core functionality of KernelCandidate, to build and fill a KernelSolution. More...
 
void build (afw::math::KernelList const &basisList, Eigen::MatrixXd const &hMat)
 
double getChi2 () const
 Return the candidate's chi^2. More...
 
void setChi2 (double chi2)
 Set the candidate's chi^2. More...
 
float getXCenter () const
 Return the object's column-centre. More...
 
float getYCenter () const
 Return the object's row-centre. More...
 
virtual bool instantiate ()
 Do anything needed to make this candidate usable. More...
 
virtual void setCandidateRating (double)
 Set the candidate's rating. More...
 
int getId () const
 Return the candidate's unique ID. More...
 
Status getStatus () const
 Return the candidate's status. More...
 
void setStatus (Status status)
 Set the candidate's status. More...
 
virtual bool isBad () const
 Is this candidate unacceptable? More...
 

Static Public Member Functions

static void setWidth (int width)
 Set the width of the image that getImage should return. More...
 
static int getWidth ()
 Return the width of the image that getImage should return. More...
 
static void setHeight (int height)
 Set the height of the image that getImage should return. More...
 
static int getHeight ()
 Return the height of the image that getImage should return. More...
 

Detailed Description

template<typename _PixelT>
class lsst::ip::diffim::KernelCandidate< _PixelT >

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.

Definition at line 39 of file KernelCandidate.h.

Member Typedef Documentation

◆ ImageT

template<typename _PixelT >
typedef afw::image::Image<afw::math::Kernel::Pixel> lsst::ip::diffim::KernelCandidate< _PixelT >::ImageT

Definition at line 41 of file KernelCandidate.h.

◆ MaskedImagePtr

Definition at line 45 of file KernelCandidate.h.

◆ PixelT

template<typename _PixelT >
typedef _PixelT lsst::ip::diffim::KernelCandidate< _PixelT >::PixelT

Definition at line 42 of file KernelCandidate.h.

◆ Ptr

template<typename _PixelT >
typedef std::shared_ptr<KernelCandidate> lsst::ip::diffim::KernelCandidate< _PixelT >::Ptr

Definition at line 44 of file KernelCandidate.h.

◆ SourcePtr

template<typename _PixelT >
typedef std::shared_ptr<afw::table::SourceRecord> lsst::ip::diffim::KernelCandidate< _PixelT >::SourcePtr

Definition at line 47 of file KernelCandidate.h.

◆ VariancePtr

Definition at line 46 of file KernelCandidate.h.

Member Enumeration Documentation

◆ CandidateSwitch

template<typename _PixelT >
enum lsst::ip::diffim::KernelCandidate::CandidateSwitch
Enumerator
ORIG 
PCA 
RECENT 

Definition at line 49 of file KernelCandidate.h.

◆ Status

Enumerator
BAD 
GOOD 
UNKNOWN 

Definition at line 72 of file SpatialCell.h.

Constructor & Destructor Documentation

◆ KernelCandidate() [1/2]

template<typename PixelT >
lsst::ip::diffim::KernelCandidate< PixelT >::KernelCandidate ( float const  xCenter,
float const  yCenter,
MaskedImagePtr const &  templateMaskedImage,
MaskedImagePtr const &  scienceMaskedImage,
daf::base::PropertySet const &  ps 
)

Constructor.

Parameters
xCenterCol position of object
yCenterRow position of object
templateMaskedImagePointer to template image
scienceMaskedImagePointer to science image
psPropertySet

Definition at line 33 of file KernelCandidate.cc.

38  _templateMaskedImage(templateMaskedImage),
39  _scienceMaskedImage(scienceMaskedImage),
40  _varianceEstimate(),
41  _ps(ps.deepCopy()),
42  _source(),
43  _coreFlux(),
44  _isInitialized(false),
45  _useRegularization(false),
46  _fitForBackground(ps.getAsBool("fitForBackground")),
47  _kernelSolutionOrig(),
48  _kernelSolutionPca() {
49  /* Rank by mean core S/N in science image */
50  ImageStatistics<PixelT> imstats(ps);
51  int candidateCoreRadius = _ps->getAsInt("candidateCoreRadius");
52  try {
53  imstats.apply(*_scienceMaskedImage, candidateCoreRadius);
54  } catch (pexExcept::Exception& e) {
55  LOGL_DEBUG("TRACE2.ip.diffim.KernelCandidate",
56  "Unable to calculate core imstats for ranking Candidate %d", this->getId());
58  return;
59  }
60 
61  _coreFlux = imstats.getMean();
62  LOGL_DEBUG("TRACE4.ip.diffim.KernelCandidate", "Candidate %d at %.2f %.2f with ranking %.2f",
63  this->getId(), this->getXCenter(), this->getYCenter(), _coreFlux);
64 }
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:515
float getYCenter() const
Return the object's row-centre.
Definition: SpatialCell.h:91
float getXCenter() const
Return the object's column-centre.
Definition: SpatialCell.h:88
int getId() const
Return the candidate's unique ID.
Definition: SpatialCell.h:102
void setStatus(Status status)
Set the candidate's status.
Definition: SpatialCell.cc:53
Base class for candidate objects in a SpatialCell that are able to return an Image of some sort (e....
Definition: SpatialCell.h:124
Provides consistent interface for LSST exceptions.
Definition: Exception.h:107

◆ KernelCandidate() [2/2]

template<typename PixelT >
lsst::ip::diffim::KernelCandidate< PixelT >::KernelCandidate ( SourcePtr const &  source,
MaskedImagePtr const &  templateMaskedImage,
MaskedImagePtr const &  scienceMaskedImage,
daf::base::PropertySet const &  ps 
)

Constructor.

Parameters
sourcePointer to a source to use in constructing the candidate
templateMaskedImagePointer to template image
scienceMaskedImagePointer to science image
psPropertySet

Definition at line 67 of file KernelCandidate.cc.

71  _templateMaskedImage(templateMaskedImage),
72  _scienceMaskedImage(scienceMaskedImage),
73  _varianceEstimate(),
74  _ps(ps.deepCopy()),
75  _source(source),
76  _coreFlux(source->getPsfInstFlux()),
77  _isInitialized(false),
78  _useRegularization(false),
79  _fitForBackground(ps.getAsBool("fitForBackground")),
80  _kernelSolutionOrig(),
81  _kernelSolutionPca() {
82  LOGL_DEBUG("TRACE4.ip.diffim.KernelCandidate", "Candidate %d at %.2f %.2f with ranking %.2f",
83  this->getId(), this->getXCenter(), this->getYCenter(), _coreFlux);
84 }
const char * source()
Source function that allows astChannel to source from a Stream.
Definition: Stream.h:224

◆ ~KernelCandidate()

template<typename _PixelT >
virtual lsst::ip::diffim::KernelCandidate< _PixelT >::~KernelCandidate ( )
inlinevirtual

Destructor.

Definition at line 84 of file KernelCandidate.h.

84 {};

Member Function Documentation

◆ build() [1/2]

template<typename PixelT >
void lsst::ip::diffim::KernelCandidate< PixelT >::build ( afw::math::KernelList const &  basisList)

Core functionality of KernelCandidate, to build and fill a KernelSolution.

Note
This is an expensive step involving matrix math, and one that may be called multiple times per candidate. Use cases are:

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.

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.
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.

Definition at line 87 of file KernelCandidate.cc.

87  {
88  build(basisList, Eigen::MatrixXd());
89 }
void build(afw::math::KernelList const &basisList)
Core functionality of KernelCandidate, to build and fill a KernelSolution.

◆ build() [2/2]

template<typename PixelT >
void lsst::ip::diffim::KernelCandidate< PixelT >::build ( afw::math::KernelList const &  basisList,
Eigen::MatrixXd const &  hMat 
)

Definition at line 92 of file KernelCandidate.cc.

93  {
94  /* Examine the property set for control over the variance estimate */
96  afwImage::Image<afwImage::VariancePixel>(*(_scienceMaskedImage->getVariance()), true);
97  /* Variance estimate comes from sum of image variances */
98  var += (*(_templateMaskedImage->getVariance()));
99 
100  if (_ps->getAsBool("constantVarianceWeighting")) {
101  /* Constant variance weighting */
103  float varValue;
104  if (varStats.getValue(afwMath::MEDIAN) <= 0.0)
105  varValue = 1.0;
106  else
107  varValue = varStats.getValue(afwMath::MEDIAN);
108  LOGL_DEBUG("TRACE4.ip.diffim.KernelCandidate", "Candidate %d using constant variance of %.2f",
109  this->getId(), varValue);
110  var = varValue;
111  }
112 
113  _varianceEstimate = VariancePtr(new afwImage::Image<afwImage::VariancePixel>(var));
114 
115  try {
116  _buildKernelSolution(basisList, hMat);
117  } catch (pexExcept::Exception& e) {
118  throw e;
119  }
120 
121  if (_ps->getAsBool("iterateSingleKernel") && (!(_ps->getAsBool("constantVarianceWeighting")))) {
123  _varianceEstimate = diffim.getVariance();
124 
125  try {
126  _buildKernelSolution(basisList, hMat);
127  } catch (pexExcept::Exception& e) {
128  throw e;
129  }
130  }
131 
132  _isInitialized = true;
133 }
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:51
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
Definition: MaskedImage.h:1051
A class to evaluate image statistics.
Definition: Statistics.h:220
double getValue(Property const prop=NOTHING) const
Return the value of the desired property (if specified in the constructor)
Definition: Statistics.cc:1047
std::shared_ptr< afw::image::Image< afw::image::VariancePixel > > VariancePtr
afw::image::MaskedImage< PixelT > getDifferenceImage(CandidateSwitch cand)
Calculate associated difference image using internal solutions.
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Definition: Statistics.h:359
@ MEDIAN
estimate sample median
Definition: Statistics.h:69

◆ getBackground()

template<typename PixelT >
double lsst::ip::diffim::KernelCandidate< PixelT >::getBackground ( CandidateSwitch  cand) const

Definition at line 244 of file KernelCandidate.cc.

244  {
245  if (cand == KernelCandidate::ORIG) {
246  if (_kernelSolutionOrig)
247  return _kernelSolutionOrig->getBackground();
248  else
249  throw LSST_EXCEPT(pexExcept::Exception, "Original kernel does not exist");
250  } else if (cand == KernelCandidate::PCA) {
251  if (_kernelSolutionPca)
252  return _kernelSolutionPca->getBackground();
253  else
254  throw LSST_EXCEPT(pexExcept::Exception, "Pca kernel does not exist");
255  } else if (cand == KernelCandidate::RECENT) {
256  if (_kernelSolutionPca)
257  return _kernelSolutionPca->getBackground();
258  else if (_kernelSolutionOrig)
259  return _kernelSolutionOrig->getBackground();
260  else
261  throw LSST_EXCEPT(pexExcept::Exception, "No kernels exist");
262  } else {
263  throw LSST_EXCEPT(pexExcept::Exception, "Invalid CandidateSwitch, cannot get background");
264  }
265 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ getCandidateRating()

template<typename _PixelT >
double lsst::ip::diffim::KernelCandidate< _PixelT >::getCandidateRating ( ) const
inlinevirtual

Return Candidate rating.

Note
Required method for use by SpatialCell; e.g. total flux

Implements lsst::afw::math::SpatialCellCandidate.

Definition at line 91 of file KernelCandidate.h.

91 { return _coreFlux; }

◆ getChi2()

double lsst::afw::math::SpatialCellImageCandidate::getChi2 ( ) const
inlineinherited

Return the candidate's chi^2.

Definition at line 146 of file SpatialCell.h.

146 { return _chi2; }

◆ getDifferenceImage() [1/2]

template<typename PixelT >
lsst::afw::image::MaskedImage< PixelT > lsst::ip::diffim::KernelCandidate< PixelT >::getDifferenceImage ( CandidateSwitch  cand)

Calculate associated difference image using internal solutions.

Definition at line 347 of file KernelCandidate.cc.

347  {
348  if (cand == KernelCandidate::ORIG) {
349  if (_kernelSolutionOrig)
350  return getDifferenceImage(_kernelSolutionOrig->getKernel(), _kernelSolutionOrig->getBackground());
351  else
352  throw LSST_EXCEPT(pexExcept::Exception, "Original kernel does not exist");
353  } else if (cand == KernelCandidate::PCA) {
354  if (_kernelSolutionPca)
355  return getDifferenceImage(_kernelSolutionPca->getKernel(), _kernelSolutionPca->getBackground());
356  else
357  throw LSST_EXCEPT(pexExcept::Exception, "Pca kernel does not exist");
358  } else if (cand == KernelCandidate::RECENT) {
359  if (_kernelSolutionPca)
360  return getDifferenceImage(_kernelSolutionPca->getKernel(), _kernelSolutionPca->getBackground());
361  else if (_kernelSolutionOrig)
362  return getDifferenceImage(_kernelSolutionOrig->getKernel(), _kernelSolutionOrig->getBackground());
363  else
364  throw LSST_EXCEPT(pexExcept::Exception, "No kernels exist");
365  } else {
366  throw LSST_EXCEPT(pexExcept::Exception, "Invalid CandidateSwitch, cannot get diffim");
367  }
368 }

◆ getDifferenceImage() [2/2]

template<typename PixelT >
lsst::afw::image::MaskedImage< PixelT > lsst::ip::diffim::KernelCandidate< PixelT >::getDifferenceImage ( std::shared_ptr< afw::math::Kernel kernel,
double  background 
)

Calculate associated difference image using input kernel and background.

Note
Useful for spatial modeling

Definition at line 371 of file KernelCandidate.cc.

372  {
373  /* Make diffim and set chi2 from result */
375  convolveAndSubtract(*_templateMaskedImage, *_scienceMaskedImage, *kernel, background);
376  return diffIm;
377 }
lsst::afw::image::MaskedImage< PixelT > convolveAndSubtract(lsst::afw::image::MaskedImage< PixelT > const &templateImage, lsst::afw::image::MaskedImage< PixelT > const &scienceMaskedImage, lsst::afw::math::Kernel const &convolutionKernel, BackgroundT background, bool invert=true)
Execute fundamental task of convolving template and subtracting it from science image.

◆ getHeight()

static int lsst::afw::math::SpatialCellImageCandidate::getHeight ( )
inlinestaticinherited

Return the height of the image that getImage should return.

Definition at line 143 of file SpatialCell.h.

143 { return _height; }

◆ getId()

int lsst::afw::math::SpatialCellCandidate::getId ( ) const
inlineinherited

Return the candidate's unique ID.

Definition at line 102 of file SpatialCell.h.

102 { return _id; }

◆ getImage()

template<typename PixelT >
std::shared_ptr< typename KernelCandidate< PixelT >::ImageT const > lsst::ip::diffim::KernelCandidate< PixelT >::getImage

Definition at line 317 of file KernelCandidate.cc.

317  {
319 }
std::shared_ptr< ImageT > getKernelImage(CandidateSwitch cand) const

◆ getKernel()

template<typename PixelT >
std::shared_ptr< lsst::afw::math::Kernel > lsst::ip::diffim::KernelCandidate< PixelT >::getKernel ( CandidateSwitch  cand) const

Return results of kernel solution.

Definition at line 220 of file KernelCandidate.cc.

220  {
221  if (cand == KernelCandidate::ORIG) {
222  if (_kernelSolutionOrig)
223  return _kernelSolutionOrig->getKernel();
224  else
225  throw LSST_EXCEPT(pexExcept::Exception, "Original kernel does not exist");
226  } else if (cand == KernelCandidate::PCA) {
227  if (_kernelSolutionPca)
228  return _kernelSolutionPca->getKernel();
229  else
230  throw LSST_EXCEPT(pexExcept::Exception, "Pca kernel does not exist");
231  } else if (cand == KernelCandidate::RECENT) {
232  if (_kernelSolutionPca)
233  return _kernelSolutionPca->getKernel();
234  else if (_kernelSolutionOrig)
235  return _kernelSolutionOrig->getKernel();
236  else
237  throw LSST_EXCEPT(pexExcept::Exception, "No kernels exist");
238  } else {
239  throw LSST_EXCEPT(pexExcept::Exception, "Invalid CandidateSwitch, cannot get kernel");
240  }
241 }

◆ getKernelImage()

template<typename PixelT >
std::shared_ptr< typename KernelCandidate< PixelT >::ImageT > lsst::ip::diffim::KernelCandidate< PixelT >::getKernelImage ( CandidateSwitch  cand) const

Definition at line 292 of file KernelCandidate.cc.

293  {
294  if (cand == KernelCandidate::ORIG) {
295  if (_kernelSolutionOrig)
296  return _kernelSolutionOrig->makeKernelImage();
297  else
298  throw LSST_EXCEPT(pexExcept::Exception, "Original kernel does not exist");
299  } else if (cand == KernelCandidate::PCA) {
300  if (_kernelSolutionPca)
301  return _kernelSolutionPca->makeKernelImage();
302  else
303  throw LSST_EXCEPT(pexExcept::Exception, "Pca kernel does not exist");
304  } else if (cand == KernelCandidate::RECENT) {
305  if (_kernelSolutionPca)
306  return _kernelSolutionPca->makeKernelImage();
307  else if (_kernelSolutionOrig)
308  return _kernelSolutionOrig->makeKernelImage();
309  else
310  throw LSST_EXCEPT(pexExcept::Exception, "No kernels exist");
311  } else {
312  throw LSST_EXCEPT(pexExcept::Exception, "Invalid CandidateSwitch, cannot get kernel image");
313  }
314 }

◆ getKernelSolution()

template<typename PixelT >
std::shared_ptr< StaticKernelSolution< PixelT > > lsst::ip::diffim::KernelCandidate< PixelT >::getKernelSolution ( CandidateSwitch  cand) const

Definition at line 322 of file KernelCandidate.cc.

323  {
324  if (cand == KernelCandidate::ORIG) {
325  if (_kernelSolutionOrig)
326  return _kernelSolutionOrig;
327  else
328  throw LSST_EXCEPT(pexExcept::Exception, "Original kernel does not exist");
329  } else if (cand == KernelCandidate::PCA) {
330  if (_kernelSolutionPca)
331  return _kernelSolutionPca;
332  else
333  throw LSST_EXCEPT(pexExcept::Exception, "Pca kernel does not exist");
334  } else if (cand == KernelCandidate::RECENT) {
335  if (_kernelSolutionPca)
336  return _kernelSolutionPca;
337  else if (_kernelSolutionOrig)
338  return _kernelSolutionOrig;
339  else
340  throw LSST_EXCEPT(pexExcept::Exception, "No kernels exist");
341  } else {
342  throw LSST_EXCEPT(pexExcept::Exception, "Invalid CandidateSwitch, cannot get solution");
343  }
344 }

◆ getKsum()

template<typename PixelT >
double lsst::ip::diffim::KernelCandidate< PixelT >::getKsum ( CandidateSwitch  cand) const

Definition at line 268 of file KernelCandidate.cc.

268  {
269  if (cand == KernelCandidate::ORIG) {
270  if (_kernelSolutionOrig)
271  return _kernelSolutionOrig->getKsum();
272  else
273  throw LSST_EXCEPT(pexExcept::Exception, "Original kernel does not exist");
274  } else if (cand == KernelCandidate::PCA) {
275  if (_kernelSolutionPca)
276  return _kernelSolutionPca->getKsum();
277  else
278  throw LSST_EXCEPT(pexExcept::Exception, "Pca kernel does not exist");
279  } else if (cand == KernelCandidate::RECENT) {
280  if (_kernelSolutionPca)
281  return _kernelSolutionPca->getKsum();
282  else if (_kernelSolutionOrig)
283  return _kernelSolutionOrig->getKsum();
284  else
285  throw LSST_EXCEPT(pexExcept::Exception, "No kernels exist");
286  } else {
287  throw LSST_EXCEPT(pexExcept::Exception, "Invalid CandidateSwitch, cannot get kSum");
288  }
289 }

◆ getScienceMaskedImage()

template<typename _PixelT >
MaskedImagePtr lsst::ip::diffim::KernelCandidate< _PixelT >::getScienceMaskedImage ( )
inline

Definition at line 100 of file KernelCandidate.h.

100 {return _scienceMaskedImage;}

◆ getSource()

template<typename _PixelT >
SourcePtr lsst::ip::diffim::KernelCandidate< _PixelT >::getSource ( ) const
inline

Return the original source.

Definition at line 95 of file KernelCandidate.h.

95 { return _source; }

◆ getStatus()

Status lsst::afw::math::SpatialCellCandidate::getStatus ( ) const
inlineinherited

Return the candidate's status.

Definition at line 104 of file SpatialCell.h.

104 { return _status; }

◆ getTemplateMaskedImage()

template<typename _PixelT >
MaskedImagePtr lsst::ip::diffim::KernelCandidate< _PixelT >::getTemplateMaskedImage ( )
inline

Return pointers to the image pixels used in kernel determination.

Definition at line 99 of file KernelCandidate.h.

99 {return _templateMaskedImage;}

◆ getWidth()

static int lsst::afw::math::SpatialCellImageCandidate::getWidth ( )
inlinestaticinherited

Return the width of the image that getImage should return.

Definition at line 138 of file SpatialCell.h.

138 { return _width; }

◆ getXCenter()

float lsst::afw::math::SpatialCellCandidate::getXCenter ( ) const
inlineinherited

Return the object's column-centre.

Definition at line 88 of file SpatialCell.h.

88 { return _xCenter; }

◆ getYCenter()

float lsst::afw::math::SpatialCellCandidate::getYCenter ( ) const
inlineinherited

Return the object's row-centre.

Definition at line 91 of file SpatialCell.h.

91 { return _yCenter; }

◆ instantiate()

virtual bool lsst::afw::math::SpatialCellCandidate::instantiate ( )
inlinevirtualinherited

Do anything needed to make this candidate usable.

Definition at line 94 of file SpatialCell.h.

94 { return true; }

◆ isBad()

virtual bool lsst::afw::math::SpatialCellCandidate::isBad ( ) const
inlinevirtualinherited

Is this candidate unacceptable?

Definition at line 108 of file SpatialCell.h.

108 { return (_status == BAD); }

◆ isInitialized()

template<typename _PixelT >
bool lsst::ip::diffim::KernelCandidate< _PixelT >::isInitialized ( ) const
inline

Definition at line 128 of file KernelCandidate.h.

128 {return _isInitialized;}

◆ setCandidateRating()

virtual void lsst::afw::math::SpatialCellCandidate::setCandidateRating ( double  )
inlinevirtualinherited

Set the candidate's rating.

Definition at line 99 of file SpatialCell.h.

99 {}

◆ setChi2()

void lsst::afw::math::SpatialCellImageCandidate::setChi2 ( double  chi2)
inlineinherited

Set the candidate's chi^2.

Definition at line 148 of file SpatialCell.h.

148 { _chi2 = chi2; }

◆ setHeight()

static void lsst::afw::math::SpatialCellImageCandidate::setHeight ( int  height)
inlinestaticinherited

Set the height of the image that getImage should return.

Definition at line 141 of file SpatialCell.h.

141 { _height = height; }

◆ setStatus()

void lsst::afw::math::SpatialCellCandidate::setStatus ( Status  status)
inherited

Set the candidate's status.

Definition at line 53 of file SpatialCell.cc.

53  {
54  switch (status) {
55  case GOOD:
56  case UNKNOWN:
57  _status = status;
58  return;
59  case BAD:
60  _status = status;
61  return;
62  }
63 
65  (boost::format("Saw unknown status %d") % status).str());
66 }
Reports invalid arguments.
Definition: Runtime.h:66
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174

◆ setWidth()

static void lsst::afw::math::SpatialCellImageCandidate::setWidth ( int  width)
inlinestaticinherited

Set the width of the image that getImage should return.

Definition at line 136 of file SpatialCell.h.

136 { _width = width; }

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