LSSTApplications  11.0-13-gbb96280,12.1.rc1,12.1.rc1+1,12.1.rc1+2,12.1.rc1+5,12.1.rc1+8,12.1.rc1-1-g06d7636+1,12.1.rc1-1-g253890b+5,12.1.rc1-1-g3d31b68+7,12.1.rc1-1-g3db6b75+1,12.1.rc1-1-g5c1385a+3,12.1.rc1-1-g83b2247,12.1.rc1-1-g90cb4cf+6,12.1.rc1-1-g91da24b+3,12.1.rc1-2-g3521f8a,12.1.rc1-2-g39433dd+4,12.1.rc1-2-g486411b+2,12.1.rc1-2-g4c2be76,12.1.rc1-2-gc9c0491,12.1.rc1-2-gda2cd4f+6,12.1.rc1-3-g3391c73+2,12.1.rc1-3-g8c1bd6c+1,12.1.rc1-3-gcf4b6cb+2,12.1.rc1-4-g057223e+1,12.1.rc1-4-g19ed13b+2,12.1.rc1-4-g30492a7
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;
57  std::vector<double> params;
58  int iter;
59  double flamd;
60  double chnew;
61 };
62 
70 public:
77  "Do check that the centroid is contained in footprint.");
79  "If set > 0, Centroid Check also checks distance from footprint peak.");
81 };
82 
87 public:
88 
94  enum {
98  };
99 
103 
104  GaussianCentroidAlgorithm(Control const & ctrl, std::string const & name, afw::table::Schema & schema);
105 
109  template<typename PixelT>
112  double x0,
113  double y0
114  );
115 
116  virtual void measure(
117  afw::table::SourceRecord & measRecord,
118  afw::image::Exposure<float> const & exposure
119  ) const;
120 
121  virtual void fail(
122  afw::table::SourceRecord & measRecord,
123  MeasurementError * error=NULL
124  ) const;
125 
126 private:
127 
133 };
134 
136 public:
138 
139  GaussianCentroidTransform(Control const & ctrl, std::string const & name, afw::table::SchemaMapper & mapper);
140 };
141 
142 }}} // namespace lsst::meas::base
143 
144 #endif // !LSST_MEAS_BASE_GaussianCentroid_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:44
A coordinate class intended to represent absolute positions.
table::Key< std::string > name
Definition: ApCorrMap.cc:71
afw::table::Schema schema
Definition: GaussianPsf.cc:41
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:19
FittedModel(int status_, std::vector< double > params_, int iter_=0, double flamd_=0, double chnew_=0)
bool doFootprintCheck
Default constructor.
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
#define LSST_CONTROL_FIELD(NAME, TYPE, DOC)
Definition: config.h:36
A class that calculates a centroid by fitting a circular Gaussian to the image.
int const x0
Definition: saturated.cc:45
double maxDistToPeak
&quot;If set &gt; 0, Centroid Check also checks distance from footprint peak.&quot; ;
def error
Definition: log.py:103
std::vector< double > params
A C++ control class to handle GaussianCentroidAlgorithm&#39;s configuration.
static afw::geom::Point2D fitCentroid(afw::image::Image< PixelT > const &im, double x0, double y0)
x0, y0 is an initial guess for position, column
A FunctorKey for CentroidResult.
Record class that contains measurements made on a single exposure.
Definition: Source.h:80
int const y0
Definition: saturated.cc:45
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=NULL) const
GaussianCentroidTransform(Control const &ctrl, std::string const &name, afw::table::SchemaMapper &mapper)
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
GaussianCentroidAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)