LSST Applications g0b6bd0c080+a72a5dd7e6,g1182afd7b4+2a019aa3bb,g17e5ecfddb+2b8207f7de,g1d67935e3f+06cf436103,g38293774b4+ac198e9f13,g396055baef+6a2097e274,g3b44f30a73+6611e0205b,g480783c3b1+98f8679e14,g48ccf36440+89c08d0516,g4b93dc025c+98f8679e14,g5c4744a4d9+a302e8c7f0,g613e996a0d+e1c447f2e0,g6c8d09e9e7+25247a063c,g7271f0639c+98f8679e14,g7a9cd813b8+124095ede6,g9d27549199+a302e8c7f0,ga1cf026fa3+ac198e9f13,ga32aa97882+7403ac30ac,ga786bb30fb+7a139211af,gaa63f70f4e+9994eb9896,gabf319e997+ade567573c,gba47b54d5d+94dc90c3ea,gbec6a3398f+06cf436103,gc6308e37c7+07dd123edb,gc655b1545f+ade567573c,gcc9029db3c+ab229f5caf,gd01420fc67+06cf436103,gd877ba84e5+06cf436103,gdb4cecd868+6f279b5b48,ge2d134c3d5+cc4dbb2e3f,ge448b5faa6+86d1ceac1d,gecc7e12556+98f8679e14,gf3ee170dca+25247a063c,gf4ac96e456+ade567573c,gf9f5ea5b4d+ac198e9f13,gff490e6085+8c2580be5c,w.2022.27
LSST Data Management Base Package
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"
47
48namespace lsst {
49namespace afw {
50namespace table {
51namespace io {
52
55
56} // namespace io
57} // namespace table
58} // namespace afw
59namespace meas {
60namespace algorithms {
61
62namespace {
63
64// Struct used to simplify calculations in computeAveragePosition; lets us use
65// std::accumulate instead of explicit for loop.
66struct AvgPosItem {
67 double wx; // weighted x position
68 double wy; // weighted y position
69 double w; // weight value
70
71 explicit AvgPosItem(double wx_ = 0.0, double wy_ = 0.0, double w_ = 0.0) : wx(wx_), wy(wy_), w(w_) {}
72
73 // return point, assuming this is a sum of many AvgPosItems
74 geom::Point2D getPoint() const { return geom::Point2D(wx / w, wy / w); }
75
76 // comparison so we can sort by weights
77 bool operator<(AvgPosItem const &other) const { return w < other.w; }
78
79 AvgPosItem &operator+=(AvgPosItem const &other) {
80 wx += other.wx;
81 wy += other.wy;
82 w += other.w;
83 return *this;
84 }
85
86 AvgPosItem &operator-=(AvgPosItem const &other) {
87 wx -= other.wx;
88 wy -= other.wy;
89 w -= other.w;
90 return *this;
91 }
92
93 friend AvgPosItem operator+(AvgPosItem a, AvgPosItem const &b) { return a += b; }
94
95 friend AvgPosItem operator-(AvgPosItem a, AvgPosItem const &b) { return a -= b; }
96};
97
98geom::Point2D computeAveragePosition(afw::table::ExposureCatalog const &catalog,
99 afw::geom::SkyWcs const &coaddWcs, afw::table::Key<double> weightKey) {
100 afw::table::Key<int> goodPixKey;
101 try {
102 goodPixKey = catalog.getSchema()["goodpix"];
103 } catch (pex::exceptions::NotFoundError &) {
104 }
106 items.reserve(catalog.size());
107 for (afw::table::ExposureCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
108 geom::Point2D p = coaddWcs.skyToPixel(i->getWcs()->pixelToSky(i->getPsf()->getAveragePosition()));
109 AvgPosItem item(p.getX(), p.getY(), i->get(weightKey));
110 if (goodPixKey.isValid()) {
111 item.w *= i->get(goodPixKey);
112 }
113 item.wx *= item.w;
114 item.wy *= item.w;
115 items.push_back(item);
116 }
117 // This is a bit pessimistic - we save and sort all the weights all the time,
118 // even though we'll only need them if the average position from all of them
119 // is invalid. But it makes for simpler code, and it's not that expensive
120 // computationally anyhow.
121 std::sort(items.begin(), items.end());
122 AvgPosItem result = std::accumulate(items.begin(), items.end(), AvgPosItem());
123 // If the position isn't valid (no input frames contain it), we remove frames
124 // from the average until it does.
126 catalog.subsetContaining(result.getPoint(), coaddWcs, true).empty(); ++iter) {
127 if (iter == items.end()) {
128 // This should only happen if there are no inputs at all,
129 // or if constituent Psfs have a badly-behaved implementation
130 // of getAveragePosition().
131 throw LSST_EXCEPT(pex::exceptions::RuntimeError,
132 "Could not find a valid average position for CoaddPsf");
133 }
134 result -= *iter;
135 }
136 return result.getPoint();
137}
138
139} // namespace
140
141CoaddPsf::CoaddPsf(afw::table::ExposureCatalog const &catalog, afw::geom::SkyWcs const &coaddWcs,
142 std::string const &weightFieldName, std::string const &warpingKernelName, int cacheSize)
143 : _coaddWcs(coaddWcs),
144 _warpingKernelName(warpingKernelName),
145 _warpingControl(std::make_shared<afw::math::WarpingControl>(warpingKernelName, "", cacheSize)) {
148
149 // copy the field "goodpix", if available, for computeAveragePosition to use
150 try {
151 afw::table::Key<int> goodPixKey = catalog.getSchema()["goodpix"]; // auto does not work
152 mapper.addMapping(goodPixKey, true);
154 }
155
156 // copy the field specified by weightFieldName to field "weight"
157 afw::table::Field<double> weightField = afw::table::Field<double>("weight", "Coadd weight");
158 afw::table::Key<double> weightKey = catalog.getSchema()[weightFieldName];
159 _weightKey = mapper.addMapping(weightKey, weightField);
160
161 _catalog = afw::table::ExposureCatalog(mapper.getOutputSchema());
162 for (afw::table::ExposureCatalog::const_iterator i = catalog.begin(); i != catalog.end(); ++i) {
163 std::shared_ptr<afw::table::ExposureRecord> record = _catalog.getTable()->makeRecord();
164 record->assign(*i, mapper);
165 _catalog.push_back(record);
166 }
167 _averagePosition = computeAveragePosition(_catalog, _coaddWcs, _weightKey);
168}
169
172 : _catalog(catalog),
173 _coaddWcs(coaddWcs),
174 _weightKey(_catalog.getSchema()["weight"]),
175 _averagePosition(averagePosition),
176 _warpingKernelName(warpingKernelName),
177 _warpingControl(new afw::math::WarpingControl(warpingKernelName, "", cacheSize)) {}
178
179std::shared_ptr<afw::detection::Psf> CoaddPsf::clone() const { return std::make_shared<CoaddPsf>(*this); }
180
182 // Not implemented for WarpedPsf
183 throw LSST_EXCEPT(pex::exceptions::LogicError, "Not Implemented");
184}
185
186// Read all the images from the Image Vector and return the BBox in xy0 offset coordinates
187
190 // Calculate the box which will contain them all
191 for (unsigned int i = 0; i < imgVector.size(); i++) {
192 std::shared_ptr<afw::image::Image<double>> componentImg = imgVector[i];
193 geom::Box2I cBBox = componentImg->getBBox();
194 bbox.include(cBBox); // JFB: this works even on empty bboxes
195 }
196 return bbox;
197}
198
199// Read all the images from the Image Vector and add them to image
200
201namespace {
202
205 std::vector<double> const &weightVector) {
206 assert(imgVector.size() == weightVector.size());
207 for (unsigned int i = 0; i < imgVector.size(); i++) {
208 std::shared_ptr<afw::image::Image<double>> componentImg = imgVector[i];
209 double weight = weightVector[i];
210 double sum = ndarray::asEigenMatrix(componentImg->getArray()).sum();
211
212 // Now get the portion of the component image which is appropriate to add
213 // If the default image size is used, the component is guaranteed to fit,
214 // but not if a size has been specified.
215 geom::Box2I cBBox = componentImg->getBBox();
216 geom::Box2I overlap(cBBox);
217 overlap.clip(image->getBBox());
218 // JFB: A subimage view of the image we want to add to, containing only the overlap region.
219 afw::image::Image<double> targetSubImage(*image, overlap);
220 // JFB: A subimage view of the image we want to add from, containing only the overlap region.
221 afw::image::Image<double> cSubImage(*componentImg, overlap);
222 targetSubImage.scaledPlus(weight / sum, cSubImage);
223 }
224}
225
226} // anonymous
227
229 afw::table::ExposureCatalog subcat = _catalog.subsetContaining(ccdXY, _coaddWcs, true);
230 if (subcat.empty()) {
231 throw LSST_EXCEPT(
233 (boost::format("Cannot compute BBox at point %s; no input images at that point.") % ccdXY)
234 .str());
235 }
236
237 geom::Box2I ret;
238 for (auto const &exposureRecord : subcat) {
239 // compute transform from exposure pixels to coadd pixels
240 auto exposureToCoadd = afw::geom::makeWcsPairTransform(*exposureRecord.getWcs(), _coaddWcs);
241 WarpedPsf warpedPsf = WarpedPsf(exposureRecord.getPsf(), exposureToCoadd, _warpingControl);
242 geom::Box2I componentBBox = warpedPsf.computeBBox(ccdXY, color);
243 ret.include(componentBBox);
244 }
245
246 return ret;
247}
248
251 // Get the subset of exposures which contain our coordinate within their validPolygons.
252 afw::table::ExposureCatalog subcat = _catalog.subsetContaining(ccdXY, _coaddWcs, true);
253 if (subcat.empty()) {
254 throw LSST_EXCEPT(
256 (boost::format("Cannot compute CoaddPsf at point %s; no input images at that point.") % ccdXY)
257 .str());
258 }
259 double weightSum = 0.0;
260
261 // Read all the Psf images into a vector. The code is set up so that this can be done in chunks,
262 // with the image modified to accomodate
263 // However, we currently read all of the images.
265 std::vector<double> weightVector;
266
267 for (auto const &exposureRecord : subcat) {
268 // compute transform from exposure pixels to coadd pixels
269 auto exposureToCoadd = afw::geom::makeWcsPairTransform(*exposureRecord.getWcs(), _coaddWcs);
271 try {
272 WarpedPsf warpedPsf = WarpedPsf(exposureRecord.getPsf(), exposureToCoadd, _warpingControl);
273 componentImg = warpedPsf.computeKernelImage(ccdXY, color);
274 } catch (pex::exceptions::RangeError &exc) {
275 LSST_EXCEPT_ADD(exc, (boost::format("Computing WarpedPsf kernel image for id=%d") %
276 exposureRecord.getId())
277 .str());
278 throw exc;
279 }
280 imgVector.push_back(componentImg);
281 weightSum += exposureRecord.get(_weightKey);
282 weightVector.push_back(exposureRecord.get(_weightKey));
283 }
284
285 geom::Box2I bbox = getOverallBBox(imgVector);
286
287 // create a zero image of the right size to sum into
288 std::shared_ptr<afw::detection::Psf::Image> image = std::make_shared<afw::detection::Psf::Image>(bbox);
289 *image = 0.0;
290 addToImage(image, imgVector, weightVector);
291 *image /= weightSum;
292 return image;
293}
294
295int CoaddPsf::getComponentCount() const { return _catalog.size(); }
296
298 if (index < 0 || index >= getComponentCount()) {
299 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
300 }
301 return _catalog[index].getPsf();
302}
303
305 if (index < 0 || index >= getComponentCount()) {
306 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
307 }
308 return *_catalog[index].getWcs();
309}
310
312 if (index < 0 || index >= getComponentCount()) {
313 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
314 }
315 return _catalog[index].getValidPolygon();
316}
317
318double CoaddPsf::getWeight(int index) {
319 if (index < 0 || index >= getComponentCount()) {
320 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
321 }
322 return _catalog[index].get(_weightKey);
323}
324
326 if (index < 0 || index >= getComponentCount()) {
327 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
328 }
329 return _catalog[index].getId();
330}
331
333 if (index < 0 || index >= getComponentCount()) {
334 throw LSST_EXCEPT(pex::exceptions::RangeError, "index of CoaddPsf component out of range");
335 }
336 return _catalog[index].getBBox();
337}
338
339// ---------- Persistence -----------------------------------------------------------------------------------
340
341// For persistence of CoaddPsf, we have two catalogs: the first has just one record, and contains
342// the archive ID of the coadd WCS, the size of the warping cache, the name of the warping kernel,
343// and the average position. The latter is simply the ExposureCatalog.
344
345namespace {
346
347// Singleton class that manages the first persistence catalog's schema and keys
348class CoaddPsfPersistenceHelper {
349public:
350 afw::table::Schema schema;
351 afw::table::Key<int> coaddWcs;
352 afw::table::Key<int> cacheSize;
353 afw::table::PointKey<double> averagePosition;
354 afw::table::Key<std::string> warpingKernelName;
355
356 static CoaddPsfPersistenceHelper const &get() {
357 static CoaddPsfPersistenceHelper const instance;
358 return instance;
359 }
360
361private:
362 CoaddPsfPersistenceHelper()
363 : schema(),
364 coaddWcs(schema.addField<int>("coaddwcs", "archive ID of the coadd's WCS")),
365 cacheSize(schema.addField<int>("cachesize", "size of the warping cache")),
366 averagePosition(afw::table::PointKey<double>::addFields(
367 schema, "avgpos", "PSF accessors default position", "pixel")),
369 schema.addField<std::string>("warpingkernelname", "warping kernel name", 32)) {}
370};
371
372} // namespace
373
375public:
377 read(InputArchive const &archive, CatalogVector const &catalogs) const {
378 if (catalogs.size() == 1u) {
379 // Old CoaddPsfs were saved in only one catalog, because we didn't
380 // save the warping parameters and average position, and we could
381 // save the coadd Wcs in a special final record.
382 return readV0(archive, catalogs);
383 }
384 LSST_ARCHIVE_ASSERT(catalogs.size() == 2u);
385 CoaddPsfPersistenceHelper const &keys1 = CoaddPsfPersistenceHelper::get();
386 LSST_ARCHIVE_ASSERT(catalogs.front().getSchema() == keys1.schema);
387 afw::table::BaseRecord const &record1 = catalogs.front().front();
390 *archive.get<afw::geom::SkyWcs>(record1.get(keys1.coaddWcs)),
391 record1.get(keys1.averagePosition), record1.get(keys1.warpingKernelName),
392 record1.get(keys1.cacheSize)));
393 }
394
395 // Backwards compatibility for files saved before meas_algorithms commit
396 // 53e61fae (7/10/2013). Prior to that change, the warping configuration
397 // and the average position were not saved at all, making it impossible to
398 // reconstruct the average position exactly, but it's better to
399 // approximate than to fail completely.
401 CatalogVector const &catalogs) const {
402 auto internalCat = afw::table::ExposureCatalog::readFromArchive(archive, catalogs.front());
403 // Coadd WCS is stored in a special last record.
404 auto coaddWcs = internalCat.back().getWcs();
405 internalCat.pop_back();
406 // Attempt to reconstruct the average position. We can't do this
407 // exactly, since the catalog we saved isn't the same one that was
408 // used to compute the original average position.
409 afw::table::Key<double> weightKey;
410 try {
411 weightKey = internalCat.getSchema()["weight"];
413 }
414 auto averagePos = computeAveragePosition(internalCat, *coaddWcs, weightKey);
415 return std::shared_ptr<CoaddPsf>(new CoaddPsf(internalCat, *coaddWcs, averagePos));
416 }
417
419};
420
421namespace {
422
423std::string getCoaddPsfPersistenceName() { return "CoaddPsf"; }
424
425CoaddPsf::Factory registration(getCoaddPsfPersistenceName());
426
427} // namespace
428
429std::string CoaddPsf::getPersistenceName() const { return getCoaddPsfPersistenceName(); }
430
431std::string CoaddPsf::getPythonModule() const { return "lsst.meas.algorithms"; }
432
434 CoaddPsfPersistenceHelper const &keys1 = CoaddPsfPersistenceHelper::get();
435 afw::table::BaseCatalog cat1 = handle.makeCatalog(keys1.schema);
437 auto coaddWcsPtr = std::make_shared<afw::geom::SkyWcs>(_coaddWcs);
438 record1->set(keys1.coaddWcs, handle.put(coaddWcsPtr));
439 record1->set(keys1.cacheSize, _warpingControl->getCacheSize());
440 record1->set(keys1.averagePosition, _averagePosition);
441 record1->set(keys1.warpingKernelName, _warpingKernelName);
442 handle.saveCatalog(cat1);
443 _catalog.writeToArchive(handle, false);
444}
445
446} // namespace algorithms
447} // namespace meas
448} // namespace lsst
py::object result
Definition: _schema.cc:429
table::Key< std::string > name
Definition: Amplifier.cc:116
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
Definition: SchemaMapper.cc:71
table::Key< int > b
table::Key< int > a
T accumulate(T... args)
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
T back(T... args)
Basic LSST definitions.
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:139
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:122
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
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:464
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:413
bool empty() const
Return true if the catalog has no records.
Definition: Catalog.h:410
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:490
iterator begin()
Iterator access.
Definition: Catalog.h:401
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Definition: Catalog.h:115
Schema getSchema() const
Return the schema associated with the catalog's table.
Definition: Catalog.h:118
void push_back(Record const &r)
Add a copy of the given record to the end of the catalog.
Definition: Catalog.h:481
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 class used as a handle to a particular field in a table.
Definition: Key.h:53
A mapping between the keys of two Schemas, used to copy data between them.
Definition: SchemaMapper.h:21
A vector of catalogs used by Persistable.
Definition: CatalogVector.h:29
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:31
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.
Definition: Persistable.cc:18
A base class for factory classes used to reconstruct objects from records.
Definition: Persistable.h:228
PersistableFactory(std::string const &name)
Constructor for the factory.
Definition: Persistable.cc:74
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:400
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:377
Factory(std::string const &name)
Definition: CoaddPsf.cc:418
std::string getPersistenceName() const override
Return the unique name used to persist this object and look up its factory.
Definition: CoaddPsf.cc:429
std::shared_ptr< afw::detection::Psf > clone() const override
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
Definition: CoaddPsf.cc:179
void write(OutputArchiveHandle &handle) const override
Write the object to one or more catalogs.
Definition: CoaddPsf.cc:433
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:431
double getWeight(int index)
Get the weight of the component image at index.
Definition: CoaddPsf.cc:318
std::shared_ptr< afw::detection::Psf const > getPsf(int index)
Get the Psf of the component image at index.
Definition: CoaddPsf.cc:297
afw::table::RecordId getId(int index)
Get the exposure ID of the component image at index.
Definition: CoaddPsf.cc:325
geom::Box2I getBBox(int index)
Get the bounding box (in component image Pixel coordinates) of the component image at index.
Definition: CoaddPsf.cc:332
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:250
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:311
std::shared_ptr< afw::detection::Psf > resized(int width, int height) const override
Return a clone with specified kernel dimensions.
Definition: CoaddPsf.cc:181
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:141
geom::Box2I doComputeBBox(geom::Point2D const &position, afw::image::Color const &color) const override
Definition: CoaddPsf.cc:228
int getComponentCount() const
Return the number of component Psfs in this CoaddPsf.
Definition: CoaddPsf.cc:295
afw::geom::SkyWcs getWcs(int index)
Get the Wcs of the component image at index.
Definition: CoaddPsf.cc:304
A Psf class that maps an arbitrary Psf through a coordinate transformation.
Definition: WarpedPsf.h:52
Reports invalid arguments.
Definition: Runtime.h:66
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
T front(T... args)
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
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
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:698
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:704
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:188
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
A base class for image defects.
STL namespace.
T push_back(T... args)
T size(T... args)
T sort(T... args)
afw::table::Key< double > weight
afw::table::Key< int > cacheSize
Definition: CoaddPsf.cc:352
afw::table::PointKey< double > averagePosition
Definition: CoaddPsf.cc:353
afw::table::Key< int > coaddWcs
Definition: CoaddPsf.cc:351
double wx
Definition: CoaddPsf.cc:67
double wy
Definition: CoaddPsf.cc:68
afw::table::Schema schema
Definition: CoaddPsf.cc:350
afw::table::Key< std::string > warpingKernelName
Definition: CoaddPsf.cc:354
double w
Definition: CoaddPsf.cc:69
A description of a field in a table.
Definition: Field.h:24