LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
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 };
78 
83 public:
84 
90  enum {
94  };
95 
99 
100  GaussianCentroidAlgorithm(Control const & ctrl, std::string const & name, afw::table::Schema & schema);
101 
105  template<typename PixelT>
108  double x0,
109  double y0
110  );
111 
112  virtual void measure(
113  afw::table::SourceRecord & measRecord,
114  afw::image::Exposure<float> const & exposure
115  ) const;
116 
117  virtual void fail(
118  afw::table::SourceRecord & measRecord,
119  MeasurementError * error=NULL
120  ) const;
121 
122 private:
123 
128 };
129 
131 public:
133 
134  GaussianCentroidTransform(Control const & ctrl, std::string const & name, afw::table::SchemaMapper & mapper);
135 };
136 
137 }}} // namespace lsst::meas::base
138 
139 #endif // !LSST_MEAS_BASE_GaussianCentroid_h_INCLUDED
Defines the fields and offsets for a table.
Definition: Schema.h:46
GaussianCentroidAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
A coordinate class intended to represent absolute positions.
table::Key< std::string > name
Definition: ApCorrMap.cc:71
virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error=NULL) const
GaussianCentroidControl()
Default constructor.
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
static afw::geom::Point2D fitCentroid(afw::image::Image< PixelT > const &im, double x0, double y0)
x0, y0 is an initial guess for position, column
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Definition: exceptions.h:48
A class that calculates a centroid by fitting a circular Gaussian to the image.
int const x0
Definition: saturated.cc:45
def error
Definition: log.py:108
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)
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
GaussianCentroidTransform(Control const &ctrl, std::string const &name, afw::table::SchemaMapper &mapper)
A FunctorKey for CentroidResult.
Record class that contains measurements made on a single exposure.
Definition: Source.h:81
int const y0
Definition: saturated.cc:45
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:415