lsst.meas.algorithms  13.0-16-g6e7f056
 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 
75  virtual PTR(afw::detection::Psf) resized(int width, int height) const;
82  virtual afw::geom::Point2D getAveragePosition() const { return _averagePosition; }
83 
85  PTR(afw::image::Wcs const) getCoaddWcs() { return _coaddWcs; }
86 
88  int getComponentCount() const;
89 
97  CONST_PTR(afw::detection::Psf) getPsf(int index);
98 
106  CONST_PTR(afw::image::Wcs) getWcs(int index);
107 
115  double getWeight(int index);
116 
124  afw::table::RecordId getId(int index);
125 
133  afw::geom::Box2I getBBox(int index);
134 
142  CONST_PTR(afw::geom::polygon::Polygon) getValidPolygon(int index);
143 
153  virtual bool isPersistable() const { return true; }
154 
155  // Factory used to read CoaddPsf from an InputArchive; defined only in the source file.
156  class Factory;
157 
158 protected:
159 
160  PTR(afw::detection::Psf::Image) doComputeKernelImage(
161  afw::geom::Point2D const & ccdXY,
162  afw::image::Color const & color
163  ) const;
164 
165  virtual afw::geom::Box2I doComputeBBox(
166  afw::geom::Point2D const & position,
167  afw::image::Color const & color
168  ) const;
169 
170  // See afw::table::io::Persistable::getPersistenceName
171  virtual std::string getPersistenceName() const;
172 
173  // See afw::table::io::Persistable::getPythonModule
174  virtual std::string getPythonModule() const;
175 
176  // See afw::table::io::Persistable::write
177  virtual void write(OutputArchiveHandle & handle) const;
178 
179  // Used by persistence only
180  explicit CoaddPsf(
181  afw::table::ExposureCatalog const & catalog,
182  PTR(afw::image::Wcs const) coaddWcs,
183  afw::geom::Point2D const & averagePosition,
184  std::string const & warpingKernelName="lanczos3",
185  int cacheSize=10000
186  );
187 
188 private:
189 
190  afw::table::ExposureCatalog _catalog;
191  CONST_PTR(afw::image::Wcs) _coaddWcs;
192  afw::table::Key<double> _weightKey;
193  afw::geom::Point2D _averagePosition;
194  std::string _warpingKernelName; // could be removed if we could get this from _warpingControl (#2949)
195  CONST_PTR(afw::math::WarpingControl) _warpingControl;
196 };
197 
198 }}} // namespace lsst::meas::algorithms
199 
200 #endif
virtual bool isPersistable() const
Return true if the CoaddPsf persistable (always true).
Definition: CoaddPsf.h:153
afw::geom::Box2I getBBox(int index)
Get the bounding box (in component image Pixel coordinates) of the component image at index...
Definition: CoaddPsf.cc:333
double getWeight(int index)
Get the weight of the component image at index.
Definition: CoaddPsf.cc:319
boost::shared_ptr< afw::image::Wcs const > getWcs(int index)
Get the Wcs of the component image at index.
Definition: CoaddPsf.cc:305
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:252
tbl::Key< int > cacheSize
Definition: CoaddPsf.cc:355
boost::shared_ptr< afw::image::Wcs const > getCoaddWcs()
Return the Wcs of the coadd (defines the coordinate system of the Psf).
Definition: CoaddPsf.h:85
afw::table::RecordId getId(int index)
Get the exposure ID of the component image at index.
Definition: CoaddPsf.cc:326
virtual std::string getPersistenceName() const
Definition: CoaddPsf.cc:441
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:294
tbl::Key< std::string > warpingKernelName
Definition: CoaddPsf.cc:357
virtual afw::geom::Box2I doComputeBBox(afw::geom::Point2D const &position, afw::image::Color const &color) const
Definition: CoaddPsf.cc:228
An intermediate base class for Psfs that use an image representation.
Definition: ImagePsf.h:37
virtual void write(OutputArchiveHandle &handle) const
Definition: CoaddPsf.cc:445
tbl::PointKey< double > averagePosition
Definition: CoaddPsf.cc:356
virtual std::string getPythonModule() const
Definition: CoaddPsf.cc:443
virtual boost::shared_ptr< afw::detection::Psf > resized(int width, int height) const
Return a clone with specified kernel dimensions.
Definition: CoaddPsf.cc:180
virtual afw::geom::Point2D getAveragePosition() const
Return the average of the positions of the stars that went into this Psf.
Definition: CoaddPsf.h:82
boost::shared_ptr< afw::detection::Psf const > getPsf(int index)
Get the Psf of the component image at index.
Definition: CoaddPsf.cc:298
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:312
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