LSST Applications g034a557a3c+dd8dd8f11d,g0afe43252f+b86e4b8053,g11f7dcd041+017865fdd3,g1cd03abf6b+8446defddb,g1ce3e0751c+f991eae79d,g28da252d5a+ca8a1a9fb3,g2bbee38e9b+b6588ad223,g2bc492864f+b6588ad223,g2cdde0e794+8523d0dbb4,g347aa1857d+b6588ad223,g35bb328faa+b86e4b8053,g3a166c0a6a+b6588ad223,g461a3dce89+b86e4b8053,g52b1c1532d+b86e4b8053,g7f3b0d46df+ad13c1b82d,g80478fca09+f29c5d6c70,g858d7b2824+293f439f82,g8cd86fa7b1+af721d2595,g965a9036f2+293f439f82,g979bb04a14+51ed57f74c,g9ddcbc5298+f24b38b85a,gae0086650b+b86e4b8053,gbb886bcc26+b97e247655,gc28159a63d+b6588ad223,gc30aee3386+a2f0f6cab9,gcaf7e4fdec+293f439f82,gcd45df26be+293f439f82,gcdd4ae20e8+70b5def7e6,gce08ada175+da9c58a417,gcf0d15dbbd+70b5def7e6,gdaeeff99f8+006e14e809,gdbce86181e+6a170ce272,ge3d4d395c2+224150c836,ge5f7162a3a+bb2241c923,ge6cb8fbbf7+d119aed356,ge79ae78c31+b6588ad223,gf048a9a2f4+40ffced2b8,gf0baf85859+b4cca3d10f,w.2024.30
LSST Data Management Base Package
Loading...
Searching...
No Matches
CoaddPsf.cc
Go to the documentation of this file.
1// -*- LSST-C++ -*-
2
3/*
4 * LSST Data Management System
5 * Copyright 2008, 2009, 2010 LSST Corporation.
6 *
7 * This product includes software developed by the
8 * LSST Project (http://www.lsst.org/).
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the LSST License Statement and
21 * the GNU General Public License along with this program. If not,
22 * see <http://www.lsstcorp.org/LegalNotices/>.
23 */
24
25/*
26 * Represent a PSF as for a Coadd based on the James Jee stacking
27 * algorithm which was extracted from Stackfit.
28 */
29#include <cmath>
30#include <sstream>
31#include <iostream>
32#include <numeric>
33#include "boost/iterator/iterator_adaptor.hpp"
34#include "boost/iterator/transform_iterator.hpp"
35#include "ndarray/eigen.h"
36#include "lsst/base.h"
37#include "lsst/pex/exceptions.h"
38#include "lsst/geom/Box.h"
48
49namespace lsst {
50namespace afw {
51namespace table {
52namespace io {
53
56
57} // namespace io
58} // namespace table
59} // namespace afw
60namespace meas {
61namespace algorithms {
62
63namespace {
64
65// Struct used to simplify calculations in computeAveragePosition; lets us use
66// std::accumulate instead of explicit for loop.
67struct AvgPosItem {
68 double wx; // weighted x position
69 double wy; // weighted y position
70 double w; // weight value
71
72 explicit AvgPosItem(double wx_ = 0.0, double wy_ = 0.0, double w_ = 0.0) : wx(wx_), wy(wy_), w(w_) {}
73
74 // return point, assuming this is a sum of many AvgPosItems
75 geom::Point2D getPoint() const { return geom::Point2D(wx / w, wy / w); }
76
77 // comparison so we can sort by weights
78 bool operator<(AvgPosItem const &other) const { return w < other.w; }
79
80 AvgPosItem &operator+=(AvgPosItem const &other) {
81 wx += other.wx;
82 wy += other.wy;
83 w += other.w;
84 return *this;
85 }
86
87 AvgPosItem &operator-=(AvgPosItem const &other) {
88 wx -= other.wx;
89 wy -= other.wy;
90 w -= other.w;
91 return *this;
92 }
93
94 friend AvgPosItem operator+(AvgPosItem a, AvgPosItem const &b) { return a += b; }
95
96 friend AvgPosItem operator-(AvgPosItem a, AvgPosItem const &b) { return a -= b; }
97};
98
99geom::Point2D computeAveragePosition(afw::table::ExposureCatalog const &catalog,
100 afw::geom::SkyWcs const &coaddWcs, afw::table::Key<double> weightKey) {
101 afw::table::Key<int> goodPixKey;
102 try {
103 goodPixKey = catalog.getSchema()["goodpix"];
104 } catch (pex::exceptions::NotFoundError &) {
105 }
107 items.reserve(catalog.size());
108 for (afw::table::ExposureCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
109 geom::Point2D p = coaddWcs.skyToPixel(i->getWcs()->pixelToSky(i->getPsf()->getAveragePosition()));
110 AvgPosItem item(p.getX(), p.getY(), i->get(weightKey));
111 if (goodPixKey.isValid()) {
112 item.w *= i->get(goodPixKey);
113 }
114 item.wx *= item.w;
115 item.wy *= item.w;
116 items.push_back(item);
117 }
118 // This is a bit pessimistic - we save and sort all the weights all the time,
119 // even though we'll only need them if the average position from all of them
120 // is invalid. But it makes for simpler code, and it's not that expensive
121 // computationally anyhow.
122 std::sort(items.begin(), items.end());
123 AvgPosItem result = std::accumulate(items.begin(), items.end(), AvgPosItem());
124 // If the position isn't valid (no input frames contain it), we remove frames
125 // from the average until it does.
126 for (std::vector<AvgPosItem>::iterator iter = items.begin();
127 catalog.subsetContaining(result.getPoint(), coaddWcs, true).empty(); ++iter) {
128 if (iter == items.end()) {
129 // This should only happen if there are no inputs at all,
130 // or if constituent Psfs have a badly-behaved implementation
131 // of getAveragePosition().
132 throw LSST_EXCEPT(pex::exceptions::RuntimeError,
133 "Could not find a valid average position for CoaddPsf");
134 }
135 result -= *iter;
136 }
137 return result.getPoint();
138}
139
140} // namespace
141
142CoaddPsf::CoaddPsf(afw::table::ExposureCatalog const &catalog, afw::geom::SkyWcs const &coaddWcs,
143 std::string const &weightFieldName, std::string const &warpingKernelName, int cacheSize)
144 : _coaddWcs(coaddWcs),
145 _warpingKernelName(warpingKernelName),
146 _warpingControl(std::make_shared<afw::math::WarpingControl>(warpingKernelName, "", cacheSize)) {
147 afw::table::SchemaMapper mapper(catalog.getSchema());
149
150 // copy the field "goodpix", if available, for computeAveragePosition to use
151 try {
152 afw::table::Key<int> goodPixKey = catalog.getSchema()["goodpix"]; // auto does not work
153 mapper.addMapping(goodPixKey, true);
155 }
156
157 // copy the field specified by weightFieldName to field "weight"
158 afw::table::Field<double> weightField = afw::table::Field<double>("weight", "Coadd weight");
159 afw::table::Key<double> weightKey = catalog.getSchema()[weightFieldName];
160 _weightKey = mapper.addMapping(weightKey, weightField);
161
162 _catalog = afw::table::ExposureCatalog(mapper.getOutputSchema());
163 for (afw::table::ExposureCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
164 std::shared_ptr<afw::table::ExposureRecord> record = _catalog.getTable()->makeRecord();
165 record->assign(*i, mapper);
166 _catalog.push_back(record);
167 }
168 _averagePosition = computeAveragePosition(_catalog, _coaddWcs, _weightKey);
169}
170
173 : _catalog(catalog),
174 _coaddWcs(coaddWcs),
175 _weightKey(_catalog.getSchema()["weight"]),
176 _averagePosition(averagePosition),
177 _warpingKernelName(warpingKernelName),
178 _warpingControl(new afw::math::WarpingControl(warpingKernelName, "", cacheSize)) {}
179
180std::shared_ptr<afw::detection::Psf> CoaddPsf::clone() const { return std::make_shared<CoaddPsf>(*this); }
181
183 // Not implemented for WarpedPsf
184 throw LSST_EXCEPT(pex::exceptions::LogicError, "Not Implemented");
185}
186
187// Read all the images from the Image Vector and return the BBox in xy0 offset coordinates
188
191 // Calculate the box which will contain them all
192 for (unsigned int i = 0; i < imgVector.size(); i++) {
193 std::shared_ptr<afw::image::Image<double>> componentImg = imgVector[i];
194 geom::Box2I cBBox = componentImg->getBBox();
195 bbox.include(cBBox); // JFB: this works even on empty bboxes
196 }
197 return bbox;
198}
199
200// Read all the images from the Image Vector and add them to image
201
202namespace {
203
206 std::vector<double> const &weightVector) {
207 assert(imgVector.size() == weightVector.size());
208 for (unsigned int i = 0; i < imgVector.size(); i++) {
209 std::shared_ptr<afw::image::Image<double>> componentImg = imgVector[i];
210 double weight = weightVector[i];
211 double sum = ndarray::asEigenMatrix(componentImg->getArray()).sum();
212
213 // Now get the portion of the component image which is appropriate to add
214 // If the default image size is used, the component is guaranteed to fit,
215 // but not if a size has been specified.
216 geom::Box2I cBBox = componentImg->getBBox();
217 geom::Box2I overlap(cBBox);
218 overlap.clip(image->getBBox());
219 // JFB: A subimage view of the image we want to add to, containing only the overlap region.
220 afw::image::Image<double> targetSubImage(*image, overlap);
221 // JFB: A subimage view of the image we want to add from, containing only the overlap region.
222 afw::image::Image<double> cSubImage(*componentImg, overlap);
223 targetSubImage.scaledPlus(weight / sum, cSubImage);
224 }
225}
226
227} // anonymous
228
230 afw::table::ExposureCatalog subcat = _catalog.subsetContaining(ccdXY, _coaddWcs, true);
231 if (subcat.empty()) {
232 throw LSST_EXCEPT(
234 (boost::format("Cannot compute BBox at point %s; no input images at that point.") % ccdXY)
235 .str());
236 }
237
238 geom::Box2I ret;
239 for (auto const &exposureRecord : subcat) {
240 // compute transform from exposure pixels to coadd pixels
241 auto exposureToCoadd = afw::geom::makeWcsPairTransform(*exposureRecord.getWcs(), _coaddWcs);
242 WarpedPsf warpedPsf = WarpedPsf(exposureRecord.getPsf(), exposureToCoadd, _warpingControl);
243 geom::Box2I componentBBox = warpedPsf.computeBBox(ccdXY, color);
244 ret.include(componentBBox);
245 }
246
247 return ret;
248}
249
252 // Get the subset of exposures which contain our coordinate within their validPolygons.
253 afw::table::ExposureCatalog subcat = _catalog.subsetContaining(ccdXY, _coaddWcs, true);
254 if (subcat.empty()) {
255 throw LSST_EXCEPT(
257 (boost::format("Cannot compute CoaddPsf at point %s; no input images at that point.") % ccdXY)
258 .str());
259 }
260 double weightSum = 0.0;
261
262 // Read all the Psf images into a vector. The code is set up so that this can be done in chunks,
263 // with the image modified to accomodate
264 // However, we currently read all of the images.
266 std::vector<double> weightVector;
267
268 for (auto const &exposureRecord : subcat) {
269 // compute transform from exposure pixels to coadd pixels
270 auto exposureToCoadd = afw::geom::makeWcsPairTransform(*exposureRecord.getWcs(), _coaddWcs);
272 try {
273 WarpedPsf warpedPsf = WarpedPsf(exposureRecord.getPsf(), exposureToCoadd, _warpingControl);
274 componentImg = warpedPsf.computeKernelImage(ccdXY, color);
275 } catch (pex::exceptions::RangeError &exc) {
276 LSST_EXCEPT_ADD(exc, (boost::format("Computing WarpedPsf kernel image for id=%d") %
277 exposureRecord.getId())
278 .str());
279 throw exc;
280 }
281 imgVector.push_back(componentImg);
282 weightSum += exposureRecord.get(_weightKey);
283 weightVector.push_back(exposureRecord.get(_weightKey));
284 }
285
286 geom::Box2I bbox = getOverallBBox(imgVector);
287
288 // create a zero image of the right size to sum into
289 std::shared_ptr<afw::detection::Psf::Image> image = std::make_shared<afw::detection::Psf::Image>(bbox);
290 *image = 0.0;
291 addToImage(image, imgVector, weightVector);
292 *image /= weightSum;
293 return image;
294}
295
296int CoaddPsf::getComponentCount() const { return _catalog.size(); }
297
299 if (index < 0 || index >= getComponentCount()) {
300 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
301 }
302 return _catalog[index].getPsf();
303}
304
306 if (index < 0 || index >= getComponentCount()) {
307 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
308 }
309 return *_catalog[index].getWcs();
310}
311
313 if (index < 0 || index >= getComponentCount()) {
314 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
315 }
316 return _catalog[index].getValidPolygon();
317}
318
319double CoaddPsf::getWeight(int index) {
320 if (index < 0 || index >= getComponentCount()) {
321 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
322 }
323 return _catalog[index].get(_weightKey);
324}
325
327 if (index < 0 || index >= getComponentCount()) {
328 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
329 }
330 return _catalog[index].getId();
331}
332
334 if (index < 0 || index >= getComponentCount()) {
335 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
336 }
337 return _catalog[index].getBBox();
338}
339
340// ---------- Persistence -----------------------------------------------------------------------------------
341
342// For persistence of CoaddPsf, we have two catalogs: the first has just one record, and contains
343// the archive ID of the coadd WCS, the size of the warping cache, the name of the warping kernel,
344// and the average position. The latter is simply the ExposureCatalog.
345
346namespace {
347
348// Singleton class that manages the first persistence catalog's schema and keys
349class CoaddPsfPersistenceHelper {
350public:
351 afw::table::Schema schema;
352 afw::table::Key<int> coaddWcs;
353 afw::table::Key<int> cacheSize;
354 afw::table::PointKey<double> averagePosition;
355 afw::table::Key<std::string> warpingKernelName;
356
357 static CoaddPsfPersistenceHelper const &get() {
358 static CoaddPsfPersistenceHelper const instance;
359 return instance;
360 }
361
362private:
363 CoaddPsfPersistenceHelper()
364 : schema(),
365 coaddWcs(schema.addField<int>("coaddwcs", "archive ID of the coadd's WCS")),
366 cacheSize(schema.addField<int>("cachesize", "size of the warping cache")),
367 averagePosition(afw::table::PointKey<double>::addFields(
368 schema, "avgpos", "PSF accessors default position", "pixel")),
370 schema.addField<std::string>("warpingkernelname", "warping kernel name", 32)) {}
371};
372
373} // namespace
374
376public:
378 read(InputArchive const &archive, CatalogVector const &catalogs) const {
379 if (catalogs.size() == 1u) {
380 // Old CoaddPsfs were saved in only one catalog, because we didn't
381 // save the warping parameters and average position, and we could
382 // save the coadd Wcs in a special final record.
383 return readV0(archive, catalogs);
384 }
385 LSST_ARCHIVE_ASSERT(catalogs.size() == 2u);
386 CoaddPsfPersistenceHelper const &keys1 = CoaddPsfPersistenceHelper::get();
387 LSST_ARCHIVE_ASSERT(catalogs.front().getSchema() == keys1.schema);
388 afw::table::BaseRecord const &record1 = catalogs.front().front();
390 new CoaddPsf(afw::table::ExposureCatalog::readFromArchive(archive, catalogs.back()),
391 *archive.get<afw::geom::SkyWcs>(record1.get(keys1.coaddWcs)),
392 record1.get(keys1.averagePosition), record1.get(keys1.warpingKernelName),
393 record1.get(keys1.cacheSize)));
394 }
395
396 // Backwards compatibility for files saved before meas_algorithms commit
397 // 53e61fae (7/10/2013). Prior to that change, the warping configuration
398 // and the average position were not saved at all, making it impossible to
399 // reconstruct the average position exactly, but it's better to
400 // approximate than to fail completely.
402 CatalogVector const &catalogs) const {
403 auto internalCat = afw::table::ExposureCatalog::readFromArchive(archive, catalogs.front());
404 // Coadd WCS is stored in a special last record.
405 auto coaddWcs = internalCat.back().getWcs();
406 internalCat.pop_back();
407 // Attempt to reconstruct the average position. We can't do this
408 // exactly, since the catalog we saved isn't the same one that was
409 // used to compute the original average position.
410 afw::table::Key<double> weightKey;
411 try {
412 weightKey = internalCat.getSchema()["weight"];
414 }
415 auto averagePos = computeAveragePosition(internalCat, *coaddWcs, weightKey);
416 return std::shared_ptr<CoaddPsf>(new CoaddPsf(internalCat, *coaddWcs, averagePos));
417 }
418
419 Factory(std::string const &name) : afw::table::io::PersistableFactory(name) {}
420};
421
422namespace {
423
424std::string getCoaddPsfPersistenceName() { return "CoaddPsf"; }
425
426CoaddPsf::Factory registration(getCoaddPsfPersistenceName());
427
428} // namespace
429
430std::string CoaddPsf::getPersistenceName() const { return getCoaddPsfPersistenceName(); }
431
432std::string CoaddPsf::getPythonModule() const { return "lsst.meas.algorithms"; }
433
435 CoaddPsfPersistenceHelper const &keys1 = CoaddPsfPersistenceHelper::get();
436 afw::table::BaseCatalog cat1 = handle.makeCatalog(keys1.schema);
438 auto coaddWcsPtr = std::make_shared<afw::geom::SkyWcs>(_coaddWcs);
439 record1->set(keys1.coaddWcs, handle.put(coaddWcsPtr));
440 record1->set(keys1.cacheSize, _warpingControl->getCacheSize());
441 record1->set(keys1.averagePosition, _averagePosition);
442 record1->set(keys1.warpingKernelName, _warpingKernelName);
443 handle.saveCatalog(cat1);
444 _catalog.writeToArchive(handle, false);
445}
446
447} // namespace algorithms
448} // namespace meas
449} // namespace lsst
py::object result
Definition _schema.cc:429
AmpInfoBoxKey bbox
Definition Amplifier.cc:117
std::vector< SchemaItem< Flag > > * items
#define LSST_EXCEPT_ADD(e, m)
Add the current location and a message to an existing exception before rethrowing it.
Definition Exception.h:54
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48
afw::table::Key< afw::table::Array< ImagePixelT > > image
SchemaMapper * mapper
table::Key< int > b
T accumulate(T... args)
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition Persistable.h:48
Basic LSST definitions.
An exception thrown when we have an invalid PSF.
Definition Psf.h:52
lsst::geom::Box2I computeBBox(lsst::geom::Point2D position, image::Color color=image::Color()) const
Return the bounding box of the image returned by computeKernelImage()
Definition Psf.cc:127
std::shared_ptr< Image > computeKernelImage(lsst::geom::Point2D position, image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form suitable for convolution.
Definition Psf.cc:114
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
Definition SkyWcs.h:117
Describe the colour of a source.
Definition Color.h:25
A class to represent a 2-dimensional array of pixels.
Definition Image.h:51
Tag types used to declare specialized field types.
Definition misc.h:31
Base class for all records.
Definition BaseRecord.h:31
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition BaseRecord.h:151
std::shared_ptr< RecordT > const get(size_type i) const
Return a pointer to the record at index i.
Definition Catalog.h:463
size_type size() const
Return the number of elements in the catalog.
Definition Catalog.h:412
bool empty() const
Return true if the catalog has no records.
Definition Catalog.h:409
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
Definition Catalog.h:489
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Definition Catalog.h:114
void push_back(Record const &r)
Add a copy of the given record to the end of the catalog.
Definition Catalog.h:480
Custom catalog class for ExposureRecord/Table.
Definition Exposure.h:311
typename Base::const_iterator const_iterator
Definition Exposure.h:319
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition Exposure.cc:456
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition Exposure.cc:444
ExposureCatalogT subsetContaining(lsst::geom::SpherePoint const &coord, bool includeValidPolygon=false) const
Return a shallow subset of the catalog with only those records that contain the given point.
Definition Exposure.cc:471
static Schema makeMinimalSchema()
Return a minimal schema for Exposure tables and records.
Definition Exposure.h:216
A mapping between the keys of two Schemas, used to copy data between them.
A vector of catalogs used by Persistable.
A multi-catalog archive object used to load table::io::Persistable objects.
std::shared_ptr< Persistable > get(int id) const
Load the Persistable with the given ID and return it.
An object passed to Persistable::write to allow it to persist itself.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
static std::shared_ptr< T > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
A base class for factory classes used to reconstruct objects from records.
An integer coordinate rectangle.
Definition Box.h:55
void include(Point2I const &point)
Expand this to ensure that this->contains(point).
Definition Box.cc:152
std::shared_ptr< afw::table::io::Persistable > readV0(InputArchive const &archive, CatalogVector const &catalogs) const
Definition CoaddPsf.cc:401
virtual std::shared_ptr< afw::table::io::Persistable > read(InputArchive const &archive, CatalogVector const &catalogs) const
Construct a new object from the given InputArchive and vector of catalogs.
Definition CoaddPsf.cc:378
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
Definition CoaddPsf.cc:430
std::shared_ptr< afw::detection::Psf > clone() const override
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
Definition CoaddPsf.cc:180
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition CoaddPsf.cc:434
std::string getPythonModule() const override
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
Definition CoaddPsf.cc:432
double getWeight(int index)
Get the weight of the component image at index.
Definition CoaddPsf.cc:319
std::shared_ptr< afw::detection::Psf const > getPsf(int index)
Get the Psf of the component image at index.
Definition CoaddPsf.cc:298
afw::table::RecordId getId(int index)
Get the exposure ID of the component image at index.
Definition CoaddPsf.cc:326
geom::Box2I getBBox(int index)
Get the bounding box (in component image Pixel coordinates) of the component image at index.
Definition CoaddPsf.cc:333
std::shared_ptr< afw::detection::Psf::Image > doComputeKernelImage(geom::Point2D const &ccdXY, afw::image::Color const &color) const override
These virtual member functions are private, not protected, because we only want derived classes to im...
Definition CoaddPsf.cc:251
std::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
std::shared_ptr< afw::detection::Psf > resized(int width, int height) const override
Return a clone with specified kernel dimensions.
Definition CoaddPsf.cc:182
CoaddPsf(afw::table::ExposureCatalog const &catalog, 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
geom::Box2I doComputeBBox(geom::Point2D const &position, afw::image::Color const &color) const override
Definition CoaddPsf.cc:229
int getComponentCount() const
Return the number of component Psfs in this CoaddPsf.
Definition CoaddPsf.cc:296
afw::geom::SkyWcs getWcs(int index)
Get the Wcs of the component image at index.
Definition CoaddPsf.cc:305
A Psf class that maps an arbitrary Psf through a coordinate transformation.
Definition WarpedPsf.h:52
Reports errors in the logical structure of the program.
Definition Runtime.h:46
Reports attempts to access elements using an invalid key.
Definition Runtime.h:151
Reports when the result of an operation cannot be represented by the destination type.
Definition Runtime.h:115
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
Definition SkyWcs.cc:146
std::shared_ptr< Image< PixelT > > operator+(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator+()
Definition ImageSlice.cc:69
Image< LhsPixelT > & operator+=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Add lhs to Image rhs (i.e. pixel-by-pixel addition) where types are different.
Definition Image.cc:658
Image< LhsPixelT > & operator-=(Image< LhsPixelT > &lhs, Image< RhsPixelT > const &rhs)
Subtract lhs from Image rhs (i.e. pixel-by-pixel subtraction) where types are different.
Definition Image.cc:664
std::shared_ptr< Image< PixelT > > operator-(Image< PixelT > const &img, ImageSlice< PixelT > const &slc)
Overload operator-()
Definition ImageSlice.cc:89
ExposureCatalogT< ExposureRecord > ExposureCatalog
Definition Exposure.h:489
Point< double, 2 > Point2D
Definition Point.h:324
geom::Box2I getOverallBBox(std::vector< std::shared_ptr< afw::image::Image< double > > > const &imgVector)
Definition CoaddPsf.cc:189
STL namespace.
T push_back(T... args)
T reserve(T... args)
T size(T... args)
T sort(T... args)
afw::table::Key< double > weight
afw::table::Key< int > coaddWcs
afw::table::PointKey< double > averagePosition
Definition CoaddPsf.cc:354
double wx
Definition CoaddPsf.cc:68
double wy
Definition CoaddPsf.cc:69
afw::table::Key< std::string > warpingKernelName
Definition CoaddPsf.cc:355
double w
Definition CoaddPsf.cc:70
table::Key< int > cacheSize