lsst.meas.algorithms  16.0-7-ge62bbd2a
SingleGaussianPsf.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_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
25 #define LSST_MEAS_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
26 
27 #include "lsst/base.h"
29 #include "boost/serialization/nvp.hpp"
30 #include "boost/serialization/void_cast.hpp"
31 
32 namespace lsst {
33 namespace meas {
34 namespace algorithms {
35 
39 class SingleGaussianPsf : public afw::table::io::PersistableFacade<SingleGaussianPsf>, public KernelPsf {
40 public:
50  explicit SingleGaussianPsf(int width, int height, double sigma);
51 
53  virtual PTR(afw::detection::Psf) clone() const;
54 
56  virtual PTR(afw::detection::Psf) resized(int width, int height) const;
57 
59  double getSigma() const { return _sigma; }
60 
62  virtual bool isPersistable() const noexcept override { return true; }
63 
64 protected:
65  virtual std::string getPersistenceName() const;
66 
67  virtual void write(OutputArchiveHandle& handle) const;
68 
69 private:
70  double _sigma;
71 
72 private:
74  template <class Archive>
75  void serialize(Archive&, unsigned int const) {
76  boost::serialization::void_cast_register<SingleGaussianPsf, afw::detection::Psf>(
77  static_cast<SingleGaussianPsf*>(0), static_cast<afw::detection::Psf*>(0));
78  }
79 };
80 
81 } // namespace algorithms
82 } // namespace meas
83 } // namespace lsst
84 
85 namespace boost {
86 namespace serialization {
87 
88 template <class Archive>
90  unsigned int const) {
91  int width = p->getKernel()->getWidth();
92  int height = p->getKernel()->getHeight();
93  double sigma = p->getSigma();
94  ar << make_nvp("width", width);
95  ar << make_nvp("height", height);
96  ar << make_nvp("sigma", sigma);
97 }
98 
99 template <class Archive>
101  unsigned int const) {
102  int width;
103  int height;
104  double sigma;
105  ar >> make_nvp("width", width);
106  ar >> make_nvp("height", height);
107  ar >> make_nvp("sigma", sigma);
108  ::new (p) lsst::meas::algorithms::SingleGaussianPsf(width, height, sigma);
109 }
110 
111 } // namespace serialization
112 } // namespace boost
113 
114 #endif // !LSST_MEAS_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
virtual void write(OutputArchiveHandle &handle) const
virtual bool isPersistable() const noexcept override
Whether the Psf is persistable; always true.
A Psf defined by a Kernel.
Definition: KernelPsf.h:36
friend class boost::serialization::access
#define PTR(...)
boost::shared_ptr< afw::math::Kernel const > getKernel() const
Return the Kernel used to define this Psf.
Definition: KernelPsf.h:52
virtual std::string getPersistenceName() const
afw::table::Key< double > sigma
STL class.
double getSigma() const
Return the radius of the Gaussian.
Represent a PSF as a circularly symmetrical Gaussian.
SingleGaussianPsf(int width, int height, double sigma)
Constructor for a SingleGaussianPsf.
void load_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel *k, unsigned int const file_version)
virtual boost::shared_ptr< afw::detection::Psf > resized(int width, int height) const
Return a clone with specified kernel dimensions.
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy; should usually unnecessary because Psfs are immutable.
io::OutputArchiveHandle OutputArchiveHandle
void save_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel const *k, unsigned int const file_version)