lsst.meas.base  16.0-12-g5ad1ebf+13
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 {
36 namespace meas {
37 namespace base {
38 
40 public:
42  doOld, bool,
43  "Whether to compute HeavyFootprint dot products (the old deblend.blendedness parameter)");
44 
45  LSST_CONTROL_FIELD(doFlux, bool, "Whether to compute quantities related to the Gaussian-weighted flux");
46 
47  LSST_CONTROL_FIELD(doShape, bool, "Whether to compute quantities related to the Gaussian-weighted shape");
48 
50  "Radius factor that sets the maximum extent of the weight function (and hence the "
51  "flux measurements)");
52 
53  BlendednessControl() : doOld(true), doFlux(true), doShape(true), nSigmaWeightMax(3.0) {}
54 };
55 
66 public:
67  // Structures and routines to manage flaghandler
68  static FlagDefinitionList const& getFlagDefinitions();
69  static FlagDefinition const FAILURE;
71  static FlagDefinition const NO_SHAPE;
72 
74 
75  BlendednessAlgorithm(Control const& ctrl, std::string const& name, afw::table::Schema& schema);
76 
93  static float computeAbsExpectation(float data, float variance);
94 
110  static float computeAbsBias(float mu, float variance);
111 
112  void measureChildPixels(afw::image::MaskedImage<float> const& image,
113  afw::table::SourceRecord& child) const;
114 
115  void measureParentPixels(afw::image::MaskedImage<float> const& image,
116  afw::table::SourceRecord& child) const;
117 
118  virtual void measure(afw::table::SourceRecord& measRecord,
119  afw::image::Exposure<float> const& exposure) const {}
120 
121  virtual void fail(afw::table::SourceRecord& measRecord, MeasurementError* error = nullptr) const {}
122 
123 private:
124  void _measureMoments(afw::image::MaskedImage<float> const& image, afw::table::SourceRecord& child,
125  afw::table::Key<double> const& fluxRawKey, afw::table::Key<double> const& fluxAbsKey,
126  ShapeResultKey const& _shapeRawKey, ShapeResultKey const& _shapeAbsKey) const;
127 
128  Control const _ctrl;
130  afw::table::Key<double> _fluxRaw;
131  afw::table::Key<double> _fluxChildRaw;
132  afw::table::Key<double> _fluxParentRaw;
133  afw::table::Key<double> _fluxAbs;
134  afw::table::Key<double> _fluxChildAbs;
135  afw::table::Key<double> _fluxParentAbs;
136  ShapeResultKey _shapeChildRaw;
137  ShapeResultKey _shapeParentRaw;
138  ShapeResultKey _shapeChildAbs;
139  ShapeResultKey _shapeParentAbs;
140  FlagHandler _flagHandler;
141 };
142 
143 } // namespace base
144 } // namespace meas
145 } // namespace lsst
146 
147 #endif // LSST_MEAS_BASE_Blendedness_h_INCLUDED
afw::table::Key< afw::table::Array< ImagePixelT > > image
static FlagDefinition const NO_CENTROID
Definition: Blendedness.h:70
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:121
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
Definition: FlagHandler.h:40
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:69
A FunctorKey for ShapeResult.
STL class.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
Definition: FlagHandler.h:148
static FlagDefinition const NO_SHAPE
Definition: Blendedness.h:71
double nSigmaWeightMax
"Radius factor that sets the maximum extent of the weight function (and hence the " "flux measurement...
Definition: Blendedness.h:51
bool doShape
"Whether to compute quantities related to the Gaussian-weighted shape" ;
Definition: Blendedness.h:47
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:118
An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm ...
Definition: Algorithm.h:170
vector-type utility class to build a collection of FlagDefinitions
Definition: FlagHandler.h:60
bool doFlux
"Whether to compute quantities related to the Gaussian-weighted flux" ;
Definition: Blendedness.h:45
bool doOld
"Whether to compute HeavyFootprint dot products (the old deblend.blendedness parameter)" ; ...
Definition: Blendedness.h:43
Compute metrics that measure how blended objects are.
Definition: Blendedness.h:65