lsst.meas.algorithms  15.0-13-g0ee414d5+2
PcaPsf.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_PcaPsf_h_INCLUDED
25 #define LSST_MEAS_ALGORITHMS_PcaPsf_h_INCLUDED
26 
27 #include "lsst/geom/Point.h"
29 
30 namespace lsst {
31 namespace meas {
32 namespace algorithms {
33 
37 class PcaPsf : public afw::table::io::PersistableFacade<PcaPsf>, public KernelPsf {
38 public:
47 
49  virtual PTR(afw::detection::Psf) clone() const;
50 
52  virtual PTR(afw::detection::Psf) resized(int width, int height) const;
53 
56 
57 private:
58  // Name used in table persistence; the rest of is implemented by KernelPsf.
59  virtual std::string getPersistenceName() const { return "PcaPsf"; }
60 
62 
63  template <class Archive>
64  void serialize(Archive&, unsigned int const) {
65  boost::serialization::void_cast_register<PcaPsf, afw::detection::Psf>(
66  static_cast<PcaPsf*>(0), static_cast<afw::detection::Psf*>(0));
67  }
68 };
69 
70 } // namespace algorithms
71 } // namespace meas
72 } // namespace lsst
73 
74 namespace boost {
75 namespace serialization {
76 
77 template <class Archive>
78 inline void save_construct_data(Archive& ar, lsst::meas::algorithms::PcaPsf const* p, unsigned int const) {
79  lsst::afw::math::LinearCombinationKernel const* kernel = p->getKernel().get();
80  ar << make_nvp("kernel", kernel);
82  ar << make_nvp("averagePositionX", averagePosition.getX());
83  ar << make_nvp("averagePositionY", averagePosition.getY());
84 }
85 
86 template <class Archive>
87 inline void load_construct_data(Archive& ar, lsst::meas::algorithms::PcaPsf* p, unsigned int const) {
89  ar >> make_nvp("kernel", kernel);
90  double x = 0.0, y = 0.0;
91  ar >> make_nvp("averagePositionX", x);
92  ar >> make_nvp("averagePositionY", y);
95 }
96 
97 } // namespace serialization
98 } // namespace boost
99 
100 #endif // !LSST_MEAS_ALGORITHMS_PcaPsf_h_INCLUDED
virtual boost::shared_ptr< afw::detection::Psf > resized(int width, int height) const
Return a clone with specified kernel dimensions.
A Psf defined by a Kernel.
Definition: KernelPsf.h:36
#define PTR(...)
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy; should usually be unnecessary as Psfs are immutable.x.
friend class boost::serialization::access
Definition: PcaPsf.h:61
Represent a PSF as a linear combination of PCA (== Karhunen-Loeve) basis functions.
Definition: PcaPsf.h:37
STL class.
virtual geom::Point2D getAveragePosition() const
Return average position of stars; used as default position.
Definition: KernelPsf.cc:36
afw::table::PointKey< double > averagePosition
Definition: CoaddPsf.cc:329
void load_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel *k, unsigned int const file_version)
double x
void save_construct_data(Archive &ar, lsst::afw::math::DeltaFunctionKernel const *k, unsigned int const file_version)
int y
PcaPsf(boost::shared_ptr< afw::math::LinearCombinationKernel > kernel, geom::Point2D const &averagePosition=geom::Point2D())
Constructor for a PcaPsf.
boost::shared_ptr< afw::math::LinearCombinationKernel const > getKernel() const
PcaPsf always has a LinearCombinationKernel, so we can override getKernel to make it more useful...