LSSTApplications  11.0-22-g33de520,13.0+148,14.0+46,14.0+49,14.0-1-g013352c+30,14.0-1-g13ef843+9,14.0-1-g4b114ac+12,14.0-1-g7257b6a+10,14.0-1-g8b7e855+45,14.0-10-g59393990+4,14.0-13-g7a60b79,14.0-14-g87d16e8+8,14.0-16-g7a4f44b+1,14.0-2-g319577b+9,14.0-2-g8373656+25,14.0-2-ga5af9b6+8,14.0-21-g4f575af+3,14.0-42-g1a25f2ae,14.0-42-g99f9a3040,14.0-5-g744ff5f,14.0-5-g86eb1bd+25,14.0-6-g095d685+2,14.0-6-gd5b81a9,14.0-6-ge2c9487+36,14.0-8-g1f982c9,14.0-8-g7f6dd6b+6,14.0-8-gc7d89b4+3
LSSTDataManagementBasePackage
GaussianCentroid.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2013 LSST Corporation.
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_GaussianCentroid_h_INCLUDED
25 #define LSST_MEAS_BASE_GaussianCentroid_h_INCLUDED
26 
27 #include "lsst/afw/geom/Point.h"
28 #include "lsst/pex/config.h"
33 
34 namespace lsst { namespace meas { namespace base {
35 
36 struct FittedModel {
37  enum { PEAK = 0, SKY, X0, Y0, SIGMA, NPARAM };
38 
39  enum {
40  BAD_GUESS = -11,
41  TOO_FEW = -12,
42  CHI_SQUARED = -13,
43  RANGE = -14,
44  BAD_WIDTH = -15,
45  LOST = -16,
46  DIAGONAL = -17,
47  BAD_A = -18,
48  CONVERGE = 1,
49  ITERATE = 2,
50  ALMOST = 3,
51  POOR = 4
52  };
53 
54  FittedModel(int status_, std::vector<double> params_, int iter_=0, double flamd_=0, double chnew_=0) :
55  status(status_), params(params_), iter(iter_), flamd(flamd_), chnew(chnew_) { }
56  int status;
58  int iter;
59  double flamd;
60  double chnew;
61 };
62 
70 public:
76  LSST_CONTROL_FIELD(doFootprintCheck, bool,
77  "Do check that the centroid is contained in footprint.");
78  LSST_CONTROL_FIELD(maxDistToPeak, double,
79  "If set > 0, Centroid Check also checks distance from footprint peak.");
80  GaussianCentroidControl() : doFootprintCheck(true), maxDistToPeak(-1.0) {}
81 };
82 
87 public:
88 
89  // Structures and routines to manage flaghandler
90  static FlagDefinitionList const & getFlagDefinitions();
91  static FlagDefinition const FAILURE;
92  static FlagDefinition const NO_PEAK;
93 
97 
98  GaussianCentroidAlgorithm(Control const & ctrl, std::string const & name, afw::table::Schema & schema);
99 
103  template<typename PixelT>
105  static afw::geom::Point2D fitCentroid(afw::image::Image<PixelT> const& im,
106  double x0,
107  double y0
108  );
109 
110  virtual void measure(
111  afw::table::SourceRecord & measRecord,
112  afw::image::Exposure<float> const & exposure
113  ) const;
114 
115  virtual void fail(
116  afw::table::SourceRecord & measRecord,
117  MeasurementError * error=nullptr
118  ) const;
119 
120 private:
121 
122  Control _ctrl;
127 };
128 
130 public:
132 
133  GaussianCentroidTransform(Control const & ctrl, std::string const & name, afw::table::SchemaMapper & mapper);
134 };
135 
136 }}} // namespace lsst::meas::base
137 
138 #endif // !LSST_MEAS_BASE_GaussianCentroid_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:47
table::Key< std::string > name
Definition: ApCorrMap.cc:71
afw::table::Schema schema
Definition: GaussianPsf.cc:43
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
Definition: FlagHandler.h:38
Utility class for measurement algorithms that extracts a position from the Centroid slot and handles ...
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
A preprocessor macro used to define fields in C++ "control object" structs.
Definition: config.h:36
A class that calculates a centroid by fitting a circular Gaussian to the image.
STL class.
Utility class for handling flag fields that indicate the failure modes of an algorithm.
Definition: FlagHandler.h:156
A base class for image defects.
Definition: cameraGeom.dox:3
std::vector< double > params
A C++ control class to handle GaussianCentroidAlgorithm&#39;s configuration.
FittedModel(int status_, std::vector< double > params_, int iter_=0, double flamd_=0, double chnew_=0)
GaussianCentroidControl Control
A typedef to the Control object for this algorithm, defined above.
An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm ...
Definition: Algorithm.h:184
A FunctorKey for CentroidResult.
def measure(mi, x, y, size, statistic, stats)
Definition: fringe.py:359
Record class that contains measurements made on a single exposure.
Definition: Source.h:80
vector-type utility class to build a collection of FlagDefinitions
Definition: FlagHandler.h:63
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:69
Base for centroid measurement transformations.