lsst.meas.algorithms  16.0-7-ge62bbd2a+2
DoubleGaussianPsf.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_DoubleGaussianPsf_h_INCLUDED
25 #define LSST_MEAS_ALGORITHMS_DoubleGaussianPsf_h_INCLUDED
26 
28 
29 #include "boost/serialization/nvp.hpp"
30 #include "boost/serialization/void_cast.hpp"
31 
32 namespace lsst {
33 namespace meas {
34 namespace algorithms {
35 
37 class DoubleGaussianPsf : public afw::table::io::PersistableFacade<DoubleGaussianPsf>, public KernelPsf {
38 public:
48  DoubleGaussianPsf(int width, int height, double sigma1, double sigma2 = 0.0, double b = 0.0);
49 
51  virtual PTR(afw::detection::Psf) clone() const;
52 
54  virtual PTR(afw::detection::Psf) resized(int width, int height) const;
55 
57  double getSigma1() const { return _sigma1; }
58 
60  double getSigma2() const { return _sigma2; }
61 
63  double getB() const { return _b; }
64 
66  virtual bool isPersistable() const noexcept override { return true; }
67 
68 protected:
69  virtual std::string getPersistenceName() const;
70 
71  virtual void write(OutputArchiveHandle& handle) const;
72 
73 private:
74  double _sigma1;
75  double _sigma2;
76  double _b;
77 
79  template <class Archive>
80  void serialize(Archive&, unsigned int const) {
81  boost::serialization::void_cast_register<DoubleGaussianPsf, Psf>(static_cast<DoubleGaussianPsf*>(0),
82  static_cast<Psf*>(0));
83  }
84 };
85 
86 } // namespace algorithms
87 } // namespace meas
88 } // namespace lsst
89 
90 namespace boost {
91 namespace serialization {
92 
93 template <class Archive>
95  unsigned int const) {
96  int width = p->getKernel()->getWidth();
97  int height = p->getKernel()->getHeight();
98  double sigma1 = p->getSigma1();
99  double sigma2 = p->getSigma2();
100  double b = p->getB();
101  ar << make_nvp("width", width);
102  ar << make_nvp("height", height);
103  ar << make_nvp("sigma1", sigma1);
104  ar << make_nvp("sigma2", sigma2);
105  ar << make_nvp("b", b);
106 }
107 
108 template <class Archive>
110  unsigned int const) {
111  int width;
112  int height;
113  double sigma1;
114  double sigma2;
115  double b;
116  ar >> make_nvp("width", width);
117  ar >> make_nvp("height", height);
118  ar >> make_nvp("sigma1", sigma1);
119  ar >> make_nvp("sigma2", sigma2);
120  ar >> make_nvp("b", b);
121  ::new (p) lsst::meas::algorithms::DoubleGaussianPsf(width, height, sigma1, sigma2, b);
122 }
123 
124 } // namespace serialization
125 } // namespace boost
126 
127 #endif // !LSST_MEAS_ALGORITHMS_DoubleGaussianPsf_h_INCLUDED
A Psf defined by a Kernel.
Definition: KernelPsf.h:36
virtual void write(OutputArchiveHandle &handle) const
friend class boost::serialization::access
double getSigma1() const
Return the radius of the inner Gaussian.
#define PTR(...)
boost::shared_ptr< afw::math::Kernel const > getKernel() const
Return the Kernel used to define this Psf.
Definition: KernelPsf.h:52
DoubleGaussianPsf(int width, int height, double sigma1, double sigma2=0.0, double b=0.0)
Constructor for a DoubleGaussianPsf.
STL class.
Represent a Psf as a circularly symmetrical double Gaussian.
virtual std::string getPersistenceName() const
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.
double getSigma2() const
Return the radius of the outer Gaussian.
virtual bool isPersistable() const noexcept override
Whether this Psf is persistable (always true for DoubleGaussianPsf).
afw::table::Key< double > sigma1
double getB() const
Return the ratio of Gaussian peak amplitudes: outer/inner.
io::OutputArchiveHandle OutputArchiveHandle
afw::table::Key< double > b
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
afw::table::Key< double > sigma2
void save_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel const *k, unsigned int const file_version)