lsst.meas.extensions.psfex  13.0-5-gd2c5893
 All Classes Namespaces Files Functions Variables Friends Macros Groups
PsfexPsf.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 # if !defined(LSST_MEAS_EXTENSIONS_PSFEX_PSFEX_H)
25 #define LSST_MEAS_EXTENSIONS_PSFEX_PSFEX_H 1
26 
27 #include "lsst/meas/algorithms/ImagePsf.h"
28 #include "lsst/meas/extensions/psfex/psf.hh"
29 
30 namespace lsst { namespace meas { namespace extensions { namespace psfex {
31  namespace detail {
32  class PsfexPsfFactory;
33  }
34 
38 class PsfexPsf : public lsst::afw::table::io::PersistableFacade<PsfexPsf>,
39  public lsst::meas::algorithms::ImagePsf {
41 public:
45  explicit PsfexPsf(
46  lsst::meas::extensions::psfex::Psf const& psf,
47  lsst::afw::geom::Point2D const & averagePosition=lsst::afw::geom::Point2D()
49  );
50  virtual ~PsfexPsf();
51 
53  virtual PTR(lsst::afw::detection::Psf) clone() const;
54 
56  virtual PTR(afw::detection::Psf) resized(int width, int height) const;
57 
59  virtual lsst::afw::geom::Point2D getAveragePosition() const { return _averagePosition; }
60 
63  PTR(lsst::afw::math::LinearCombinationKernel const)
64  getKernel(lsst::afw::geom::Point2D =
65  lsst::afw::geom::Point2D(std::numeric_limits<double>::quiet_NaN())) const;
66 
68  virtual bool isPersistable() const { return true; }
69 
70  void write(lsst::afw::table::io::OutputArchiveHandle & handle) const;
71 private:
72  lsst::afw::geom::Point2D _averagePosition;
73  // Here are the unpacked fields from the psfex psf struct
74  struct poly *_poly; // Polynom describing the PSF variations
75  float _pixstep; // Mask oversampling (pixel)
76  std::vector<int> _size; // PSF dimensions
77  std::vector<float> _comp; // Complete pix. data (PSF components)
78  std::vector<std::pair<double, double> > _context; // Offset/scale to apply to context data
79  mutable PTR(lsst::afw::math::LinearCombinationKernel) _kernel; // keep a reference to getKernel()'s kernel
80 
82  explicit PsfexPsf();
83 
85  virtual PTR(lsst::afw::detection::Psf::Image) _doComputeImage(
86  lsst::afw::geom::Point2D const & position,
87  lsst::afw::image::Color const& color,
88  lsst::afw::geom::Point2D const& center
89  ) const;
90 
92  virtual PTR(lsst::afw::detection::Psf::Image) doComputeKernelImage(
93  lsst::afw::geom::Point2D const & position,
94  lsst::afw::image::Color const& color
95  ) const;
96 
98  virtual PTR(lsst::afw::detection::Psf::Image) doComputeImage(
99  lsst::afw::geom::Point2D const & position,
100  lsst::afw::image::Color const& color
101  ) const;
102 
104  virtual lsst::afw::geom::Box2I doComputeBBox(
105  lsst::afw::geom::Point2D const & position,
106  lsst::afw::image::Color const & color
107  ) const;
108 
112  lsst::afw::geom::Box2I _doComputeBBox(
113  lsst::afw::geom::Point2D const & position,
114  lsst::afw::geom::Point2D const & center
115  ) const;
116 
118  virtual std::string getPersistenceName() const;
120  virtual std::string getPythonModule() const;
121 };
122 
123 }}}}
124 
125 #endif // !LSST_MEAS_EXTENSIONS_PSFEX_PSFEX_H
virtual boost::shared_ptr< lsst::afw::detection::Psf > clone() const
Polymorphic deep copy; should usually be unnecessary as Psfs are immutable.x.
Definition: PsfexPsf.cc:90
virtual lsst::afw::geom::Point2D getAveragePosition() const
Return average position of stars; used as default position.
Definition: PsfexPsf.h:59
Represent a PSF as a linear combination of PSFEX (== Karhunen-Loeve) basis functions.
Definition: PsfexPsf.h:38
boost::shared_ptr< lsst::afw::math::LinearCombinationKernel const > getKernel(lsst::afw::geom::Point2D=lsst::afw::geom::Point2D(std::numeric_limits< double >::quiet_NaN())) const
Return the PSF&#39;s basis functions as a spatially-invariant LinearCombinationKernel with unit weights...
Definition: PsfexPsf.cc:100
void write(lsst::afw::table::io::OutputArchiveHandle &handle) const
Definition: PsfexPsf.cc:465
table::Key< table::Array< int > > _size
Definition: PsfexPsf.cc:350
table::Key< table::Array< float > > _comp
Definition: PsfexPsf.cc:351
virtual bool isPersistable() const
Is this object persistable?
Definition: PsfexPsf.h:68
table::Key< float > _pixstep
Definition: PsfexPsf.cc:320
table::PointKey< double > averagePosition
Definition: PsfexPsf.cc:319
virtual boost::shared_ptr< afw::detection::Psf > resized(int width, int height) const
Return a clone with specified kernel dimensions.
Definition: PsfexPsf.cc:95