LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lsst::meas::algorithms::evalChi2Visitor< PixelT > Class Template Reference

A class to pass around to all our PsfCandidates to evaluate the PSF fit's X^2. More...

Inheritance diagram for lsst::meas::algorithms::evalChi2Visitor< PixelT >:
lsst::afw::math::CandidateVisitor

Public Member Functions

 evalChi2Visitor (afw::math::Kernel const &kernel, double lambda)
 
void reset ()
 
void processCandidate (afw::math::SpatialCellCandidate *candidate)
 
double getValue () const
 

Detailed Description

template<typename PixelT>
class lsst::meas::algorithms::evalChi2Visitor< PixelT >

A class to pass around to all our PsfCandidates to evaluate the PSF fit's X^2.

Definition at line 431 of file SpatialModelPsf.cc.

Constructor & Destructor Documentation

◆ evalChi2Visitor()

template<typename PixelT >
lsst::meas::algorithms::evalChi2Visitor< PixelT >::evalChi2Visitor ( afw::math::Kernel const & kernel,
double lambda )
inlineexplicit

Definition at line 439 of file SpatialModelPsf.cc.

440 : afw::math::CandidateVisitor(),
441 _chi2(0.0),
442 _kernel(kernel),
443 _lambda(lambda),
444 _kImage(std::shared_ptr<KImage>(new KImage(kernel.getDimensions()))) {}

Member Function Documentation

◆ getValue()

template<typename PixelT >
double lsst::meas::algorithms::evalChi2Visitor< PixelT >::getValue ( ) const
inline

Definition at line 486 of file SpatialModelPsf.cc.

486{ return _chi2; }

◆ processCandidate()

template<typename PixelT >
void lsst::meas::algorithms::evalChi2Visitor< PixelT >::processCandidate ( afw::math::SpatialCellCandidate * candidate)
inlinevirtual

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

Definition at line 449 of file SpatialModelPsf.cc.

449 {
450 PsfCandidate<PixelT>* imCandidate = dynamic_cast<PsfCandidate<PixelT>*>(candidate);
451 if (imCandidate == NULL) {
453 "Failed to cast SpatialCellCandidate to PsfCandidate");
454 }
455
456 double const xcen = imCandidate->getSource()->getX();
457 double const ycen = imCandidate->getSource()->getY();
458
459 _kernel.computeImage(*_kImage, true, xcen, ycen);
461 try {
462 data = imCandidate->getOffsetImage(WARP_ALGORITHM, WARP_BUFFER);
464 return;
465 }
466
467 try {
469 fitKernel(*_kImage, *data, _lambda, false, imCandidate->getSource()->getId());
470
471 double dchi2 = result.first; // chi^2 from this object
472 double const amp = result.second; // estimate of amplitude of model at this point
473
474 imCandidate->setChi2(dchi2);
475 imCandidate->setAmplitude(amp);
476
477 _chi2 += dchi2;
479 imCandidate->setStatus(afw::math::SpatialCellCandidate::BAD);
480 imCandidate->setChi2(std::numeric_limits<double>::quiet_NaN());
481 imCandidate->setAmplitude(std::numeric_limits<double>::quiet_NaN());
482 }
483 }
py::object result
Definition _schema.cc:429
char * data
Definition BaseRecord.cc:61
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
double computeImage(lsst::afw::image::Image< Pixel > &image, bool doNormalize, double x=0.0, double y=0.0) const
Compute an image (pixellized representation of the kernel) in place.
Definition Kernel.cc:76
Reports attempts to exceed implementation-defined length limits for some classes.
Definition Runtime.h:76
Reports errors in the logical structure of the program.
Definition Runtime.h:46
Reports when the result of an operation cannot be represented by the destination type.
Definition Runtime.h:115

◆ reset()

template<typename PixelT >
void lsst::meas::algorithms::evalChi2Visitor< PixelT >::reset ( )
inlinevirtual

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

Definition at line 446 of file SpatialModelPsf.cc.

446{ _chi2 = 0.0; }

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