LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
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  double getSigma1() const { return _sigma1; }
54 
56  double getSigma2() const { return _sigma2; }
57 
59  double getB() const { return _b; }
60 
62  virtual bool isPersistable() const { return true; }
63 
64 protected:
65 
66  virtual std::string getPersistenceName() const;
67 
68  virtual void write(OutputArchiveHandle & handle) const;
69 
70 private:
71  double _sigma1;
72  double _sigma2;
73  double _b;
74 
76  template <class Archive>
77  void serialize(Archive&, unsigned int const) {
78  boost::serialization::void_cast_register<DoubleGaussianPsf, Psf>(
79  static_cast<DoubleGaussianPsf*>(0), static_cast<Psf*>(0)
80  );
81  }
82 };
83 
84 }}} // namespace lsst::meas::algorithms
85 
86 namespace boost { namespace serialization {
87 
88 template <class Archive>
89 inline void save_construct_data(
90  Archive& ar, lsst::meas::algorithms::DoubleGaussianPsf const* p,
91  unsigned int const
92 ) {
93  int width = p->getKernel()->getWidth();
94  int height = p->getKernel()->getHeight();
95  double sigma1 = p->getSigma1();
96  double sigma2 = p->getSigma2();
97  double b = p->getB();
98  ar << make_nvp("width", width);
99  ar << make_nvp("height", height);
100  ar << make_nvp("sigma1", sigma1);
101  ar << make_nvp("sigma2", sigma2);
102  ar << make_nvp("b", b);
103 }
104 
105 template <class Archive>
108  unsigned int const
109 ) {
110  int width;
111  int height;
112  double sigma1;
113  double sigma2;
114  double b;
115  ar >> make_nvp("width", width);
116  ar >> make_nvp("height", height);
117  ar >> make_nvp("sigma1", sigma1);
118  ar >> make_nvp("sigma2", sigma2);
119  ar >> make_nvp("b", b);
120  ::new(p) lsst::meas::algorithms::DoubleGaussianPsf(width, height, sigma1, sigma2, b);
121 }
122 
123 }} // namespace boost::serialization
124 
125 #endif // !LSST_MEAS_ALGORITHMS_DoubleGaussianPsf_h_INCLUDED
void load_construct_data(Archive &ar, lsst::meas::algorithms::DoubleGaussianPsf *p, unsigned int const )
#define PTR(...)
Definition: base.h:41
A Psf defined by a Kernel.
Definition: KernelPsf.h:33
void save_construct_data(Archive &ar, lsst::meas::algorithms::DoubleGaussianPsf const *p, unsigned int const )
double getSigma2() const
Return the radius of the outer Gaussian.
friend class boost::serialization::access
void serialize(Archive &, unsigned int const)
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:114
DoubleGaussianPsf(int width, int height, double sigma1, double sigma2=0.0, double b=0.0)
Represent a Psf as a circularly symmetrical double Gaussian.
boost::shared_ptr< afw::math::Kernel const > getKernel() const
Return the Kernel used to define this Psf.
Definition: KernelPsf.h:52
double getB() const
Return the ratio of Gaussian peak amplitudes: outer/inner.
afw::table::Key< double > sigma1
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
afw::table::Key< double > b
virtual bool isPersistable() const
Whether this Psf is persistable (always true for DoubleGaussianPsf).
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
double getSigma1() const
Return the radius of the inner Gaussian.
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
afw::table::Key< double > sigma2
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.