LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
DipoleAlgorithms.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 #ifndef LSST_IP_DIFFIM_DIPOLEALGORITHMS_H
26 #define LSST_IP_DIFFIM_DIPOLEALGORITHMS_H
27 // Control/algorithm hierarchy for dipole measurement.
29 //
30 
31 #include "lsst/base.h"
32 #include "lsst/pex/config.h"
34 
35 namespace lsst {
36 namespace ip {
37 namespace diffim {
38 
39 class DipoleCentroidControl;
40 class DipoleFluxControl;
41 
42 
47 public:
48 
55 
57  DipoleCentroidControl const & getControl() const;
58 
60  KeyTuple const & getPositiveKeys() const { return _positiveKeys; }
61  KeyTuple const & getNegativeKeys() const { return _negativeKeys; }
62 
63 protected:
64 
66  DipoleCentroidAlgorithm(DipoleCentroidControl const & ctrl, KeyTuple const & positiveKeys,
67  KeyTuple const & negativeKeys);
68 
71  afw::table::Schema & schema, char const * doc);
72 
73 private:
76 };
77 
79 public:
80 
81  virtual PTR(DipoleCentroidControl) clone() const {
82  return boost::static_pointer_cast<DipoleCentroidControl>(_clone());
83  }
84 
86  afw::table::Schema & schema,
87  PTR(daf::base::PropertyList) const & metadata = PTR(daf::base::PropertyList)(),
88  meas::algorithms::AlgorithmMap const & others = meas::algorithms::AlgorithmMap()
89  ) const {
90  return boost::static_pointer_cast<DipoleCentroidAlgorithm>(
91  _makeAlgorithm(schema, metadata, others));
92  }
93 
94 protected:
95  explicit DipoleCentroidControl(std::string const & name_, double priority=0.0) :
96  AlgorithmControl(name_, priority) {}
97 };
98 
99 
104 public:
105 
112 
114  DipoleFluxControl const & getControl() const;
115 
117  KeyTuple const & getPositiveKeys() const { return _positiveKeys; }
118  KeyTuple const & getNegativeKeys() const { return _negativeKeys; }
119 
120 protected:
121 
123  DipoleFluxAlgorithm(DipoleFluxControl const & ctrl, KeyTuple const & positiveKeys,
124  KeyTuple const & negativeKeys);
125 
128  afw::table::Schema & schema, char const * doc);
129 
130 private:
133 };
134 
136 public:
137 
138  virtual PTR(DipoleFluxControl) clone() const {
139  return boost::static_pointer_cast<DipoleFluxControl>(_clone()); }
140 
142  afw::table::Schema & schema,
143  PTR(daf::base::PropertyList) const & metadata = PTR(daf::base::PropertyList)(),
144  meas::algorithms::AlgorithmMap const & others = meas::algorithms::AlgorithmMap()
145  ) const {
146  return boost::static_pointer_cast<DipoleFluxAlgorithm>(
147  _makeAlgorithm(schema, metadata, others));
148  }
149 
150 protected:
151  explicit DipoleFluxControl(std::string const & name_, double priority=2.0) :
152  AlgorithmControl(name_, priority) {}
153 };
154 
156  DipoleCentroidControl const & ctrl, KeyTuple const & positiveKeys, KeyTuple const & negativeKeys
157  ) :
158  Algorithm(ctrl), _positiveKeys(positiveKeys), _negativeKeys(negativeKeys)
159 {}
160 
162  DipoleCentroidControl const & ctrl, afw::table::Schema & schema, char const * doc
163  ) :
164  Algorithm(ctrl), _positiveKeys(afw::table::addCentroidFields(schema, ctrl.name + ".pos", doc)),
165  _negativeKeys(afw::table::addCentroidFields(schema, ctrl.name + ".neg", doc))
166 {}
167 
169  return static_cast<DipoleCentroidControl const &>(Algorithm::getControl());
170 }
171 
173  DipoleFluxControl const & ctrl, KeyTuple const & positiveKeys, KeyTuple const & negativeKeys
174  ) :
175  Algorithm(ctrl), _positiveKeys(positiveKeys), _negativeKeys(negativeKeys)
176 {}
177 
179  DipoleFluxControl const & ctrl, afw::table::Schema & schema, char const * doc
180  ) :
181  Algorithm(ctrl), _positiveKeys(afw::table::addFluxFields(schema, ctrl.name + ".pos", doc)),
182  _negativeKeys(afw::table::addFluxFields(schema, ctrl.name + ".neg", doc))
183 {}
184 
186  return static_cast<DipoleFluxControl const &>(Algorithm::getControl());
187 }
188 
189 
190 
191 
196 public:
197  NaiveDipoleCentroidControl() : DipoleCentroidControl("centroid.dipole.naive") {}
198 
199 private:
201  virtual PTR(meas::algorithms::Algorithm) _makeAlgorithm(
202  afw::table::Schema & schema, PTR(daf::base::PropertyList) const & metadata
203  ) const;
204 };
205 
210 public:
211  NaiveDipoleFluxControl() : DipoleFluxControl("flux.dipole.naive") {}
212 
213 private:
215  virtual PTR(meas::algorithms::Algorithm) _makeAlgorithm(
216  afw::table::Schema & schema, PTR(daf::base::PropertyList) const & metadata
217  ) const;
218 };
219 
223 class PsfDipoleFluxControl : public DipoleFluxControl {
224 public:
225  LSST_CONTROL_FIELD(maxPixels, int, "Maximum number of pixels to apply the measurement to");
226  LSST_CONTROL_FIELD(stepSizeCoord, float, "Default initial step size for coordinates in non-linear fitter");
227  LSST_CONTROL_FIELD(stepSizeFlux, float, "Default initial step size for flux in non-linear fitter");
228  LSST_CONTROL_FIELD(errorDef, double, "How many sigma the error bars of the non-linear fitter represent");
229  LSST_CONTROL_FIELD(maxFnCalls, int, "Maximum function calls for non-linear fitter; 0 = unlimited");
230  PsfDipoleFluxControl() : DipoleFluxControl("flux.dipole.psf"), maxPixels(500),
231  stepSizeCoord(0.1), stepSizeFlux(1.0), errorDef(1.0), maxFnCalls(100000) {}
232 
233 private:
235  virtual PTR(meas::algorithms::Algorithm) _makeAlgorithm(
236  afw::table::Schema & schema, PTR(daf::base::PropertyList) const & metadata
237  ) const;
238 };
239 
240 
241 }}}// namespace lsst::ip::diffim
242 
243 #endif // !LSST_IP_DIFFIM_DIPOLEALGORITHMS_H
Defines the fields and offsets for a table.
Definition: Schema.h:46
virtual boost::shared_ptr< meas::algorithms::Algorithm > _makeAlgorithm(afw::table::Schema &schema, boost::shared_ptr< daf::base::PropertyList > const &metadata) const
DipoleFluxControl(std::string const &name_, double priority=2.0)
#define PTR(...)
Definition: base.h:41
Class for storing ordered metadata with comments.
Definition: PropertyList.h:81
virtual boost::shared_ptr< AlgorithmControl > _clone() const =0
KeyTuple const & getNegativeKeys() const
C++ control object for naive dipole centroid.
double priority
&quot;Parameter that sets the sort order for algorithms; lower numbers go first. &quot; &quot;Typically, priority=0 for centroids, 1 for shapes, and 2 for fluxes.&quot; ;
Definition: Algorithm.h:184
KeyTuple const & getPositiveKeys() const
Return the standard centroid keys registered by this algorithm.
afw::table::KeyTuple< afw::table::Flux > KeyTuple
Tuple type that holds the keys that define a standard flux algorithm.
C++ control object for PSF dipole fluxes.
virtual boost::shared_ptr< meas::algorithms::AlgorithmControl > _clone() const
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
Definition: config.h:36
Base class for source measurement algorithms.
Definition: Algorithm.h:106
DipoleFluxAlgorithm(DipoleFluxControl const &ctrl, KeyTuple const &positiveKeys, KeyTuple const &negativeKeys)
Initialize with a manually-constructed key tuple.
Base class for measurement algorithm control objects.
Definition: Algorithm.h:168
DipoleCentroidControl(std::string const &name_, double priority=0.0)
DipoleFluxControl const & getControl() const
Return a clone of the control object used to construct the algorithm.
tbl::Schema schema
Definition: CoaddPsf.cc:324
DipoleCentroidAlgorithm(DipoleCentroidControl const &ctrl, KeyTuple const &positiveKeys, KeyTuple const &negativeKeys)
Initialize with a manually-constructed key tuple.
KeyTuple const & getNegativeKeys() const
Intermediate base class for algorithms that compute a flux.
Intermediate base class for algorithms that compute a centroid.
afw::table::KeyTuple< afw::table::Centroid > KeyTuple
Tuple type that holds the keys that define a standard centroid algorithm.
virtual boost::shared_ptr< DipoleFluxAlgorithm > makeAlgorithm(afw::table::Schema &schema, boost::shared_ptr< daf::base::PropertyList > const &metadata=boost::shared_ptr< daf::base::PropertyList >(), meas::algorithms::AlgorithmMap const &others=meas::algorithms::AlgorithmMap()) const
virtual boost::shared_ptr< Algorithm > _makeAlgorithm(afw::table::Schema &schema, boost::shared_ptr< daf::base::PropertyList > const &metadata) const
Definition: Algorithm.h:211
virtual boost::shared_ptr< DipoleCentroidAlgorithm > makeAlgorithm(afw::table::Schema &schema, boost::shared_ptr< daf::base::PropertyList > const &metadata=boost::shared_ptr< daf::base::PropertyList >(), meas::algorithms::AlgorithmMap const &others=meas::algorithms::AlgorithmMap()) const
KeyTuple< Centroid > addCentroidFields(Schema &schema, std::string const &name, std::string const &doc)
Convenience function to setup fields for centroid measurement algorithms.
KeyTuple const & getPositiveKeys() const
Return the standard flux keys registered by this algorithm.
C++ control object for naive dipole fluxes.
virtual boost::shared_ptr< DipoleCentroidControl > clone() const
AlgorithmControl(std::string const &name_, double priority_)
Definition: Algorithm.h:229
virtual boost::shared_ptr< DipoleFluxControl > clone() const
std::map< std::string, boost::shared_ptr< Algorithm const > > AlgorithmMap
Definition: Algorithm.h:79
DipoleCentroidControl const & getControl() const
Return a clone of the control object used to construct the algorithm.
KeyTuple< lsst::afw::table::Flux > addFluxFields(lsst::afw::table::Schema &schema, std::string const &filter, std::string const &name, std::string const &doc, std::string const &unit)
Convenience function to setup fields for fluxes.