lsst.meas.base  15.0-2-g2010ef9
Blendedness.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2016 LSST/AURA
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_MEAS_BASE_Blendedness_h_INCLUDED
25 #define LSST_MEAS_BASE_Blendedness_h_INCLUDED
26 
27 #include "lsst/pex/config.h"
30 #include "lsst/afw/table/Source.h"
31 #include "lsst/afw/image/Image.h"
34 
35 namespace lsst { namespace meas { namespace base {
36 
38 public:
40  doOld, bool,
41  "Whether to compute HeavyFootprint dot products (the old deblend.blendedness parameter)"
42  );
43 
45  doFlux, bool,
46  "Whether to compute quantities related to the Gaussian-weighted flux"
47  );
48 
50  doShape, bool,
51  "Whether to compute quantities related to the Gaussian-weighted shape"
52  );
53 
55  nSigmaWeightMax, double,
56  "Radius factor that sets the maximum extent of the weight function (and hence the flux measurements)"
57  );
58 
60  doOld(true),
61  doFlux(true),
62  doShape(true),
63  nSigmaWeightMax(3.0)
64  {}
65 
66 };
67 
78 public:
79 
80  // Structures and routines to manage flaghandler
81  static FlagDefinitionList const & getFlagDefinitions();
82  static FlagDefinition const FAILURE;
84  static FlagDefinition const NO_SHAPE;
85 
87 
88  BlendednessAlgorithm(Control const & ctrl, std::string const & name, afw::table::Schema & schema);
89 
106  static float computeAbsExpectation(float data, float variance);
107 
123  static float computeAbsBias(float mu, float variance);
124 
125  void measureChildPixels(
126  afw::image::MaskedImage<float> const & image,
128  ) const;
129 
130  void measureParentPixels(
131  afw::image::MaskedImage<float> const & image,
133  ) const;
134 
135  virtual void measure(
136  afw::table::SourceRecord & measRecord,
137  afw::image::Exposure<float> const & exposure
138  ) const {}
139 
140  virtual void fail(
141  afw::table::SourceRecord & measRecord,
142  MeasurementError * error=nullptr
143  ) const {}
144 
145 
146 private:
147 
148  void _measureMoments(
150  afw::table::SourceRecord & child,
151  afw::table::Key<double> const & fluxRawKey,
152  afw::table::Key<double> const & fluxAbsKey,
153  ShapeResultKey const & _shapeRawKey,
154  ShapeResultKey const & _shapeAbsKey
155  ) const;
156 
157  Control const _ctrl;
159  afw::table::Key<double> _fluxRaw;
160  afw::table::Key<double> _fluxChildRaw;
161  afw::table::Key<double> _fluxParentRaw;
162  afw::table::Key<double> _fluxAbs;
163  afw::table::Key<double> _fluxChildAbs;
164  afw::table::Key<double> _fluxParentAbs;
165  ShapeResultKey _shapeChildRaw;
166  ShapeResultKey _shapeParentRaw;
167  ShapeResultKey _shapeChildAbs;
168  ShapeResultKey _shapeParentAbs;
169  FlagHandler _flagHandler;
170 };
171 
172 }}} // namespace lsst::meas::base
173 
174 #endif // LSST_MEAS_BASE_Blendedness_h_INCLUDED
afw::table::Key< afw::table::Array< ImagePixelT > > image
static FlagDefinition const NO_CENTROID
Definition: Blendedness.h:83
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=nullptr) const
Handle an exception thrown by the current algorithm by setting flags in the given record...
Definition: Blendedness.h:140
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
Definition: FlagHandler.h:38
This defines the base of measurement transformations.
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
static FlagDefinition const FAILURE
Definition: Blendedness.h:82
A FunctorKey for ShapeResult.
STL class.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
Definition: FlagHandler.h:156
static FlagDefinition const NO_SHAPE
Definition: Blendedness.h:84
double nSigmaWeightMax
"Radius factor that sets the maximum extent of the weight function (and hence the flux measurements)"...
Definition: Blendedness.h:57
bool doShape
"Whether to compute quantities related to the Gaussian-weighted shape" ;
Definition: Blendedness.h:52
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
Called to measure a single child source in an image.
Definition: Blendedness.h:135
An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm ...
Definition: Algorithm.h:185
vector-type utility class to build a collection of FlagDefinitions
Definition: FlagHandler.h:63
bool doFlux
"Whether to compute quantities related to the Gaussian-weighted flux" ;
Definition: Blendedness.h:47
bool doOld
"Whether to compute HeavyFootprint dot products (the old deblend.blendedness parameter)" ; ...
Definition: Blendedness.h:42
Compute metrics that measure how blended objects are.
Definition: Blendedness.h:77