LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
DipoleAlgorithms.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008-2015 AURA/LSST
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <http://www.lsstcorp.org/LegalNotices/>.
21  */
22 
26 #include <iostream> // std::cout
27 #include <algorithm> // std::sort
28 #include <functional> // std::binary_function
29 #include <limits> // std::numeric_limits
30 #include <cmath> // std::sqrt
31 
32 #if !defined(DOXYGEN)
33 # include "Minuit2/FCNBase.h"
34 # include "Minuit2/FunctionMinimum.h"
35 # include "Minuit2/MnMigrad.h"
36 # include "Minuit2/MnMinos.h"
37 # include "Minuit2/MnPrint.h"
38 #endif
39 
40 #include "boost/shared_ptr.hpp"
41 #include "lsst/pex/exceptions.h"
42 #include "lsst/pex/logging/Trace.h"
43 #include "lsst/afw/image.h"
44 #include "lsst/afw/detection.h"
45 #include "lsst/afw/detection/FootprintArray.cc"
46 #include "lsst/afw/table.h"
47 #include "lsst/afw/math.h"
48 #include "lsst/afw/geom.h"
50 #include "ndarray/eigen.h"
51 
52 namespace pexExceptions = lsst::pex::exceptions;
53 namespace afwDet = lsst::afw::detection;
54 namespace afwImage = lsst::afw::image;
55 namespace afwMath = lsst::afw::math;
56 namespace afwGeom = lsst::afw::geom;
57 
58 namespace lsst { namespace ip { namespace diffim {
59 
60  int const NEGCENTXPAR(0); // Parameter for the x-component of the negative lobe centroid
61  int const NEGCENTYPAR(1); // Parameter for the y-component of the negative lobe centroid
62  int const NEGFLUXPAR(2); // Parameter for the flux of the negative lobe
63  int const POSCENTXPAR(3); // Parameter for the x-component of the positive lobe centroid
64  int const POSCENTYPAR(4); // Parameter for the y-component of the positive lobe centroid
65  int const POSFLUXPAR(5); // Parameter for the flux of the positive lobe
66 
67 
68 namespace {
69 
70 void naiveCentroid(
71  afw::table::SourceRecord & source,
72  afw::image::Exposure<float> const& exposure,
73  afw::geom::Point2I const & center,
74  meas::base::CentroidResultKey const & keys
75  )
76 {
77  typedef afw::image::Image<float> ImageT;
78  ImageT const& image = *exposure.getMaskedImage().getImage();
79  // set to the input centroid, just in case all else fails
80  source.set(keys.getX(), center.getX());
81  source.set(keys.getY(), center.getY());
82 
83  int x = center.getX() - image.getX0();
84  int y = center.getY() - image.getY0();
85 
86  if (x < 1 || x >= image.getWidth() - 1 || y < 1 || y >= image.getHeight() - 1) {
87  throw LSST_EXCEPT(pex::exceptions::LengthError,
88  (boost::format("Object at (%d, %d) is too close to the edge")
89  % x % y).str());
90  }
91 
92  ImageT::xy_locator im = image.xy_at(x, y);
93 
94  double const sum =
95  (im(-1, 1) + im( 0, 1) + im( 1, 1) +
96  im(-1, 0) + im( 0, 0) + im( 1, 0) +
97  im(-1, -1) + im( 0, -1) + im( 1, -1));
98 
99 
100  if (sum == 0.0) {
101  throw LSST_EXCEPT(pexExceptions::RuntimeError,
102  (boost::format("Object at (%d, %d) has no counts") %
103  x % y).str());
104  }
105 
106  double const sum_x =
107  -im(-1, 1) + im( 1, 1) +
108  -im(-1, 0) + im( 1, 0) +
109  -im(-1, -1) + im( 1, -1);
110  double const sum_y =
111  (im(-1, 1) + im( 0, 1) + im( 1, 1)) -
112  (im(-1, -1) + im( 0, -1) + im( 1, -1));
113 
114  float xx = afw::image::indexToPosition(x + image.getX0()) + sum_x / sum;
115  float yy = afw::image::indexToPosition(y + image.getY0()) + sum_y / sum;
116  source.set(keys.getX(), xx);
117  source.set(keys.getY(), yy);
118 }
119 
120 } // anonymous namespace
121 
122 
124  Control const & ctrl,
125  std::string const & name,
127 ) : DipoleCentroidAlgorithm(ctrl, name, schema, "unweighted first moment centroid"),
128  _ctrl(ctrl),
129  _centroidExtractor(schema, name)
130 {
131 }
132 
137  afw::table::SourceRecord & source,
138  afw::image::Exposure<float> const & exposure
139 ) const {
140  afw::detection::PeakCatalog const& peaks = source.getFootprint()->getPeaks();
141 
142  naiveCentroid(source, exposure, peaks[0].getI(), (peaks[0].getPeakValue() >= 0 ?
143  getPositiveKeys() :
144  getNegativeKeys()));
145  if (peaks.size() > 1) {
146  naiveCentroid(source, exposure, peaks[1].getI(), (peaks[1].getPeakValue() >= 0 ?
147  getPositiveKeys() :
148  getNegativeKeys()));
149  }
150 }
151 
154  _flagHandler.handleFailure(measRecord, error);
155 }
156 
157 
158 namespace {
159 
160 class NaiveDipoleFootprinter : public afw::detection::FootprintFunctor< afw::image::MaskedImage<float> > {
161 public:
162  explicit NaiveDipoleFootprinter(afw::image::MaskedImage<float> const& mimage
163  ) : afw::detection::FootprintFunctor< afw::image::MaskedImage<float> >(mimage),
164  _sumPositive(0.0), _sumNegative(0.0), _numPositive(0), _numNegative(0) {}
165 
167  void reset() {
168  _sumPositive = _sumNegative = 0.0;
170  }
171  void reset(afwDet::Footprint const&) {}
172 
174  void operator()( afw::image::MaskedImage<float>::xy_locator loc,
175  int,
176  int
177  ) {
178  afw::image::MaskedImage<float>::Image::Pixel ival = loc.image(0, 0);
179  afw::image::MaskedImage<float>::Image::Pixel vval = loc.variance(0, 0);
180  if (ival >= 0.0) {
181  _sumPositive += ival;
182  _varPositive += vval;
183  ++_numPositive;
184  } else {
185  _sumNegative += ival;
186  _varPositive += vval;
187  ++_numNegative;
188  }
189  }
190 
191  double getSumPositive() const { return _sumPositive; }
192  double getSumNegative() const { return _sumNegative; }
193  double getVarPositive() const { return _sumPositive; }
194  double getVarNegative() const { return _sumNegative; }
195  int getNumPositive() const { return _numPositive; }
196  int getNumNegative() const { return _numNegative; }
197 
198 private:
199  double _sumPositive;
200  double _sumNegative;
201  double _varPositive;
202  double _varNegative;
205 };
206 
207 } // anonymous namespace
208 
209 
214  afw::table::SourceRecord & source,
215  afw::image::Exposure<float> const & exposure
216 ) const {
217  typedef afw::image::Exposure<float>::MaskedImageT MaskedImageT;
218 
219  NaiveDipoleFootprinter functor(exposure.getMaskedImage());
220  functor.apply(*source.getFootprint());
221 
222  source.set(getPositiveKeys().getFlux(), functor.getSumPositive());
223  source.set(getPositiveKeys().getFluxSigma(), ::sqrt(functor.getVarPositive()));
224  source.set(_numPositiveKey, functor.getNumPositive());
225 
226  source.set(getNegativeKeys().getFlux(), functor.getSumNegative());
227  source.set(getNegativeKeys().getFluxSigma(), ::sqrt(functor.getVarNegative()));
228  source.set(_numNegativeKey, functor.getNumNegative());
229 }
230 
232  _flagHandler.handleFailure(measRecord, error);
233 }
234 
235 
239 class MinimizeDipoleChi2 : public ROOT::Minuit2::FCNBase {
240 public:
241  explicit MinimizeDipoleChi2(PsfDipoleFlux const& psfDipoleFlux,
242  afw::table::SourceRecord & source,
243  afw::image::Exposure<float> const& exposure
244  ) : _errorDef(1.0),
245  _nPar(6),
246  _maxPix(1e4),
247  _bigChi2(1e10),
248  _psfDipoleFlux(psfDipoleFlux),
249  _source(source),
250  _exposure(exposure)
251  {}
252  double Up() const { return _errorDef; }
253  void setErrorDef(double def) { _errorDef = def; }
254  int getNpar() const { return _nPar; }
255  int getMaxPix() const { return _maxPix; }
256  void setMaxPix(int maxPix) { _maxPix = maxPix; }
257 
258  // Evaluate our cost function (in this case chi^2)
259  virtual double operator()(std::vector<double> const & params) const {
260  double negCenterX = params[NEGCENTXPAR];
261  double negCenterY = params[NEGCENTYPAR];
262  double negFlux = params[NEGFLUXPAR];
263  double posCenterX = params[POSCENTXPAR];
264  double posCenterY = params[POSCENTYPAR];
265  double posFlux = params[POSFLUXPAR];
266 
267  /* Restrict negative dipole to be negative; positive to be positive */
268  if ((negFlux > 0.0) || (posFlux < 0.0)) {
269  return _bigChi2;
270  }
271 
272  std::pair<double,int> fit = _psfDipoleFlux.chi2(_source, _exposure, negCenterX, negCenterY, negFlux,
273  posCenterX, posCenterY, posFlux);
274  double chi2 = fit.first;
275  int nPix = fit.second;
276  if (nPix > _maxPix) {
277  return _bigChi2;
278  }
279 
280  return chi2;
281  }
282 
283 private:
284  double _errorDef; // how much cost function has changed at the +- 1 error points
285  int _nPar; // number of parameters in the fit; hard coded for MinimizeDipoleChi2
286  int _maxPix; // maximum number of pixels that shoud be in the footprint;
287  // prevents too much centroid wander
288  double _bigChi2; // large value to tell fitter when it has gone into bad region of parameter space
289 
293 };
294 
295 std::pair<double,int> PsfDipoleFlux::chi2(
296  afw::table::SourceRecord & source,
297  afw::image::Exposure<float> const& exposure,
298  double negCenterX, double negCenterY, double negFlux,
299  double posCenterX, double posCenterY, double posFlux
300 ) const {
301 
302  afw::geom::Point2D negCenter(negCenterX, negCenterY);
303  afw::geom::Point2D posCenter(posCenterX, posCenterY);
304 
305  CONST_PTR(afw::detection::Footprint) footprint = source.getFootprint();
306 
307  /*
308  * Fit for the superposition of Psfs at the two centroids.
309  */
310  CONST_PTR(afwDet::Psf) psf = exposure.getPsf();
311  PTR(afwImage::Image<afwMath::Kernel::Pixel>) negPsf = psf->computeImage(negCenter);
312  PTR(afwImage::Image<afwMath::Kernel::Pixel>) posPsf = psf->computeImage(posCenter);
313 
314  afwImage::Image<double> negModel(footprint->getBBox());
315  afwImage::Image<double> posModel(footprint->getBBox());
316  afwImage::Image<float> data(*(exposure.getMaskedImage().getImage()),footprint->getBBox());
318  footprint->getBBox());
319 
320  afwGeom::Box2I negPsfBBox = negPsf->getBBox();
321  afwGeom::Box2I posPsfBBox = posPsf->getBBox();
322  afwGeom::Box2I negModelBBox = negModel.getBBox();
323  afwGeom::Box2I posModelBBox = posModel.getBBox();
324 
325  // Portion of the negative Psf that overlaps the model
326  int negXmin = std::max(negPsfBBox.getMinX(), negModelBBox.getMinX());
327  int negYmin = std::max(negPsfBBox.getMinY(), negModelBBox.getMinY());
328  int negXmax = std::min(negPsfBBox.getMaxX(), negModelBBox.getMaxX());
329  int negYmax = std::min(negPsfBBox.getMaxY(), negModelBBox.getMaxY());
330  afwGeom::Box2I negBBox = afwGeom::Box2I(afwGeom::Point2I(negXmin, negYmin),
331  afwGeom::Point2I(negXmax, negYmax));
332  afwImage::Image<afwMath::Kernel::Pixel> negSubim(*negPsf, negBBox);
333  afwImage::Image<double> negModelSubim(negModel, negBBox);
334  negModelSubim += negSubim;
335 
336  // Portion of the positive Psf that overlaps the model
337  int posXmin = std::max(posPsfBBox.getMinX(), posModelBBox.getMinX());
338  int posYmin = std::max(posPsfBBox.getMinY(), posModelBBox.getMinY());
339  int posXmax = std::min(posPsfBBox.getMaxX(), posModelBBox.getMaxX());
340  int posYmax = std::min(posPsfBBox.getMaxY(), posModelBBox.getMaxY());
341  afwGeom::Box2I posBBox = afwGeom::Box2I(afwGeom::Point2I(posXmin, posYmin),
342  afwGeom::Point2I(posXmax, posYmax));
343  afwImage::Image<afwMath::Kernel::Pixel> posSubim(*posPsf, posBBox);
344  afwImage::Image<double> posModelSubim(posModel, posBBox);
345  posModelSubim += posSubim;
346 
347  negModel *= negFlux; // scale negative model to image
348  posModel *= posFlux; // scale positive model to image
349  afwImage::Image<double> residuals(negModel, true); // full model contains negative lobe...
350  residuals += posModel; // plus positive lobe...
351  residuals -= data; // minus the data...
352  residuals *= residuals; // squared...
353  residuals /= var; // divided by the variance : [(model-data)/sigma]**2
355  double chi2 = stats.getValue(afwMath::SUM);
356  int nPix = stats.getValue(afwMath::NPOINT);
357  return std::pair<double,int>(chi2, nPix);
358 }
359 
361  afw::table::SourceRecord & source,
362  afw::image::Exposure<float> const & exposure
363 ) const {
364  source.set(_flagMaxPixelsKey, true);
365 
366  typedef afw::image::Exposure<float>::MaskedImageT MaskedImageT;
367 
368  CONST_PTR(afw::detection::Footprint) footprint = source.getFootprint();
369  if (!footprint) {
370  throw LSST_EXCEPT(pex::exceptions::RuntimeError,
371  (boost::format("No footprint for source %d") % source.getId()).str());
372  }
373 
374  if (footprint->getArea() > _ctrl.maxPixels) {
375  // Too big
376  return;
377  }
378  source.set(_flagMaxPixelsKey, false);
379 
380  afw::detection::PeakCatalog peakCatalog = afw::detection::PeakCatalog(footprint->getPeaks());
381 
382  if (peakCatalog.size() == 0) {
383  throw LSST_EXCEPT(pex::exceptions::RuntimeError,
384  (boost::format("No peak for source %d") % source.getId()).str());
385  }
386  else if (peakCatalog.size() == 1) {
387  // No deblending to do
388  return;
389  }
390 
391  // For N>=2, just measure the brightest-positive and brightest-negative
392  // peaks. peakCatalog is automatically ordered by peak flux, with the most
393  // positive one (brightest) being first
394  afw::detection::PeakRecord const& positivePeak = peakCatalog.front();
395  afw::detection::PeakRecord const& negativePeak = peakCatalog.back();
396 
397  // Set up fit parameters and param names
398  ROOT::Minuit2::MnUserParameters fitPar;
399 
400  fitPar.Add((boost::format("P%d")%NEGCENTXPAR).str(), negativePeak.getFx(), _ctrl.stepSizeCoord);
401  fitPar.Add((boost::format("P%d")%NEGCENTYPAR).str(), negativePeak.getFy(), _ctrl.stepSizeCoord);
402  fitPar.Add((boost::format("P%d")%NEGFLUXPAR).str(), negativePeak.getPeakValue(), _ctrl.stepSizeFlux);
403  fitPar.Add((boost::format("P%d")%POSCENTXPAR).str(), positivePeak.getFx(), _ctrl.stepSizeCoord);
404  fitPar.Add((boost::format("P%d")%POSCENTYPAR).str(), positivePeak.getFy(), _ctrl.stepSizeCoord);
405  fitPar.Add((boost::format("P%d")%POSFLUXPAR).str(), positivePeak.getPeakValue(), _ctrl.stepSizeFlux);
406 
407  // Create the minuit object that knows how to minimise our functor
408  //
409  MinimizeDipoleChi2 minimizerFunc(*this, source, exposure);
410  minimizerFunc.setErrorDef(_ctrl.errorDef);
411 
412  //
413  // tell minuit about it
414  //
415  ROOT::Minuit2::MnMigrad migrad(minimizerFunc, fitPar);
416 
417  //
418  // And let it loose
419  //
420  ROOT::Minuit2::FunctionMinimum min = migrad(_ctrl.maxFnCalls);
421 
422  float minChi2 = min.Fval();
423  bool const isValid = min.IsValid() && std::isfinite(minChi2);
424 
425  if (true || isValid) { // calculate coeffs even in minuit is unhappy
426 
427  /* I need to call chi2 one more time to grab nPix to calculate chi2/dof.
428  Turns out that the Minuit operator method has to be const, and the
429  measurement _apply method has to be const, so I can't store nPix as a
430  private member variable anywhere. Consted into a corner.
431  */
432  std::pair<double,int> fit = chi2(source, exposure,
433  min.UserState().Value(NEGCENTXPAR),
434  min.UserState().Value(NEGCENTYPAR),
435  min.UserState().Value(NEGFLUXPAR),
436  min.UserState().Value(POSCENTXPAR),
437  min.UserState().Value(POSCENTYPAR),
438  min.UserState().Value(POSFLUXPAR));
439  double evalChi2 = fit.first;
440  int nPix = fit.second;
441 
442  PTR(afw::geom::Point2D) minNegCentroid(new afw::geom::Point2D(min.UserState().Value(NEGCENTXPAR),
443  min.UserState().Value(NEGCENTYPAR)));
444  source.set(getNegativeKeys().getFlux(), min.UserState().Value(NEGFLUXPAR));
445  source.set(getNegativeKeys().getFluxSigma(), min.UserState().Error(NEGFLUXPAR));
446 
447  PTR(afw::geom::Point2D) minPosCentroid(new afw::geom::Point2D(min.UserState().Value(POSCENTXPAR),
448  min.UserState().Value(POSCENTYPAR)));
449  source.set(getPositiveKeys().getFlux(), min.UserState().Value(POSFLUXPAR));
450  source.set(getPositiveKeys().getFluxSigma(), min.UserState().Error(POSFLUXPAR));
451 
452  source.set(_chi2dofKey, evalChi2 / (nPix - minimizerFunc.getNpar()));
453  source.set(_negCentroid.getX(), minNegCentroid->getX());
454  source.set(_negCentroid.getY(), minNegCentroid->getY());
455  source.set(_posCentroid.getX(), minPosCentroid->getX());
456  source.set(_posCentroid.getY(), minPosCentroid->getY());
457  source.set(_avgCentroid.getX(), 0.5*(minNegCentroid->getX() + minPosCentroid->getX()));
458  source.set(_avgCentroid.getY(), 0.5*(minNegCentroid->getY() + minPosCentroid->getY()));
459 
460  }
461 }
462 
464  _flagHandler.handleFailure(measRecord, error);
465 }
466 }}} // namespace lsst::ip::diffim
int y
An include file to include the public header files for lsst::afw::math.
Defines the fields and offsets for a table.
Definition: Schema.h:46
afw::table::Key< float > _chi2dofKey
float stepSizeFlux
&quot;Default initial step size for flux in non-linear fitter&quot; ;
int getMaxY() const
Definition: Box.h:129
An include file to include the header files for lsst::afw::geom.
double _sumNegative
meas::base::CentroidResultKey _avgCentroid
int const NEGFLUXPAR(2)
double indexToPosition(double ind)
Convert image index to image position.
Definition: ImageUtils.h:54
table::Key< std::string > name
Definition: ApCorrMap.cc:71
Eigen matrix objects that present a view into an ndarray::Array.
afw::table::Key< int > _numNegativeKey
afw::table::Key< CentroidElement > getY() const
Return a Key for the y coordinate.
double _varNegative
afw::table::Schema schema
Definition: GaussianPsf.cc:41
Include files required for standard LSST Exception handling.
definition of the Trace messaging facilities
PixelT Pixel
A pixel in this ImageBase.
Definition: Image.h:133
int const NEGCENTXPAR(0)
#define PTR(...)
Definition: base.h:41
MinimizeDipoleChi2(PsfDipoleFlux const &psfDipoleFlux, afw::table::SourceRecord &source, afw::image::Exposure< float > const &exposure)
boost::shared_ptr< Footprint > getFootprint() const
Definition: Source.h:89
ImagePtr getImage(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage&#39;s image.
Definition: MaskedImage.h:869
void fail(afw::table::SourceRecord &measRecord, meas::base::MeasurementError *error=NULL) const
meas::base::CentroidResultKey _negCentroid
Point< int, 2 > Point2I
Definition: Point.h:283
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
ResultKey const & getPositiveKeys() const
Return the standard flux keys registered by this algorithm.
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:401
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
Definition: operators.h:1250
ResultKey const & getNegativeKeys() const
An integer coordinate rectangle.
Definition: Box.h:53
void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
int const POSCENTXPAR(3)
VariancePtr getVariance(bool const noThrow=false) const
Return a (Ptr to) the MaskedImage&#39;s variance.
Definition: MaskedImage.h:890
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
afw::image::Exposure< float > const & _exposure
int maxPixels
&quot;Maximum number of pixels to apply the measurement to&quot; ;
meas::base::CentroidResultKey _posCentroid
double getValue(Property const prop=NOTHING) const
Return the value of the desired property (if specified in the constructor)
Definition: Statistics.cc:1009
def error
Definition: log.py:108
An include file to include the header files for lsst::afw::image.
void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
afw::table::CatalogT< PeakRecord > PeakCatalog
Definition: Peak.h:225
MaskedImageT getMaskedImage()
Return the MaskedImage.
Definition: Exposure.h:150
An include file to include the header files for lsst::afw::detection.
afw::table::Key< CentroidElement > getX() const
Return a Key for the x coordinate.
int getMinY() const
Definition: Box.h:125
ResultKey const & getNegativeKeys() const
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
number of sample points
Definition: Statistics.h:66
virtual double operator()(std::vector< double > const &params) const
int getMinX() const
Definition: Box.h:124
RecordId getId() const
Convenience accessors for the keys in the minimal reference schema.
Definition: Simple.h:204
NaiveDipoleCentroid(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
int const POSCENTYPAR(4)
double errorDef
&quot;How many sigma the error bars of the non-linear fitter represent&quot; ;
double x
int _numPositive
void fail(afw::table::SourceRecord &measRecord, meas::base::MeasurementError *error=NULL) const
double _varPositive
A set of pixels in an Image.
Definition: Footprint.h:62
Intermediate base class for algorithms that compute a centroid.
int maxFnCalls
&quot;Maximum function calls for non-linear fitter; 0 = unlimited&quot; ;
int isfinite(T t)
Definition: ieee.h:100
void fail(afw::table::SourceRecord &measRecord, meas::base::MeasurementError *error=NULL) const
boost::shared_ptr< lsst::afw::detection::Psf > getPsf()
Return the Exposure&#39;s Psf object.
Definition: Exposure.h:224
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
int const POSFLUXPAR(5)
int _numNegative
int const NEGCENTYPAR(1)
float getFy() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:215
float stepSizeCoord
&quot;Default initial step size for coordinates in non-linear fitter&quot; ;
std::pair< double, int > chi2(afw::table::SourceRecord &source, afw::image::Exposure< float > const &exposure, double negCenterX, double negCenterY, double negFlux, double posCenterX, double poCenterY, double posFlux) const
reference back() const
Return the last record.
Definition: Catalog.h:436
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1082
ResultKey const & getPositiveKeys() const
Return the standard centroid keys registered by this algorithm.
double _sumPositive
#define CONST_PTR(...)
Definition: base.h:47
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Definition: BaseRecord.h:136
void handleFailure(afw::table::BaseRecord &record, MeasurementError const *error=NULL) const
Definition: FlagHandler.cc:59
reference front() const
Return the first record.
Definition: Catalog.h:433
float getPeakValue() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:219
Record class that contains measurements made on a single exposure.
Definition: Source.h:81
float getFx() const
Convenience accessors for the keys in the minimal schema.
Definition: Peak.h:214
afw::table::SourceRecord & _source
int getMaxX() const
Definition: Box.h:128
afw::table::Key< int > _numPositiveKey
find sum of pixels in the image
Definition: Statistics.h:78
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
Record class that represents a peak in a Footprint.
Definition: Peak.h:40
afw::table::Key< afw::table::Flag > _flagMaxPixelsKey
A functor class to allow users to process all the pixels in a Footprint.
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:415
void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const