lsst.meas.algorithms g4a7591d645+fa9daf83c6
Loading...
Searching...
No Matches
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"
29#include "lsst/pex/config.h"
31#include "lsst/geom/Box.h"
37
38namespace lsst {
39namespace meas {
40namespace algorithms {
41
43public:
44 LSST_CONTROL_FIELD(warpingKernelName, std::string,
45 "Name of warping kernel; choices: lanczos3,lanczos4,lanczos5,bilinear,nearest");
46 LSST_CONTROL_FIELD(cacheSize, int, "Warping kernel cache size");
47
48 explicit CoaddPsfControl(std::string _warpingKernelName = "lanczos3", int _cacheSize = 10000)
49 : warpingKernelName(_warpingKernelName), cacheSize(_cacheSize) {}
50};
51
58class CoaddPsf : public afw::table::io::PersistableFacade<CoaddPsf>, public ImagePsf {
59public:
75 explicit CoaddPsf(afw::table::ExposureCatalog const& catalog,
77 std::string const& weightFieldName = "weight",
78 std::string const& warpingKernelName = "lanczos3", int cacheSize = 10000);
79
95 CoaddPsfControl const& ctrl, std::string const& weightFieldName = "weight")
96 : CoaddPsf(catalog, coaddWcs, weightFieldName, ctrl.warpingKernelName, ctrl.cacheSize) {}
97
98 explicit CoaddPsf(afw::table::ExposureCatalog const& catalog,
100 geom::Point2D const& averagePosition,
101 std::string const& warpingKernelName = "lanczos3",
102 int cacheSize = 10000
103 );
104
107
109 std::shared_ptr<afw::detection::Psf> resized(int width, int height) const override;
116 geom::Point2D getAveragePosition() const override { return _averagePosition; }
117
120
122 int getComponentCount() const;
123
132
141
149 double getWeight(int index) const;
150
158 afw::table::RecordId getId(int index) const;
159
167 geom::Box2I getBBox(int index) const;
168
177
183 int getTract(int index) const;
184
190 int getPatch(int index) const;
191
201 bool isPersistable() const noexcept override { return true; }
202
203 // Factory used to read CoaddPsf from an InputArchive; defined only in the source file.
204 class Factory;
205
206protected:
208 doComputeKernelImage(geom::Point2D const& ccdXY, afw::image::Color const& color) const override;
209
210 geom::Box2I doComputeBBox(geom::Point2D const& position, afw::image::Color const& color) const override;
211
212 // See afw::table::io::Persistable::getPersistenceName
213 std::string getPersistenceName() const override;
214
215 // See afw::table::io::Persistable::getPythonModule
216 std::string getPythonModule() const override;
217
218 // See afw::table::io::Persistable::write
219 void write(OutputArchiveHandle& handle) const override;
220
221
222private:
225 afw::table::Key<double> _weightKey;
226 afw::table::Key<int> _tractKey;
227 afw::table::Key<int> _patchKey;
228 geom::Point2D _averagePosition;
229 std::string _warpingKernelName; // could be removed if we could get this from _warpingControl (#2949)
231};
232
233} // namespace algorithms
234} // namespace meas
235} // namespace lsst
236
237#endif
io::OutputArchiveHandle OutputArchiveHandle
CoaddPsfControl(std::string _warpingKernelName="lanczos3", int _cacheSize=10000)
Definition CoaddPsf.h:48
int cacheSize
"Warping kernel cache size" ;
Definition CoaddPsf.h:46
std::string warpingKernelName
"Name of warping kernel; choices: lanczos3,lanczos4,lanczos5,bilinear,nearest" ;
Definition CoaddPsf.h:45
std::string getPersistenceName() const override
Definition CoaddPsf.cc:463
std::shared_ptr< afw::detection::Psf > clone() const override
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
Definition CoaddPsf.cc:193
void write(OutputArchiveHandle &handle) const override
Definition CoaddPsf.cc:467
std::string getPythonModule() const override
Definition CoaddPsf.cc:465
bool isPersistable() const noexcept override
Return true if the CoaddPsf persistable (always true).
Definition CoaddPsf.h:201
int getTract(int index) const
Get the tract ID of the component image at the given index.
Definition CoaddPsf.cc:353
afw::table::RecordId getId(int index) const
Get the exposure ID of the component image at index.
Definition CoaddPsf.cc:339
CoaddPsf(afw::table::ExposureCatalog const &catalog, std::shared_ptr< afw::geom::SkyWcs const > coaddWcs, CoaddPsfControl const &ctrl, std::string const &weightFieldName="weight")
Constructor for CoaddPsf.
Definition CoaddPsf.h:94
std::shared_ptr< afw::geom::polygon::Polygon const > getValidPolygon(int index) const
Get the validPolygon (in component image Pixel coordinates) of the component image at index.
Definition CoaddPsf.cc:325
std::shared_ptr< afw::detection::Psf::Image > doComputeKernelImage(geom::Point2D const &ccdXY, afw::image::Color const &color) const override
Definition CoaddPsf.cc:264
CoaddPsf(afw::table::ExposureCatalog const &catalog, std::shared_ptr< afw::geom::SkyWcs const > coaddWcs, std::string const &weightFieldName="weight", std::string const &warpingKernelName="lanczos3", int cacheSize=10000)
Main constructors for CoaddPsf.
Definition CoaddPsf.cc:142
std::shared_ptr< afw::detection::Psf > resized(int width, int height) const override
Return a clone with specified kernel dimensions.
Definition CoaddPsf.cc:195
std::shared_ptr< afw::detection::Psf const > getPsf(int index) const
Get the Psf of the component image at index.
Definition CoaddPsf.cc:311
std::shared_ptr< afw::geom::SkyWcs const > getWcs(int index) const
Get the Wcs of the component image at index.
Definition CoaddPsf.cc:318
int getPatch(int index) const
Get the patch ID of the component image at the given index.
Definition CoaddPsf.cc:363
geom::Box2I doComputeBBox(geom::Point2D const &position, afw::image::Color const &color) const override
Definition CoaddPsf.cc:242
geom::Point2D getAveragePosition() const override
Return the average of the positions of the stars that went into this Psf.
Definition CoaddPsf.h:116
int getComponentCount() const
Return the number of component Psfs in this CoaddPsf.
Definition CoaddPsf.cc:309
geom::Box2I getBBox(int index) const
Get the bounding box (in component image Pixel coordinates) of the component image at index.
Definition CoaddPsf.cc:346
double getWeight(int index) const
Get the weight of the component image at index.
Definition CoaddPsf.cc:332
std::shared_ptr< afw::geom::SkyWcs const > getCoaddWcs() const
Return the Wcs of the coadd (defines the coordinate system of the Psf).
Definition CoaddPsf.h:119
ImagePsf(bool isFixed=false)
Definition ImagePsf.h:42
ExposureCatalogT< ExposureRecord > ExposureCatalog
std::int64_t RecordId
Point< double, 2 > Point2D