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
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 { namespace meas { namespace algorithms {
33 
37 class SingleGaussianPsf : public afw::table::io::PersistableFacade<SingleGaussianPsf>, public KernelPsf {
38 public:
39 
49  explicit SingleGaussianPsf(int width, int height, double sigma);
50 
52  virtual PTR(afw::detection::Psf) clone() const;
53 
55  double getSigma() const { return _sigma; }
56 
58  virtual bool isPersistable() const { return true; }
59 
60 protected:
61 
62  virtual std::string getPersistenceName() const;
63 
64  virtual void write(OutputArchiveHandle & handle) const;
65 
66 private:
67  double _sigma;
68 
69 private:
71  template <class Archive>
72  void serialize(Archive&, unsigned int const) {
73  boost::serialization::void_cast_register<SingleGaussianPsf, lsst::afw::detection::Psf>(
74  static_cast<SingleGaussianPsf*>(0), static_cast<lsst::afw::detection::Psf*>(0));
75  }
76 };
77 
78 }}} // namespace lsst::meas::algorithms
79 
80 namespace boost { namespace serialization {
81 
82 template <class Archive>
83 inline void save_construct_data(
84  Archive& ar, lsst::meas::algorithms::SingleGaussianPsf const* p,
85  unsigned int const) {
86  int width = p->getKernel()->getWidth();
87  int height = p->getKernel()->getHeight();
88  double sigma = p->getSigma();
89  ar << make_nvp("width", width);
90  ar << make_nvp("height", height);
91  ar << make_nvp("sigma", sigma);
92 }
93 
94 template <class Archive>
95 inline void load_construct_data(
97  unsigned int const) {
98  int width;
99  int height;
100  double sigma;
101  ar >> make_nvp("width", width);
102  ar >> make_nvp("height", height);
103  ar >> make_nvp("sigma", sigma);
104  ::new(p) lsst::meas::algorithms::SingleGaussianPsf(width, height, sigma);
105 }
106 
107 }} // namespace boost::serialization
108 
109 #endif // !LSST_MEAS_ALGORITHMS_SingleGaussianPsf_h_INCLUDED
double getSigma() const
Return the radius of the Gaussian.
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 )
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy; should usually unnecessary because Psfs are immutable.
friend class boost::serialization::access
io::OutputArchiveHandle OutputArchiveHandle
Definition: Persistable.h:114
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
void serialize(Archive &, unsigned int const)
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:43
Represent a PSF as a circularly symmetrical double Gaussian.
SingleGaussianPsf(int width, int height, double sigma)
Constructor for a SingleGaussianPsf.
boost::shared_ptr< afw::math::Kernel const > getKernel() const
Return the Kernel used to define this Psf.
Definition: KernelPsf.h:52
virtual bool isPersistable() const
Whether the Psf is persistable; always true.
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
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