lsst.meas.modelfit  13.0-11-g2fa83af+16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Pages
PixelFitRegion.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2015-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_MODELFIT_PixelFitRegion_h_INCLUDED
25 #define LSST_MEAS_MODELFIT_PixelFitRegion_h_INCLUDED
26 
27 #include "lsst/pex/config.h"
29 #include "lsst/afw/image/Mask.h"
30 #include "lsst/afw/detection/Footprint.h"
31 #include "lsst/afw/geom/ellipses.h"
32 
33 namespace lsst { namespace meas { namespace modelfit {
34 
35 
37 
39  nKronRadii(1.5),
40  nPsfSigmaMin(4.0),
41  nPsfSigmaGrow(2.0),
42  nFitRadiiMin(1.0),
43  nFitRadiiMax(3.0),
44  maxArea(100000),
46  {
47  badMaskPlanes.push_back("EDGE");
48  badMaskPlanes.push_back("SAT");
49  badMaskPlanes.push_back("BAD");
50  badMaskPlanes.push_back("NO_DATA");
51  }
52 
53  LSST_CONTROL_FIELD(
54  nKronRadii, double,
55  "Use this multiple of the Kron ellipse to set the fit region (for the final fit region, "
56  "subject to the nFitRadiiMin and nFitRadiiMax constraints)."
57  );
58 
59  LSST_CONTROL_FIELD(
60  nPsfSigmaMin, double,
61  "If the Kron radius is less than this multiple of the PSF width, ignore it and fall back "
62  "to a PSF-oriented ellipse scaled to match the area of the footprint or this radius "
63  "(whichever is larger)."
64  );
65 
66  LSST_CONTROL_FIELD(
67  nPsfSigmaGrow, double,
68  "Grow the initial fit ellipses by this factor before comparing with the Kron/Footprint region"
69  );
70 
71  LSST_CONTROL_FIELD(
72  nFitRadiiMin, double,
73  "Use this multiple of the initial fit ellipse then grow by the PSF width "
74  "to determine the minimum final fit region size."
75  );
76 
77  LSST_CONTROL_FIELD(
78  nFitRadiiMax, double,
79  "Use this multiple of the initial fit ellipse then grow by the PSF width "
80  "to determine the maximum final fit region size."
81  );
82 
83  LSST_CONTROL_FIELD(
84  maxArea, int,
85  "Abort if the fit region grows beyond this many pixels."
86  );
87 
88  LSST_CONTROL_FIELD(
89  badMaskPlanes, std::vector<std::string>,
90  "Mask planes that indicate pixels that should be ignored in the fit."
91  );
92 
93  LSST_CONTROL_FIELD(
94  maxBadPixelFraction, double,
95  "Maximum fraction of pixels that may be ignored due to masks; "
96  "more than this and we don't even try."
97  );
98 
99 };
100 
101 
103 public:
104 
106  PixelFitRegionControl const & ctrl,
107  afw::geom::ellipses::Quadrupole const & moments,
108  afw::geom::ellipses::Quadrupole const & psfMoments,
109  Scalar kronRadius,
110  int footprintArea
111  );
112 
114  PixelFitRegionControl const & ctrl,
115  afw::geom::ellipses::Quadrupole const & ellipse
116  );
117 
118  bool applyEllipse(
119  afw::geom::ellipses::Quadrupole const & deconvolved,
120  afw::geom::ellipses::Quadrupole const & psfMoments
121  );
122 
123  void applyMask(afw::image::Mask<> const & mask, afw::geom::Point2D const & center);
124 
125  afw::geom::ellipses::Quadrupole ellipse;
126  PTR(afw::detection::Footprint) footprint;
129  bool maxArea;
133 
134 private:
135  PixelFitRegionControl _ctrl;
136  afw::image::MaskPixel _badPixelMask;
137 };
138 
139 
140 }}} // lsst::meas::modelfit
141 
142 #endif // !LSST_MEAS_MODELFIT_PixelFitRegion_h_INCLUDED
143 
double nKronRadii
&quot;Use this multiple of the Kron ellipse to set the fit region (for the final fit region, &quot; &quot;subject to the nFitRadiiMin and nFitRadiiMax constraints).&quot; ;
afw::geom::ellipses::Quadrupole ellipse
double Scalar
Typedefs to be used for probability and parameter values.
Definition: common.h:44
boost::shared_ptr< afw::detection::Footprint > footprint
PixelFitRegion(PixelFitRegionControl const &ctrl, afw::geom::ellipses::Quadrupole const &moments, afw::geom::ellipses::Quadrupole const &psfMoments, Scalar kronRadius, int footprintArea)
int maxArea
&quot;Abort if the fit region grows beyond this many pixels.&quot; ;
double maxBadPixelFraction
&quot;Maximum fraction of pixels that may be ignored due to masks; &quot; &quot;more than this and we don&#39;t even ...
double nFitRadiiMax
&quot;Use this multiple of the initial fit ellipse then grow by the PSF width &quot; &quot;to determine the maximum ...
std::vector< std::string > badMaskPlanes
&quot;Mask planes that indicate pixels that should be ignored in the fit.&quot; ;
double nPsfSigmaGrow
&quot;Grow the initial fit ellipses by this factor before comparing with the Kron/Footprint region&quot; ; ...
double nPsfSigmaMin
&quot;If the Kron radius is less than this multiple of the PSF width, ignore it and fall back &quot; &quot;to a PSF-...
double nFitRadiiMin
&quot;Use this multiple of the initial fit ellipse then grow by the PSF width &quot; &quot;to determine the minimum ...
void applyMask(afw::image::Mask<> const &mask, afw::geom::Point2D const &center)
bool applyEllipse(afw::geom::ellipses::Quadrupole const &deconvolved, afw::geom::ellipses::Quadrupole const &psfMoments)