lsst.meas.algorithms  13.0-13-gf5c99ad+4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoaddPsf.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_ALGORITHMS_COADDPSF_H)
25 #define LSST_MEAS_ALGORITHMS_COADDPSF_H
26 
27 #include <memory>
28 #include "lsst/base.h"
30 #include "lsst/afw/image/Wcs.h"
31 #include "lsst/afw/table/Exposure.h"
32 #include "lsst/afw/table/types.h"
33 #include "lsst/afw/geom/Box.h"
34 #include "lsst/afw/geom/polygon/Polygon.h"
35 #include "lsst/afw/math/warpExposure.h"
36 
37 namespace lsst { namespace meas { namespace algorithms {
38 
45 class CoaddPsf : public afw::table::io::PersistableFacade<CoaddPsf>, public ImagePsf {
46 public:
47 
63  explicit CoaddPsf(
64  afw::table::ExposureCatalog const & catalog,
65  afw::image::Wcs const & coaddWcs,
66  std::string const & weightFieldName = "weight",
67  std::string const & warpingKernelName="lanczos3",
68  int cacheSize=10000
69  );
70 
72  virtual PTR(afw::detection::Psf) clone() const;
73 
80  virtual afw::geom::Point2D getAveragePosition() const { return _averagePosition; }
81 
83  PTR(afw::image::Wcs const) getCoaddWcs() { return _coaddWcs; }
84 
86  int getComponentCount() const;
87 
95  CONST_PTR(afw::detection::Psf) getPsf(int index);
96 
104  CONST_PTR(afw::image::Wcs) getWcs(int index);
105 
113  double getWeight(int index);
114 
122  afw::table::RecordId getId(int index);
123 
131  afw::geom::Box2I getBBox(int index);
132 
140  CONST_PTR(afw::geom::polygon::Polygon) getValidPolygon(int index);
141 
151  virtual bool isPersistable() const { return true; }
152 
153  // Factory used to read CoaddPsf from an InputArchive; defined only in the source file.
154  class Factory;
155 
156 protected:
157 
158  PTR(afw::detection::Psf::Image) doComputeKernelImage(
159  afw::geom::Point2D const & ccdXY,
160  afw::image::Color const & color
161  ) const;
162 
163  virtual afw::geom::Box2I doComputeBBox(
164  afw::geom::Point2D const & position,
165  afw::image::Color const & color
166  ) const;
167 
168  // See afw::table::io::Persistable::getPersistenceName
169  virtual std::string getPersistenceName() const;
170 
171  // See afw::table::io::Persistable::getPythonModule
172  virtual std::string getPythonModule() const;
173 
174  // See afw::table::io::Persistable::write
175  virtual void write(OutputArchiveHandle & handle) const;
176 
177  // Used by persistence only
178  explicit CoaddPsf(
179  afw::table::ExposureCatalog const & catalog,
180  PTR(afw::image::Wcs const) coaddWcs,
181  afw::geom::Point2D const & averagePosition,
182  std::string const & warpingKernelName="lanczos3",
183  int cacheSize=10000
184  );
185 
186 private:
187 
188  afw::table::ExposureCatalog _catalog;
189  CONST_PTR(afw::image::Wcs) _coaddWcs;
190  afw::table::Key<double> _weightKey;
191  afw::geom::Point2D _averagePosition;
192  std::string _warpingKernelName; // could be removed if we could get this from _warpingControl (#2949)
193  CONST_PTR(afw::math::WarpingControl) _warpingControl;
194 };
195 
196 }}} // namespace lsst::meas::algorithms
197 
198 #endif
virtual bool isPersistable() const
Return true if the CoaddPsf persistable (always true).
Definition: CoaddPsf.h:151
afw::geom::Box2I getBBox(int index)
Get the bounding box (in component image Pixel coordinates) of the component image at index...
Definition: CoaddPsf.cc:329
double getWeight(int index)
Get the weight of the component image at index.
Definition: CoaddPsf.cc:315
boost::shared_ptr< afw::image::Wcs const > getWcs(int index)
Get the Wcs of the component image at index.
Definition: CoaddPsf.cc:301
CoaddPsf(afw::table::ExposureCatalog const &catalog, afw::image::Wcs const &coaddWcs, std::string const &weightFieldName="weight", std::string const &warpingKernelName="lanczos3", int cacheSize=10000)
Main constructors for CoaddPsf.
Definition: CoaddPsf.cc:142
boost::shared_ptr< afw::detection::Psf::Image > doComputeKernelImage(afw::geom::Point2D const &ccdXY, afw::image::Color const &color) const
Definition: CoaddPsf.cc:248
tbl::Key< int > cacheSize
Definition: CoaddPsf.cc:351
boost::shared_ptr< afw::image::Wcs const > getCoaddWcs()
Return the Wcs of the coadd (defines the coordinate system of the Psf).
Definition: CoaddPsf.h:83
afw::table::RecordId getId(int index)
Get the exposure ID of the component image at index.
Definition: CoaddPsf.cc:322
virtual std::string getPersistenceName() const
Definition: CoaddPsf.cc:437
CoaddPsf is the Psf derived to be used for non-PSF-matched Coadd images.
Definition: CoaddPsf.h:45
int getComponentCount() const
Return the number of component Psfs in this CoaddPsf.
Definition: CoaddPsf.cc:290
tbl::Key< std::string > warpingKernelName
Definition: CoaddPsf.cc:353
virtual afw::geom::Box2I doComputeBBox(afw::geom::Point2D const &position, afw::image::Color const &color) const
Definition: CoaddPsf.cc:224
An intermediate base class for Psfs that use an image representation.
Definition: ImagePsf.h:37
virtual void write(OutputArchiveHandle &handle) const
Definition: CoaddPsf.cc:441
tbl::PointKey< double > averagePosition
Definition: CoaddPsf.cc:352
virtual std::string getPythonModule() const
Definition: CoaddPsf.cc:439
virtual afw::geom::Point2D getAveragePosition() const
Return the average of the positions of the stars that went into this Psf.
Definition: CoaddPsf.h:80
boost::shared_ptr< afw::detection::Psf const > getPsf(int index)
Get the Psf of the component image at index.
Definition: CoaddPsf.cc:294
boost::shared_ptr< afw::geom::polygon::Polygon const > getValidPolygon(int index)
Get the validPolygon (in component image Pixel coordinates) of the component image at index...
Definition: CoaddPsf.cc:308
tbl::Key< int > coaddWcs
virtual boost::shared_ptr< afw::detection::Psf > clone() const
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
Definition: CoaddPsf.cc:176