|
lsst.afw gba399f52f3+9b61cfce8e
|
A circularly symmetric Gaussian Psf class with no spatial variation, intended mostly for testing purposes. More...
#include <GaussianPsf.h>
Public Types | |
| enum | ImageOwnerEnum { COPY = 0 , INTERNAL = 1 } |
| Enum passed to computeImage and computeKernelImage to determine image ownership. More... | |
| using | Pixel = math::Kernel::Pixel |
| Pixel type of Image returned by computeImage. | |
| using | Image = image::Image<Pixel> |
| Image type returned by computeImage. | |
Public Member Functions | |
| GaussianPsf (int width, int height, double sigma) | |
| Constructor for a GaussianPsf. | |
| GaussianPsf (lsst::geom::Extent2I const &dimensions, double sigma) | |
| Constructor for a GaussianPsf. | |
| ~GaussianPsf () override | |
| GaussianPsf (GaussianPsf const &) | |
| GaussianPsf (GaussianPsf &&) | |
| GaussianPsf & | operator= (GaussianPsf const &)=delete |
| GaussianPsf & | operator= (GaussianPsf &&)=delete |
| std::shared_ptr< afw::detection::Psf > | clone () const override |
| Polymorphic deep copy; should usually be unnecessary because Psfs are immutable. | |
| std::shared_ptr< afw::detection::Psf > | resized (int width, int height) const override |
| Return a clone with specified kernel dimensions. | |
| lsst::geom::Extent2I | getDimensions () const |
| Return the dimensions of the images returned by computeImage(). | |
| double | getSigma () const |
| Return the radius of the Gaussian. | |
| bool | isPersistable () const noexcept override |
| Whether the Psf is persistable; always true. | |
| std::shared_ptr< typehandling::Storable > | cloneStorable () const override |
| Polymorphic deep-copy. | |
| std::shared_ptr< Image > | computeImage (lsst::geom::Point2D position, 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. | |
| 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. | |
| double | computePeak (lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Return the peak value of the PSF image. | |
| double | computeApertureFlux (double radius, lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Compute the "flux" of the Psf model within a circular aperture of the given radius. | |
| geom::ellipses::Quadrupole | computeShape (lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Compute the ellipse corresponding to the second moments of the Psf. | |
| std::shared_ptr< math::Kernel const > | getLocalKernel (lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Return a FixedKernel corresponding to the Psf image at the given point. | |
| image::Color | getAverageColor () const |
| Return the average Color of the stars used to construct the Psf. | |
| virtual lsst::geom::Point2D | getAveragePosition () const |
| Return the average position of the stars used to construct the Psf. | |
| lsst::geom::Box2I | computeBBox (lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Return the bounding box of the image returned by computeKernelImage(). | |
| lsst::geom::Box2I | computeImageBBox (lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Return the bounding box of the image returned by computeImage(). | |
| lsst::geom::Box2I | computeKernelBBox (lsst::geom::Point2D position, image::Color color=image::Color()) const |
| Return the bounding box of the image returned by computeImage(). | |
| std::size_t | getCacheCapacity () const |
| Return the capacity of the caches. | |
| void | setCacheCapacity (std::size_t capacity) |
| Set the capacity of the caches. | |
Static Public Member Functions | |
| static std::shared_ptr< GaussianPsf > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. | |
| static std::shared_ptr< GaussianPsf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
| Dynamically cast a shared_ptr. | |
| 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. | |
| static std::shared_ptr< Psf > | readFits (fits::Fits &fitsfile) |
| Read an object from an already open FITS object. | |
| static std::shared_ptr< Psf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
| Dynamically cast a shared_ptr. | |
Protected Member Functions | |
| std::string | getPersistenceName () const override |
| std::string | getPythonModule () const override |
| void | write (OutputArchiveHandle &handle) const override |
| virtual std::shared_ptr< Image > | doComputeImage (lsst::geom::Point2D const &position, image::Color const &color) const |
| These virtual members are protected (rather than private) so that python-implemented derived classes may opt to use the default implementations. | |
| virtual lsst::geom::Box2I | doComputeImageBBox (lsst::geom::Point2D const &position, image::Color const &color) const |
Private Member Functions | |
| std::shared_ptr< Image > | doComputeKernelImage (lsst::geom::Point2D const &position, 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. | |
| double | doComputeApertureFlux (double radius, lsst::geom::Point2D const &position, image::Color const &color) const override |
| geom::ellipses::Quadrupole | doComputeShape (lsst::geom::Point2D const &position, image::Color const &color) const override |
| lsst::geom::Box2I | doComputeBBox (lsst::geom::Point2D const &position, image::Color const &color) const override |
A circularly symmetric Gaussian Psf class with no spatial variation, intended mostly for testing purposes.
This class is essentially an alternate implementation of meas::algorithms::SingleGaussianPsf; While SingleGaussianPsf inherits from ImagePsf and KernelPsf, and hence delegates to those various operations relating to the PSF model image (e.g. computeShape()), GaussianPsf computes these analytically.
Definition at line 42 of file GaussianPsf.h.
|
inherited |
|
inherited |
|
inherited |
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. |
| lsst::afw::detection::GaussianPsf::GaussianPsf | ( | int | width, |
| int | height, | ||
| double | sigma ) |
Constructor for a GaussianPsf.
| [in] | width | Number of columns in realizations of the PSF at a point. |
| [in] | height | Number of rows in realizations of the PSF at a point. |
| [in] | sigma | Radius of the Gaussian. |
Definition at line 98 of file GaussianPsf.cc.
| lsst::afw::detection::GaussianPsf::GaussianPsf | ( | lsst::geom::Extent2I const & | dimensions, |
| double | sigma ) |
Constructor for a GaussianPsf.
| [in] | dimensions | Number of columns, rows in realizations of the PSF at a point. |
| [in] | sigma | Radius of the Gaussian. |
Definition at line 103 of file GaussianPsf.cc.
|
overridedefault |
|
default |
|
default |
|
overridevirtual |
Polymorphic deep copy; should usually be unnecessary because Psfs are immutable.
Implements lsst::afw::detection::Psf.
Definition at line 112 of file GaussianPsf.cc.
|
inlineoverrideinherited |
|
inherited |
Compute the "flux" of the Psf model within a circular aperture of the given radius.
| [in] | radius | Radius of the aperture to measure. |
| [in] | position | Position at which to evaluate the PSF. |
| [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.
|
inherited |
Return the bounding box of the image returned by computeKernelImage().
| [in] | position | Position at which to evaluate the PSF. |
| [in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
|
inherited |
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.
| [in] | position | Position at which to evaluate the PSF. |
| [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.
|
inherited |
Return the bounding box of the image returned by computeImage().
| [in] | position | Position at which to evaluate the PSF. |
| [in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
|
inlineinherited |
Return the bounding box of the image returned by computeImage().
| [in] | position | Position at which to evaluate the PSF. |
| [in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). Alias for computeBBox |
|
inherited |
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.
| [in] | position | Position at which to evaluate the PSF. |
| [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.
|
inherited |
Return the peak value of the PSF image.
| [in] | position | Position at which to evaluate the PSF. |
| [in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
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).
|
inherited |
Compute the ellipse corresponding to the second moments of the Psf.
| [in] | position | Position at which to evaluate the PSF. |
| [in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
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.
|
overrideprivatevirtual |
Implements lsst::afw::detection::Psf.
Definition at line 149 of file GaussianPsf.cc.
|
overrideprivatevirtual |
Implements lsst::afw::detection::Psf.
Definition at line 159 of file GaussianPsf.cc.
|
protectedvirtualinherited |
These virtual members are protected (rather than private) so that python-implemented derived classes may opt to use the default implementations.
C++ derived classes may override these methods, but should not call them. Derived classes should call the corresponding compute* 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.
|
protectedvirtualinherited |
|
overrideprivatevirtual |
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 134 of file GaussianPsf.cc.
|
overrideprivatevirtual |
Implements lsst::afw::detection::Psf.
Definition at line 154 of file GaussianPsf.cc.
|
staticinherited |
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;
| lsst::pex::exceptions::LogicError | if the cast fails |
param[in] ptr The pointer to be cast.
| lsst::pex::exceptions::TypeError | If the dynamic cast fails. |
Definition at line 218 of file Persistable.cc.
|
staticinherited |
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;
| lsst::pex::exceptions::LogicError | if the cast fails |
param[in] ptr The pointer to be cast.
| lsst::pex::exceptions::TypeError | If the dynamic cast fails. |
Definition at line 218 of file Persistable.cc.
|
inlineinherited |
|
virtualinherited |
|
inherited |
|
inline |
Return the dimensions of the images returned by computeImage().
Definition at line 74 of file GaussianPsf.h.
|
inherited |
Return a FixedKernel corresponding to the Psf image at the given point.
| [in] | position | Position at which to evaluate the PSF. |
| [in] | color | Color of the source for which to evaluate the PSF; defaults to getAverageColor(). |
This is implemented by calling computeKernelImage, and is simply provided for convenience.
|
overrideprotected |
Definition at line 120 of file GaussianPsf.cc.
|
overrideprotected |
Definition at line 122 of file GaussianPsf.cc.
|
inline |
Return the radius of the Gaussian.
Definition at line 77 of file GaussianPsf.h.
|
inlineoverridenoexcept |
Whether the Psf is persistable; always true.
Definition at line 80 of file GaussianPsf.h.
|
delete |
|
delete |
|
inlinestaticinherited |
Read an object from an already open FITS object.
| [in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
|
inlinestaticinherited |
Read an object from an already open FITS object.
| [in] | fitsfile | FITS object to read from, already positioned at the desired HDU. |
Definition at line 183 of file Persistable.h.
|
staticinherited |
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).
|
overridevirtual |
Return a clone with specified kernel dimensions.
Implements lsst::afw::detection::Psf.
Definition at line 116 of file GaussianPsf.cc.
|
inherited |
|
overrideprotected |
Definition at line 124 of file GaussianPsf.cc.