lsst.meas.algorithms  14.0-18-gf7dca964+5
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 { namespace meas { namespace algorithms {
33 
35 class DoubleGaussianPsf : public afw::table::io::PersistableFacade<DoubleGaussianPsf>, public KernelPsf {
36 public:
37 
47  DoubleGaussianPsf(int width, int height, double sigma1, double sigma2=0.0, double b=0.0);
48 
50  virtual PTR(afw::detection::Psf) clone() const;
51 
53  virtual PTR(afw::detection::Psf) resized(int width, int height) const;
54 
56  double getSigma1() const { return _sigma1; }
57 
59  double getSigma2() const { return _sigma2; }
60 
62  double getB() const { return _b; }
63 
65  virtual bool isPersistable() const { return true; }
66 
67 protected:
68 
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>(
82  static_cast<DoubleGaussianPsf*>(0), static_cast<Psf*>(0)
83  );
84  }
85 };
86 
87 }}} // namespace lsst::meas::algorithms
88 
89 namespace boost { namespace serialization {
90 
91 template <class Archive>
92 inline void save_construct_data(
93  Archive& ar, lsst::meas::algorithms::DoubleGaussianPsf const* p,
94  unsigned int const
95 ) {
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>
111  unsigned int const
112 ) {
113  int width;
114  int height;
115  double sigma1;
116  double sigma2;
117  double b;
118  ar >> make_nvp("width", width);
119  ar >> make_nvp("height", height);
120  ar >> make_nvp("sigma1", sigma1);
121  ar >> make_nvp("sigma2", sigma2);
122  ar >> make_nvp("b", b);
123  ::new(p) lsst::meas::algorithms::DoubleGaussianPsf(width, height, sigma1, sigma2, b);
124 }
125 
126 }} // namespace boost::serialization
127 
128 #endif // !LSST_MEAS_ALGORITHMS_DoubleGaussianPsf_h_INCLUDED
A Psf defined by a Kernel.
Definition: KernelPsf.h:33
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.
virtual bool isPersistable() const
Whether this Psf is persistable (always true for 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.
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)