LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
CoaddPsf is the Psf derived to be used for non-PSF-matched Coadd images.
More...
#include <CoaddPsf.h>
|
| 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. More...
|
|
| CoaddPsf (afw::table::ExposureCatalog const &catalog, afw::geom::SkyWcs const &coaddWcs, CoaddPsfControl const &ctrl, std::string const &weightFieldName="weight") |
| Constructor for CoaddPsf. More...
|
|
boost::shared_ptr< afw::detection::Psf > | clone () const override |
| Polymorphic deep copy. Usually unnecessary, as Psfs are immutable. More...
|
|
boost::shared_ptr< afw::detection::Psf > | resized (int width, int height) const override |
| Return a clone with specified kernel dimensions. More...
|
|
geom::Point2D | getAveragePosition () const override |
| Return the average of the positions of the stars that went into this Psf. More...
|
|
afw::geom::SkyWcs | getCoaddWcs () |
| Return the Wcs of the coadd (defines the coordinate system of the Psf). More...
|
|
int | getComponentCount () const |
| Return the number of component Psfs in this CoaddPsf. More...
|
|
boost::shared_ptr< afw::detection::Psf const > | getPsf (int index) |
| Get the Psf of the component image at index. More...
|
|
afw::geom::SkyWcs | getWcs (int index) |
| Get the Wcs of the component image at index. More...
|
|
double | getWeight (int index) |
| Get the weight of the component image at index. More...
|
|
afw::table::RecordId | getId (int index) |
| Get the exposure ID of the component image at index. More...
|
|
geom::Box2I | getBBox (int index) |
| Get the bounding box (in component image Pixel coordinates) of the component image at index. More...
|
|
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. More...
|
|
bool | isPersistable () const noexcept override |
| Return true if the CoaddPsf persistable (always true). More...
|
|
std::shared_ptr< typehandling::Storable > | cloneStorable () const override |
| Polymorphic deep-copy. More...
|
|
std::shared_ptr< Image > | computeImage (lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const |
| Return an Image of the PSF, in a form that can be compared directly with star images. More...
|
|
std::shared_ptr< Image > | computeKernelImage (lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const |
| Return an Image of the PSF, in a form suitable for convolution. More...
|
|
double | computePeak (lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Return the peak value of the PSF image. More...
|
|
double | computeApertureFlux (double radius, lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Compute the "flux" of the Psf model within a circular aperture of the given radius. More...
|
|
geom::ellipses::Quadrupole | computeShape (lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Compute the ellipse corresponding to the second moments of the Psf. More...
|
|
std::shared_ptr< math::Kernel const > | getLocalKernel (lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Return a FixedKernel corresponding to the Psf image at the given point. More...
|
|
image::Color | getAverageColor () const |
| Return the average Color of the stars used to construct the Psf. More...
|
|
lsst::geom::Box2I | computeBBox (lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Return the bounding box of the image returned by computeKernelImage() More...
|
|
std::size_t | getCacheCapacity () const |
| Return the capacity of the caches. More...
|
|
void | setCacheCapacity (std::size_t capacity) |
| Set the capacity of the caches. More...
|
|
virtual std::string | toString () const |
| Create a string representation of this object (optional operation). More...
|
|
virtual std::size_t | hash_value () const |
| Return a hash of this object (optional operation). More...
|
|
virtual bool | equals (Storable const &other) const noexcept |
| Compare this object to another Storable. More...
|
|
void | writeFits (std::string const &fileName, std::string const &mode="w") const |
| Write the object to a regular FITS file. More...
|
|
void | writeFits (fits::MemFileManager &manager, std::string const &mode="w") const |
| Write the object to a FITS image in memory. More...
|
|
void | writeFits (fits::Fits &fitsfile) const |
| Write the object to an already-open FITS object. More...
|
|
|
static std::shared_ptr< CoaddPsf > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. More...
|
|
static std::shared_ptr< CoaddPsf > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
| Read an object from a regular FITS file. More...
|
|
static std::shared_ptr< CoaddPsf > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
| Read an object from a FITS file in memory. More...
|
|
static std::shared_ptr< CoaddPsf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
| Dynamically cast a shared_ptr. More...
|
|
static std::shared_ptr< ImagePsf > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. More...
|
|
static std::shared_ptr< ImagePsf > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
| Read an object from a regular FITS file. More...
|
|
static std::shared_ptr< ImagePsf > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
| Read an object from a FITS file in memory. More...
|
|
static std::shared_ptr< Psf > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. More...
|
|
static std::shared_ptr< Psf > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
| Read an object from a regular FITS file. More...
|
|
static std::shared_ptr< Psf > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
| Read an object from a FITS file in memory. More...
|
|
static std::shared_ptr< ImagePsf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
| Dynamically cast a shared_ptr. More...
|
|
static std::shared_ptr< Psf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
| Dynamically cast a shared_ptr. More...
|
|
static std::shared_ptr< Image > | recenterKernelImage (std::shared_ptr< Image > im, lsst::geom::Point2D const &position, std::string const &warpAlgorithm="lanczos5", unsigned int warpBuffer=5) |
| Helper function for Psf::doComputeImage(): converts a kernel image (centered at (0,0) when xy0 is taken into account) to an image centered at position when xy0 is taken into account. More...
|
|
|
boost::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 implement them, not call them; they should call the corresponding compute*Image member functions instead so as to let the Psf base class handle caching properly. More...
|
|
geom::Box2I | doComputeBBox (geom::Point2D const &position, afw::image::Color const &color) const override |
|
std::string | getPersistenceName () const override |
| Return the unique name used to persist this object and look up its factory. More...
|
|
std::string | getPythonModule () const override |
| Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
|
|
void | write (OutputArchiveHandle &handle) const override |
| Write the object to one or more catalogs. More...
|
|
| CoaddPsf (afw::table::ExposureCatalog const &catalog, afw::geom::SkyWcs const &coaddWcs, geom::Point2D const &averagePosition, std::string const &warpingKernelName="lanczos3", int cacheSize=10000) |
|
virtual double | doComputeApertureFlux (double radius, geom::Point2D const &position, afw::image::Color const &color) const |
|
virtual afw::geom::ellipses::Quadrupole | doComputeShape (geom::Point2D const &position, afw::image::Color const &color) const |
|
virtual std::shared_ptr< Image > | doComputeImage (lsst::geom::Point2D const &position, image::Color const &color) const |
| This virtual member is protected (rather than private) so that python-implemented derived classes may opt to use the default implementation. More...
|
|
|
template<class T > |
static bool | singleClassEquals (T const &lhs, Storable const &rhs) |
| Test if a Storable is of a particular class and equal to another object. More...
|
|
CoaddPsf is the Psf derived to be used for non-PSF-matched Coadd images.
It incorporates the logic of James Jee's Stackfit algorithm for estimating the Psf of coadd by coadding the images of the Psf models of each input exposure.
Definition at line 58 of file CoaddPsf.h.
◆ Image
Image type returned by computeImage.
Definition at line 83 of file Psf.h.
◆ OutputArchiveHandle
◆ Pixel
Pixel type of Image returned by computeImage.
Definition at line 82 of file Psf.h.
◆ ImageOwnerEnum
Enum passed to computeImage and computeKernelImage to determine image ownership.
Enumerator |
---|
COPY | The image will be copied before returning; caller will own it.
|
INTERNAL | An internal image will be returned without copying.
The caller must not modify it, and it may be invalidated the next time a Psf member function is called with different color and/or position.
|
Definition at line 86 of file Psf.h.
◆ CoaddPsf() [1/3]
Main constructors for CoaddPsf.
The ExposureCatalog contains info about each visit/ccd in Coadd; this must be provided to the constructor, and cannot be changed.
- Parameters
-
[in] | catalog | ExposureCatalog containing the id, bbox, wcs, psf and weight for each ccd/visit. This is usually the same catalog as the "ccds" catalog in the coadd Exposure's CoaddInputs. |
[in] | coaddWcs | Wcs for the coadd. |
[in] | weightFieldName | Field name that contains the weight of the exposure in the coadd; defaults to "weight". |
[in] | warpingKernelName | Name of warping kernel |
[in] | cacheSize | Warping kernel cache size |
Definition at line 141 of file CoaddPsf.cc.
146 afw::table::SchemaMapper
mapper(catalog.getSchema());
151 afw::table::Key<int> goodPixKey = catalog.getSchema()[
"goodpix"];
152 mapper.addMapping(goodPixKey,
true);
153 }
catch (pex::exceptions::NotFoundError &) {
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);
163 PTR(afw::table::ExposureRecord) record = _catalog.getTable()->makeRecord();
164 record->assign(*i,
mapper);
165 _catalog.push_back(record);
167 _averagePosition = computeAveragePosition(_catalog, _coaddWcs, _weightKey);
◆ CoaddPsf() [2/3]
Constructor for CoaddPsf.
The ExposureCatalog contains info about each visit/ccd in Coadd; this must be provided to the constructor, and cannot be changed.
- Parameters
-
[in] | catalog | ExposureCatalog containing the id, bbox, wcs, psf and weight for each ccd/visit. This is usually the same catalog as the "ccds" catalog in the coadd Exposure's CoaddInputs. |
[in] | coaddWcs | Wcs for the coadd. |
[in] | ctrl | Configuration options. |
[in] | weightFieldName | Field name that contains the weight of the exposure in the coadd; defaults to "weight". |
Definition at line 93 of file CoaddPsf.h.
95 :
CoaddPsf(catalog,
coaddWcs, weightFieldName, ctrl.warpingKernelName, ctrl.cacheSize) {}
◆ CoaddPsf() [3/3]
- Parameters
-
catalog | Unpersisted catalog |
coaddWcs | WCS for the coadd |
averagePosition | Default position for accessors |
warpingKernelName | Warping kernel name |
cacheSize | Kernel cache size |
Definition at line 433 of file CoaddPsf.cc.
437 _weightKey(_catalog.getSchema()[
"weight"]),
◆ clone()
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
Implements lsst::afw::detection::Psf.
Definition at line 170 of file CoaddPsf.cc.
170 {
return std::make_shared<CoaddPsf>(*
this); }
◆ cloneStorable()
std::shared_ptr<typehandling::Storable> lsst::afw::detection::Psf::cloneStorable |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
Polymorphic deep copy. Usually unnecessary, as Psfs are immutable.
This method is an alias of clone that can be called from a reference to Storable.
Reimplemented from lsst::afw::typehandling::Storable.
Definition at line 116 of file Psf.h.
◆ computeApertureFlux()
Compute the "flux" of the Psf model within a circular aperture of the given radius.
- Parameters
-
[in] | radius | Radius of the aperture to measure. |
[in] | position | Position to evaluate the PSF at; defaults to getAveragePosition(). |
[in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
The flux is relative to a Psf image that has been normalized to unit integral, and the radius is in pixels.
Definition at line 150 of file Psf.cc.
153 return doComputeApertureFlux(
radius, position, color);
◆ computeBBox()
Return the bounding box of the image returned by computeKernelImage()
Definition at line 128 of file Psf.cc.
131 return doComputeBBox(position, color);
◆ computeImage()
Return an Image of the PSF, in a form that can be compared directly with star images.
The specified position is a floating point number, and the resulting image will have a Psf centered on that point when the returned image's xy0 is taken into account.
The returned image is normalized to sum to unity.
- Parameters
-
[in] | position | Position to evaluate the PSF at; defaults to getAveragePosition(). |
[in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
[in] | owner | Whether to copy the return value or return an internal image that must be handled with care (see ImageOwnerEnum). |
The Psf class caches the most recent return value of computeImage, so repeated calls with the same arguments will be highly optimized.
- Note
- The real work is done in the virtual private member function Psf::doComputeImage; computeImage only handles caching and default arguments.
Definition at line 102 of file Psf.cc.
107 detail::PsfCacheKey(position, color),
◆ computeKernelImage()
Return an Image of the PSF, in a form suitable for convolution.
While the position need not be an integer, the center of the PSF image returned by computeKernelImage will in the center of the center pixel of the image, which will be (0,0) when the Image's xy0 is taken into account; this is the same behavior as Kernel::computeImage().
The returned image is normalized to sum to unity.
- Parameters
-
[in] | position | Position to evaluate the PSF at; defaults to getAveragePosition(). |
[in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
[in] | owner | Whether to copy the return value or return an internal image that must be handled with care (see ImageOwnerEnum). |
The Psf class caches the most recent return value of computeKernelImage, so repeated calls with the same arguments will be highly optimized.
- Note
- The real work is done in the virtual private member function Psf::doComputeKernelImage; computeKernelImage only handles caching and default arguments.
Definition at line 115 of file Psf.cc.
120 detail::PsfCacheKey(position, color),
121 [
this](detail::PsfCacheKey
const &
key) {
return doComputeKernelImage(
key.position,
key.color); });
◆ computePeak()
Return the peak value of the PSF image.
- Parameters
-
This calls computeKernelImage internally, but because this will usually be cached, it shouldn't be expensive (but be careful not to accidentally call it with no arguments when you actually want to call it with the same arguments just used to call computeImage or computeKernelImage).
Definition at line 143 of file Psf.cc.
◆ computeShape()
Compute the ellipse corresponding to the second moments of the Psf.
- Parameters
-
The algorithm used to compute the moments is up to the derived class, and hence this method should not be used when a particular algorithm or weight function is required.
Definition at line 156 of file Psf.cc.
159 return doComputeShape(position, color);
◆ doComputeApertureFlux()
double lsst::meas::algorithms::ImagePsf::doComputeApertureFlux |
( |
double |
radius, |
|
|
geom::Point2D const & |
position, |
|
|
afw::image::Color const & |
color |
|
) |
| const |
|
protectedvirtualinherited |
◆ doComputeBBox()
Implements lsst::afw::detection::Psf.
Definition at line 215 of file CoaddPsf.cc.
217 if (subcat.empty()) {
219 pex::exceptions::InvalidParameterError,
220 (
boost::format(
"Cannot compute BBox at point %s; no input images at that point.") % ccdXY)
225 for (
auto const &exposureRecord : subcat) {
228 WarpedPsf warpedPsf = WarpedPsf(exposureRecord.getPsf(), exposureToCoadd, _warpingControl);
229 geom::Box2I componentBBox = warpedPsf.computeBBox(ccdXY, color);
◆ doComputeImage()
|
protectedvirtualinherited |
This virtual member is protected (rather than private) so that python-implemented derived classes may opt to use the default implementation.
C++ derived classes may override this method, but should not call it.
Definition at line 162 of file Psf.cc.
◆ doComputeKernelImage()
These virtual member functions are private, not protected, because we only want derived classes to implement them, not call them; they should call the corresponding compute*Image member functions instead so as to let the Psf base class handle caching properly.
Derived classes are responsible for ensuring that returned images sum to one.
Implements lsst::afw::detection::Psf.
Definition at line 237 of file CoaddPsf.cc.
240 if (subcat.empty()) {
242 pex::exceptions::InvalidParameterError,
243 (
boost::format(
"Cannot compute CoaddPsf at point %s; no input images at that point.") % ccdXY)
246 double weightSum = 0.0;
254 for (
auto const &exposureRecord : subcat) {
257 PTR(afw::image::Image<double>) componentImg;
259 WarpedPsf warpedPsf = WarpedPsf(exposureRecord.getPsf(), exposureToCoadd, _warpingControl);
260 componentImg = warpedPsf.computeKernelImage(ccdXY, color);
261 }
catch (pex::exceptions::RangeError &exc) {
263 exposureRecord.getId())
268 weightSum += exposureRecord.get(_weightKey);
269 weightVector.
push_back(exposureRecord.get(_weightKey));
◆ doComputeShape()
|
protectedvirtualinherited |
◆ dynamicCast() [1/3]
Dynamically cast a shared_ptr.
Dynamically cast a shared pointer and raise on failure.
You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;
- Exceptions
-
param[in] ptr The pointer to be cast.
- Returns
- The cast pointer.
- Exceptions
-
Definition at line 218 of file Persistable.cc.
19 auto result = std::dynamic_pointer_cast<T>(
ptr);
21 throw LSST_EXCEPT(pex::exceptions::TypeError,
"Dynamic pointer cast failed");
◆ dynamicCast() [2/3]
Dynamically cast a shared_ptr.
Dynamically cast a shared pointer and raise on failure.
You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;
- Exceptions
-
param[in] ptr The pointer to be cast.
- Returns
- The cast pointer.
- Exceptions
-
Definition at line 218 of file Persistable.cc.
19 auto result = std::dynamic_pointer_cast<T>(
ptr);
21 throw LSST_EXCEPT(pex::exceptions::TypeError,
"Dynamic pointer cast failed");
◆ dynamicCast() [3/3]
Dynamically cast a shared_ptr.
Dynamically cast a shared pointer and raise on failure.
You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;
- Exceptions
-
param[in] ptr The pointer to be cast.
- Returns
- The cast pointer.
- Exceptions
-
Definition at line 218 of file Persistable.cc.
19 auto result = std::dynamic_pointer_cast<T>(
ptr);
21 throw LSST_EXCEPT(pex::exceptions::TypeError,
"Dynamic pointer cast failed");
◆ equals()
bool lsst::afw::typehandling::Storable::equals |
( |
Storable const & |
other | ) |
const |
|
virtualnoexceptinherited |
◆ getAverageColor()
image::Color lsst::afw::detection::Psf::getAverageColor |
( |
| ) |
const |
|
inlineinherited |
Return the average Color of the stars used to construct the Psf.
This is also the Color used to return an image if you don't specify a Color.
Definition at line 233 of file Psf.h.
◆ getAveragePosition()
geom::Point2D lsst::meas::algorithms::CoaddPsf::getAveragePosition |
( |
| ) |
const |
|
inlineoverridevirtual |
Return the average of the positions of the stars that went into this Psf.
For CoaddPsf, this is calculated as the weighted average of the average positions of all the component Psfs.
Reimplemented from lsst::afw::detection::Psf.
Definition at line 108 of file CoaddPsf.h.
108 {
return _averagePosition; }
◆ getBBox()
geom::Box2I lsst::meas::algorithms::CoaddPsf::getBBox |
( |
int |
index | ) |
|
Get the bounding box (in component image Pixel coordinates) of the component image at index.
- Parameters
-
[in] | index | Index of component for which the bounding box will be fetched. |
- Returns
- Corresponding bounding box.
- Exceptions
-
RangeError | Index of component is out of range. |
Definition at line 319 of file CoaddPsf.cc.
321 throw LSST_EXCEPT(pex::exceptions::RangeError,
"index of CoaddPsf component out of range");
323 return _catalog[index].getBBox();
◆ getCacheCapacity()
Return the capacity of the caches.
Both the image and kernel image caches have the same capacity.
Definition at line 170 of file Psf.cc.
170 {
return _kernelImageCache->capacity(); }
◆ getCoaddWcs()
Return the Wcs of the coadd (defines the coordinate system of the Psf).
Definition at line 111 of file CoaddPsf.h.
111 {
return _coaddWcs; }
◆ getComponentCount()
int lsst::meas::algorithms::CoaddPsf::getComponentCount |
( |
| ) |
const |
Return the number of component Psfs in this CoaddPsf.
Definition at line 282 of file CoaddPsf.cc.
282 {
return _catalog.size(); }
◆ getId()
Get the exposure ID of the component image at index.
- Parameters
-
[in] | index | Index of component for which the exposure ID will be fetched. |
- Returns
- Corresponding exposure ID.
- Exceptions
-
RangeError | Index of component is out of range. |
Definition at line 312 of file CoaddPsf.cc.
314 throw LSST_EXCEPT(pex::exceptions::RangeError,
"index of CoaddPsf component out of range");
316 return _catalog[index].getId();
◆ getLocalKernel()
Return a FixedKernel corresponding to the Psf image at the given point.
This is implemented by calling computeKernelImage, and is simply provided for convenience.
Definition at line 134 of file Psf.cc.
140 return std::make_shared<math::FixedKernel>(*
image);
◆ getPersistenceName()
std::string lsst::meas::algorithms::CoaddPsf::getPersistenceName |
( |
| ) |
const |
|
overrideprotectedvirtual |
Return the unique name used to persist this object and look up its factory.
Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 416 of file CoaddPsf.cc.
416 {
return getCoaddPsfPersistenceName(); }
◆ getPsf()
boost::shared_ptr< afw::detection::Psf const > lsst::meas::algorithms::CoaddPsf::getPsf |
( |
int |
index | ) |
|
Get the Psf of the component image at index.
- Parameters
-
[in] | index | Index of component for which the Psf will be fetched. |
- Returns
- Corresponding Psf.
- Exceptions
-
RangeError | Index of component is out of range. |
Definition at line 284 of file CoaddPsf.cc.
286 throw LSST_EXCEPT(pex::exceptions::RangeError,
"index of CoaddPsf component out of range");
288 return _catalog[index].getPsf();
◆ getPythonModule()
std::string lsst::meas::algorithms::CoaddPsf::getPythonModule |
( |
| ) |
const |
|
overrideprotectedvirtual |
Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.
Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.
Will be ignored if empty.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 418 of file CoaddPsf.cc.
418 {
return "lsst.meas.algorithms"; }
◆ getValidPolygon()
Get the validPolygon (in component image Pixel coordinates) of the component image at index.
- Parameters
-
[in] | index | Index of component for which the bounding box will be fetched. |
- Returns
- Corresponding validPolygon.
- Exceptions
-
RangeError | Index of component is out of range. |
Definition at line 298 of file CoaddPsf.cc.
300 throw LSST_EXCEPT(pex::exceptions::RangeError,
"index of CoaddPsf component out of range");
302 return _catalog[index].getValidPolygon();
◆ getWcs()
Get the Wcs of the component image at index.
- Parameters
-
[in] | index | Index of component for which the Wcs will be fetched. |
- Returns
- Corresponding Wcs.
- Exceptions
-
RangeError | Index of component is out of range. |
Definition at line 291 of file CoaddPsf.cc.
293 throw LSST_EXCEPT(pex::exceptions::RangeError,
"index of CoaddPsf component out of range");
295 return *_catalog[index].getWcs();
◆ getWeight()
double lsst::meas::algorithms::CoaddPsf::getWeight |
( |
int |
index | ) |
|
Get the weight of the component image at index.
- Parameters
-
[in] | index | Index of component for which the weight will be fetched. |
- Returns
- Corresponding weight.
- Exceptions
-
RangeError | Index of component is out of range. |
Definition at line 305 of file CoaddPsf.cc.
307 throw LSST_EXCEPT(pex::exceptions::RangeError,
"index of CoaddPsf component out of range");
309 return _catalog[index].get(_weightKey);
◆ hash_value()
std::size_t lsst::afw::typehandling::Storable::hash_value |
( |
| ) |
const |
|
virtualinherited |
◆ isPersistable()
bool lsst::meas::algorithms::CoaddPsf::isPersistable |
( |
| ) |
const |
|
inlineoverridevirtualnoexcept |
Return true if the CoaddPsf persistable (always true).
While it's actually possible to construct a CoaddPsf that isn't persistable (because its nested Psfs and Wcss are not persistable) in artificial situations, in realistic situations it's pretty much impossible, because persistence is a necessary part of how CoaddPsfs are built. And it's simpler and much faster if we just always return true, rather than loop over the elements and check each one.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 179 of file CoaddPsf.h.
◆ readFits() [1/9]
Read an object from an already open FITS object.
- Parameters
-
[in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
184 return dynamicCast(Persistable::_readFits(fitsfile));
◆ readFits() [2/9]
Read an object from an already open FITS object.
- Parameters
-
[in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
184 return dynamicCast(Persistable::_readFits(fitsfile));
◆ readFits() [3/9]
Read an object from an already open FITS object.
- Parameters
-
[in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
184 return dynamicCast(Persistable::_readFits(fitsfile));
◆ readFits() [4/9]
Read an object from a FITS file in memory.
- Parameters
-
[in] | manager | Manager for the memory to read from. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 205 of file Persistable.h.
206 return dynamicCast(Persistable::_readFits(manager, hdu));
◆ readFits() [5/9]
Read an object from a FITS file in memory.
- Parameters
-
[in] | manager | Manager for the memory to read from. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 205 of file Persistable.h.
206 return dynamicCast(Persistable::_readFits(manager, hdu));
◆ readFits() [6/9]
Read an object from a FITS file in memory.
- Parameters
-
[in] | manager | Manager for the memory to read from. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 205 of file Persistable.h.
206 return dynamicCast(Persistable::_readFits(manager, hdu));
◆ readFits() [7/9]
Read an object from a regular FITS file.
- Parameters
-
[in] | fileName | Name of the file to read. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 194 of file Persistable.h.
195 return dynamicCast(Persistable::_readFits(fileName, hdu));
◆ readFits() [8/9]
Read an object from a regular FITS file.
- Parameters
-
[in] | fileName | Name of the file to read. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 194 of file Persistable.h.
195 return dynamicCast(Persistable::_readFits(fileName, hdu));
◆ readFits() [9/9]
Read an object from a regular FITS file.
- Parameters
-
[in] | fileName | Name of the file to read. |
[in] | hdu | HDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty. |
Definition at line 194 of file Persistable.h.
195 return dynamicCast(Persistable::_readFits(fileName, hdu));
◆ recenterKernelImage()
Helper function for Psf::doComputeImage(): converts a kernel image (centered at (0,0) when xy0 is taken into account) to an image centered at position when xy0 is taken into account.
warpAlgorithm
is passed to afw::math::makeWarpingKernel() and can be "nearest", "bilinear", or "lanczosN"
warpBuffer
zero-pads the image before recentering. Recommended value is 1 for bilinear, N for lanczosN (note that it would be cleaner to infer this value from the warping algorithm but this would require mild API changes; same issue occurs in e.g. afw::math::offsetImage()).
The point with integer coordinates (0,0)
in the source image (with xy0 taken into account) corresponds to the point position
in the destination image. If position
is not integer-valued then we will need to fractionally shift the image using interpolation.
Note: if fractional recentering is performed, then a new image will be allocated and returned. If not, then the original image will be returned (after setting XY0).
Definition at line 86 of file Psf.cc.
94 if (irX.second != 0.0 || irY.second != 0.0) {
◆ resized()
boost::shared_ptr< afw::detection::Psf > lsst::meas::algorithms::CoaddPsf::resized |
( |
int |
width, |
|
|
int |
height |
|
) |
| const |
|
overridevirtual |
◆ setCacheCapacity()
Set the capacity of the caches.
Both the image and kernel image caches will be set to this capacity.
Definition at line 172 of file Psf.cc.
173 _imageCache->reserve(capacity);
174 _kernelImageCache->reserve(capacity);
◆ singleClassEquals()
template<class T >
static bool lsst::afw::typehandling::Storable::singleClassEquals |
( |
T const & |
lhs, |
|
|
Storable const & |
rhs |
|
) |
| |
|
inlinestaticprotectedinherited |
Test if a Storable is of a particular class and equal to another object.
This method template simplifies implementations of equals that delegate to operator==
without supporting cross-class comparisons.
- Template Parameters
-
T | The class expected of the two objects to be compared. |
- Parameters
-
lhs,rhs | The objects to compare. Note that rhs need not be a T , while lhs must be. |
- Returns
true
if rhs
is a T
and lhs == rhs
; false
otherwise.
- Exception Safety
- Provides the same level of exception safety as
operator==
. Most implementations of operator==
do not throw.
- Note
- This method template calls
operator==
with both arguments of compile-time type T const&
. Its use is not recommended if there would be any ambiguity as to which operator==
gets picked by overload resolution.
This method template is typically called from equals as:
bool MyType::equals(Storable const& other) const noexcept {
return singleClassEquals(*this, other);
}
Definition at line 151 of file Storable.h.
152 auto typedRhs =
dynamic_cast<T const*
>(&rhs);
153 if (typedRhs !=
nullptr) {
154 return lhs == *typedRhs;
◆ toString()
std::string lsst::afw::typehandling::Storable::toString |
( |
| ) |
const |
|
virtualinherited |
◆ write()
Write the object to one or more catalogs.
The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.
Reimplemented from lsst::afw::table::io::Persistable.
Definition at line 420 of file CoaddPsf.cc.
421 CoaddPsfPersistenceHelper
const &keys1 = CoaddPsfPersistenceHelper::get();
423 PTR(afw::table::BaseRecord) record1 = cat1.addNew();
424 auto coaddWcsPtr = std::make_shared<afw::geom::SkyWcs>(_coaddWcs);
425 record1->set(keys1.coaddWcs, handle.put(coaddWcsPtr));
426 record1->set(keys1.cacheSize, _warpingControl->getCacheSize());
427 record1->set(keys1.averagePosition, _averagePosition);
428 record1->set(keys1.warpingKernelName, _warpingKernelName);
429 handle.saveCatalog(cat1);
◆ writeFits() [1/3]
void lsst::afw::table::io::Persistable::writeFits |
( |
fits::Fits & |
fitsfile | ) |
const |
|
inherited |
Write the object to an already-open FITS object.
- Parameters
-
[in] | fitsfile | Open FITS object to write to. |
Definition at line 18 of file Persistable.cc.
19 OutputArchive archive;
21 archive.writeFits(fitsfile);
◆ writeFits() [2/3]
Write the object to a FITS image in memory.
- Parameters
-
[in] | manager | Name of the file to write to. |
[in] | mode | If "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file. |
Definition at line 29 of file Persistable.cc.
◆ writeFits() [3/3]
void lsst::afw::table::io::Persistable::writeFits |
( |
std::string const & |
fileName, |
|
|
std::string const & |
mode = "w" |
|
) |
| const |
|
inherited |
Write the object to a regular FITS file.
- Parameters
-
[in] | fileName | Name of the file to write to. |
[in] | mode | If "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file. |
Definition at line 24 of file Persistable.cc.
◆ operator<<()
Output operator for Storable.
- Parameters
-
os | the desired output stream |
storable | the object to print |
- Returns
- a reference to
os
- Exceptions
-
UnsupportedOperationException | Thrown if storable does not have an implementation of Storable::toString. |
Definition at line 174 of file Storable.h.
175 return os << storable.toString();
The documentation for this class was generated from the following files:
- /j/snowflake/release/lsstsw/stack/cb4e2dc/Linux64/meas_algorithms/20.0.0-12-g321c96ea+23efe4bbff/include/lsst/meas/algorithms/CoaddPsf.h
- /j/snowflake/release/lsstsw/stack/cb4e2dc/Linux64/meas_algorithms/20.0.0-12-g321c96ea+23efe4bbff/src/CoaddPsf.cc
virtual lsst::geom::Point2D getAveragePosition() const
Return the average position of the stars used to construct the Psf.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
static Schema makeMinimalSchema()
Return a minimal schema for Exposure tables and records.
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
@ INTERNAL
An internal image will be returned without copying.
int positionToIndex(double pos)
Convert image position to nearest integer index.
afw::table::Key< int > cacheSize
#define LSST_EXCEPT_ADD(e, m)
Add the current location and a message to an existing exception before rethrowing it.
virtual std::shared_ptr< Psf > clone() const =0
Polymorphic deep-copy.
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.
afw::table::PointKey< double > averagePosition
bool isIndeterminate() const noexcept
Whether the color is the special value that indicates that it is unspecified.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
afw::table::Key< std::string > warpingKernelName
static Result computeAdaptiveMoments(ImageT const &image, geom::Point2D const &position, bool negative=false, Control const &ctrl=Control())
Compute the adaptive Gaussian-weighted moments of an image.
afw::table::Key< int > coaddWcs
geom::Box2I getOverallBBox(std::vector< boost::shared_ptr< afw::image::Image< double > >> const &imgVector)
image::Image< Pixel > Image
Image type returned by computeImage.
Base::const_iterator const_iterator
void include(Point2I const &point)
Expand this to ensure that this->contains(point).
ItemVariant const * other
void addToImage(boost::shared_ptr< afw::image::Image< double > > image, std::vector< boost::shared_ptr< afw::image::Image< double > >> const &imgVector, std::vector< double > const &weightVector)
@ COPY
The image will be copied before returning; caller will own it.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
static Result computeSincFlux(afw::image::Image< T > const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl=Control())
Compute the instFlux (and optionally, uncertanties) within an aperture using Sinc photometry.
afw::table::Key< int > coaddWcs
int getX0() const
Return the image's column-origin.
CatalogT< BaseRecord > BaseCatalog
image::Color getAverageColor() const
Return the average Color of the stars used to construct the Psf.
static std::shared_ptr< CoaddPsf > dynamicCast(std::shared_ptr< Persistable > const &ptr)
Dynamically cast a shared_ptr.
std::shared_ptr< TransformPoint2ToPoint2 > makeWcsPairTransform(SkyWcs const &src, SkyWcs const &dst)
A Transform obtained by putting two SkyWcs objects "back to back".
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.
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
std::shared_ptr< ImageT > offsetImage(ImageT const &image, float dx, float dy, std::string const &algorithmName="lanczos5", unsigned int buffer=0)
Return an image offset by (dx, dy) using the specified algorithm.
Shape const getShape() const
Return an afw::geom::ellipses object corresponding to xx, yy, xy.
An integer coordinate rectangle.
static std::shared_ptr< Image > recenterKernelImage(std::shared_ptr< Image > im, lsst::geom::Point2D const &position, std::string const &warpAlgorithm="lanczos5", unsigned int warpBuffer=5)
Helper function for Psf::doComputeImage(): converts a kernel image (centered at (0,...
void setXY0(lsst::geom::Point2I const origin)
Set the ImageBase's origin.
int getY0() const
Return the image's row-origin.
ExposureCatalogT< ExposureRecord > ExposureCatalog
int getComponentCount() const
Return the number of component Psfs in this CoaddPsf.
std::shared_ptr< Image > computeKernelImage(lsst::geom::Point2D position=makeNullPoint(), image::Color color=image::Color(), ImageOwnerEnum owner=COPY) const
Return an Image of the PSF, in a form suitable for convolution.
virtual std::shared_ptr< Image > doComputeImage(lsst::geom::Point2D const &position, image::Color const &color) const
This virtual member is protected (rather than private) so that python-implemented derived classes may...
Describe the colour of a source.