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
Psf.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 #ifndef LSST_AFW_DETECTION_Psf_h_INCLUDED
24 #define LSST_AFW_DETECTION_Psf_h_INCLUDED
25 
26 #include <string>
27 #include <limits>
28 
29 #include "boost/shared_ptr.hpp"
30 
31 #include "lsst/daf/base.h"
33 #include "lsst/afw/math/Kernel.h"
34 #include "lsst/afw/image/Color.h"
36 
37 namespace lsst { namespace afw { namespace detection {
38 
39 class PsfFormatter;
40 
70 {
72  return geom::Point2D(std::numeric_limits<double>::quiet_NaN());
73  }
74 public:
75  typedef boost::shared_ptr<Psf> Ptr;
76  typedef boost::shared_ptr<const Psf> ConstPtr;
77 
80 
83  COPY=0,
88  };
89 
90  virtual ~Psf() {}
91 
99  virtual PTR(Psf) clone() const = 0;
100 
122  geom::Point2D position=makeNullPoint(),
123  image::Color color=image::Color(),
124  ImageOwnerEnum owner=COPY
125  ) const;
126 
150  geom::Point2D position=makeNullPoint(),
151  image::Color color=image::Color(),
152  ImageOwnerEnum owner=COPY
153  ) const;
154 
166  double computePeak(
167  geom::Point2D position=makeNullPoint(),
168  image::Color color=image::Color()
169  ) const;
170 
182  double computeApertureFlux(
183  double radius,
184  geom::Point2D position=makeNullPoint(),
185  image::Color color=image::Color()
186  ) const;
187 
198  geom::ellipses::Quadrupole computeShape(
199  geom::Point2D position=makeNullPoint(),
200  image::Color color=image::Color()
201  ) const;
202 
209  PTR(math::Kernel const) getLocalKernel(
210  geom::Point2D position=makeNullPoint(),
211  image::Color color=image::Color()
212  ) const;
213 
219  image::Color getAverageColor() const { return image::Color(); }
220 
226  virtual geom::Point2D getAveragePosition() const;
227 
246  static PTR(Image) recenterKernelImage(
247  PTR(Image) im,
248  geom::Point2D const & position,
249  std::string const & warpAlgorithm = "lanczos5",
250  unsigned int warpBuffer = 5
251  );
252 
253 protected:
254 
261  explicit Psf(bool isFixed=false);
262 
263 private:
264 
266 
273  virtual PTR(Image) doComputeImage(
274  geom::Point2D const & position, image::Color const& color
275  ) const;
276  virtual PTR(Image) doComputeKernelImage(
277  geom::Point2D const & position, image::Color const & color
278  ) const = 0;
279  virtual double doComputeApertureFlux(
280  double radius, geom::Point2D const & position, image::Color const & color
281  ) const = 0;
282  virtual geom::ellipses::Quadrupole doComputeShape(
283  geom::Point2D const & position, image::Color const & color
284  ) const = 0;
286 
287  bool const _isFixed;
290  mutable image::Color _cachedImageColor;
294 
296 };
297 
298 }}} // namespace lsst::afw::detection
299 
300 #endif // !LSST_AFW_DETECTION_Psf_h_INCLUDED
virtual geom::ellipses::Quadrupole doComputeShape(geom::Point2D const &position, image::Color const &color) const =0
boost::shared_ptr< Image > computeKernelImage(geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form suitable for convolution.
image::Color _cachedKernelImageColor
Definition: Psf.h:291
Declare the Kernel class and subclasses.
geom::Point2D _cachedKernelImagePosition
Definition: Psf.h:293
image::Color getAverageColor() const
Return the average Color of the stars used to construct the Psf.
Definition: Psf.h:219
virtual boost::shared_ptr< Image > doComputeImage(geom::Point2D const &position, image::Color const &color) const
boost::shared_ptr< Image > computeImage(geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form that can be compared directly with star images.
#define PTR(...)
Definition: base.h:41
Point< double, 2 > Point2D
Definition: Point.h:286
ImageOwnerEnum
Enum passed to computeImage and computeKernelImage to determine image ownership.
Definition: Psf.h:82
virtual boost::shared_ptr< Image > doComputeKernelImage(geom::Point2D const &position, image::Color const &color) const =0
boost::shared_ptr< Image > _cachedImage
Definition: Psf.h:288
virtual double doComputeApertureFlux(double radius, geom::Point2D const &position, image::Color const &color) const =0
Definitions and inlines for Quadrupole.
table::Key< table::Array< Kernel::Pixel > > image
Definition: FixedKernel.cc:117
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
math::Kernel::Pixel Pixel
Pixel type of Image returned by computeImage.
Definition: Psf.h:78
boost::shared_ptr< Psf > Ptr
Definition: Psf.h:75
#define LSST_PERSIST_FORMATTER(formatter...)
Definition: Persistable.h:98
virtual ~Psf()
Definition: Psf.h:90
boost::shared_ptr< Image > _cachedKernelImage
Definition: Psf.h:289
Formatter for persistence of Psf instances.
Definition: PsfFormatter.h:30
static geom::Point2D makeNullPoint()
Definition: Psf.h:71
virtual geom::Point2D getAveragePosition() const
Return the average position of the stars used to construct the Psf.
double computePeak(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return the peak value of the PSF image.
boost::shared_ptr< math::Kernel const > getLocalKernel(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Return a FixedKernel corresponding to the Psf image at the given point.
geom::ellipses::Quadrupole computeShape(geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Compute the ellipse corresponding to the second moments of the Psf.
Capture the colour of an object.
geom::Point2D _cachedImagePosition
Definition: Psf.h:292
Base class for all persistable classes.
Definition: Persistable.h:74
static boost::shared_ptr< Image > recenterKernelImage(boost::shared_ptr< Image > im, geom::Point2D const &position, std::string const &warpAlgorithm="lanczos5", unsigned int warpBuffer=5)
bool const _isFixed
Definition: Psf.h:287
double computeApertureFlux(double radius, geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const
Compute the &quot;flux&quot; of the Psf model within a circular aperture of the given radius.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
A polymorphic base class for representing an image&#39;s Point Spread Function.
Definition: Psf.h:68
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:182
image::Color _cachedImageColor
Definition: Psf.h:290
image::Image< Pixel > Image
Image type returned by computeImage.
Definition: Psf.h:79
virtual boost::shared_ptr< Psf > clone() const =0
Polymorphic deep-copy.
The image will be copied before returning; caller will own it.
Definition: Psf.h:83
boost::shared_ptr< const Psf > ConstPtr
Definition: Psf.h:76