lsst.ip.diffim  13.0-22-g3839dbb+16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
KernelSumVisitor.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
12 #ifndef LSST_IP_DIFFIM_KERNELSUMVISITOR_H
13 #define LSST_IP_DIFFIM_KERNELSUMVISITOR_H
14 
15 #include <memory>
16 
17 #include "lsst/afw/math.h"
18 #include "lsst/afw/image.h"
19 #include "lsst/pex/policy/Policy.h"
20 
21 namespace lsst {
22 namespace ip {
23 namespace diffim {
24 namespace detail {
25 
26  template<typename PixelT>
27  class KernelSumVisitor : public lsst::afw::math::CandidateVisitor {
28  public:
29  typedef std::shared_ptr<KernelSumVisitor<PixelT> > Ptr;
30 
31  enum Mode {AGGREGATE = 0, REJECT = 1};
32 
33  KernelSumVisitor(lsst::pex::policy::Policy const& policy);
34  virtual ~KernelSumVisitor() {};
35 
36  void setMode(Mode mode) {_mode = mode;}
37  int getNRejected() {return _nRejected;}
38  double getkSumMean() {return _kSumMean;}
39  double getkSumStd() {return _kSumStd;}
40  double getdkSumMax() {return _dkSumMax;}
41  int getkSumNpts() {return _kSumNpts;}
42 
43  void resetKernelSum();
44  void processCandidate(lsst::afw::math::SpatialCellCandidate *candidate);
46 
47  private:
49  std::vector<double> _kSums;
50  double _kSumMean;
51  double _kSumStd;
52  double _dkSumMax;
53  int _kSumNpts;
54  int _nRejected;
55  lsst::pex::policy::Policy _policy;
56  };
57 
58  template<typename PixelT>
59  std::shared_ptr<KernelSumVisitor<PixelT> >
60  makeKernelSumVisitor(lsst::pex::policy::Policy const& policy) {
61  return std::shared_ptr<KernelSumVisitor<PixelT>>(new KernelSumVisitor<PixelT>(policy));
62  }
63 
64 }}}} // end of namespace lsst::ip::diffim::detail
65 
66 #endif
int _kSumNpts
Number of points used in the statistics.
Mode _mode
Processing mode; AGGREGATE or REJECT.
std::shared_ptr< KernelSumVisitor< PixelT > > makeKernelSumVisitor(lsst::pex::policy::Policy const &policy)
std::shared_ptr< KernelSumVisitor< PixelT > > Ptr
double _kSumMean
Clipped mean of the kernel sums.
A class to accumulate kernel sums across SpatialCells.
void processCandidate(lsst::afw::math::SpatialCellCandidate *candidate)
double _dkSumMax
Maximum acceptable deviation from mean sum.
double _kSumStd
Clipped standard deviation of kernel sums.
std::vector< double > _kSums
List of all candidate kernel sums.
KernelSumVisitor(lsst::pex::policy::Policy const &policy)
int _nRejected
Number of candidates rejected during processCandidate()
lsst::pex::policy::Policy _policy
Policy controlling behavior.