LSST Applications
21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
|
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. More... | |
using | Image = image::Image< Pixel > |
Image type returned by computeImage. More... | |
Public Member Functions | |
GaussianPsf (int width, int height, double sigma) | |
Constructor for a GaussianPsf. More... | |
GaussianPsf (lsst::geom::Extent2I const &dimensions, double sigma) | |
Constructor for a GaussianPsf. More... | |
~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. More... | |
std::shared_ptr< afw::detection::Psf > | resized (int width, int height) const override |
Return a clone with specified kernel dimensions. More... | |
lsst::geom::Extent2I | getDimensions () const |
Return the dimensions of the images returned by computeImage() More... | |
double | getSigma () const |
Return the radius of the Gaussian. More... | |
bool | isPersistable () const noexcept override |
Whether the Psf is 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, 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 > | computeImage () const |
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. More... | |
std::shared_ptr< Image > | computeKernelImage () const |
double | computePeak (lsst::geom::Point2D position, image::Color color=image::Color()) const |
Return the peak value of the PSF image. More... | |
double | computePeak () const |
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. More... | |
double | computeApertureFlux (double radius) const |
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. More... | |
geom::ellipses::Quadrupole | computeShape () const |
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. More... | |
std::shared_ptr< math::Kernel const > | getLocalKernel () const |
image::Color | getAverageColor () const |
Return the average Color of the stars used to construct the Psf. More... | |
virtual lsst::geom::Point2D | getAveragePosition () const |
Return the average position of the stars used to construct the Psf. More... | |
lsst::geom::Box2I | computeBBox (lsst::geom::Point2D position, image::Color color=image::Color()) const |
Return the bounding box of the image returned by computeKernelImage() More... | |
lsst::geom::Box2I | computeBBox () const |
lsst::geom::Box2I | computeImageBBox (lsst::geom::Point2D position, image::Color color=image::Color()) const |
Return the bounding box of the image returned by computeImage() More... | |
lsst::geom::Box2I | computeImageBBox () const |
lsst::geom::Box2I | computeKernelBBox (lsst::geom::Point2D position, image::Color color=image::Color()) const |
Return the bounding box of the image returned by computeImage() More... | |
lsst::geom::Box2I | computeKernelBBox () const |
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 Public Member Functions | |
static std::shared_ptr< GaussianPsf > | readFits (fits::Fits &fitsfile) |
Read an object from an already open FITS object. More... | |
static std::shared_ptr< GaussianPsf > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
Read an object from a regular FITS file. More... | |
static std::shared_ptr< GaussianPsf > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
Read an object from a FITS file in memory. More... | |
static std::shared_ptr< GaussianPsf > | 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... | |
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< Psf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
Dynamically cast a shared_ptr. More... | |
Protected Types | |
using | OutputArchiveHandle = io::OutputArchiveHandle |
Protected Member Functions | |
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... | |
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. More... | |
virtual lsst::geom::Box2I | doComputeImageBBox (lsst::geom::Point2D const &position, image::Color const &color) const |
Static Protected Member Functions | |
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... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &os, Storable const &storable) |
Output operator for Storable. More... | |
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 |
|
protectedinherited |
Definition at line 108 of file Persistable.h.
|
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.
|
inlineoverridevirtualinherited |
Polymorphic deep copy; should usually be unnecessary because 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.
|
inherited |
Definition at line 179 of file Psf.cc.
|
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.
Definition at line 183 of file Psf.cc.
|
inherited |
|
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(). |
Definition at line 139 of file Psf.cc.
|
inherited |
Definition at line 101 of file Psf.cc.
|
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.
Definition at line 105 of file Psf.cc.
|
inherited |
Definition at line 145 of file Psf.cc.
|
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(). |
Definition at line 149 of file Psf.cc.
|
inlineinherited |
|
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 |
Definition at line 118 of file Psf.cc.
|
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.
Definition at line 122 of file Psf.cc.
|
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).
Definition at line 172 of file Psf.cc.
|
inherited |
Definition at line 189 of file Psf.cc.
|
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.
Definition at line 193 of file Psf.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.
Definition at line 199 of file Psf.cc.
|
protectedvirtualinherited |
|
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.
|
virtualnoexceptinherited |
Compare this object to another Storable.
Subclasses that implement equality comparison must override this method to give results consistent with operator==
for all inputs that are accepted by both.
false
. If cross-class comparisons are valid, implementers should take care that they are symmetric and will give the same result no matter what the compile-time types of the left- and right-hand sides are.__eq__
if it exists. Reimplemented in lsst::afw::image::VisitInfo, lsst::afw::image::PhotoCalib, lsst::afw::geom::SkyWcs, lsst::afw::geom::polygon::Polygon, and lsst::afw::typehandling::StorableHelper< Base >.
Definition at line 48 of file Storable.cc.
|
inlineinherited |
|
virtualinherited |
Return the average position of the stars used to construct the Psf.
This is also the position used to return an image if you don't specify a position.
Reimplemented in lsst::meas::extensions::psfex::PsfexPsf, lsst::meas::algorithms::WarpedPsf, lsst::meas::algorithms::KernelPsf, and lsst::meas::algorithms::CoaddPsf.
Definition at line 211 of file Psf.cc.
|
inherited |
|
inline |
Return the dimensions of the images returned by computeImage()
Definition at line 74 of file GaussianPsf.h.
|
inherited |
Definition at line 155 of file Psf.cc.
|
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.
Definition at line 159 of file Psf.cc.
|
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 120 of file GaussianPsf.cc.
|
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 122 of file GaussianPsf.cc.
|
inline |
Return the radius of the Gaussian.
Definition at line 77 of file GaussianPsf.h.
|
virtualinherited |
Return a hash of this object (optional operation).
UnsupportedOperationException | Thrown if this object is not hashable. |
__hash__
if it exists. Reimplemented in lsst::afw::typehandling::StorableHelper< Base >, lsst::afw::image::VisitInfo, lsst::afw::image::FilterLabel, and lsst::afw::geom::polygon::Polygon.
Definition at line 44 of file Storable.cc.
|
inlineoverridevirtualnoexcept |
Whether the Psf is persistable; always true.
Reimplemented from lsst::afw::table::io::Persistable.
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.
|
inlinestaticinherited |
Read an object from a FITS file in memory.
[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.
|
inlinestaticinherited |
Read an object from a FITS file in memory.
[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.
|
inlinestaticinherited |
Read an object from a regular FITS file.
[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.
|
inlinestaticinherited |
Read an object from a regular FITS file.
[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.
|
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).
Definition at line 85 of file Psf.cc.
|
overridevirtual |
Return a clone with specified kernel dimensions.
Implements lsst::afw::detection::Psf.
Definition at line 116 of file GaussianPsf.cc.
|
inherited |
|
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.
T | The class expected of the two objects to be compared. |
lhs,rhs | The objects to compare. Note that rhs need not be a T , while lhs must be. |
true
if rhs
is a T
and lhs == rhs
; false
otherwise.operator==
. Most implementations of operator==
do not throw.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.
|
virtualinherited |
Create a string representation of this object (optional operation).
UnsupportedOperationException | Thrown if this object does not have a string representation. |
__repr__
. Reimplemented in lsst::afw::typehandling::StorableHelper< Base >, lsst::afw::image::VisitInfo, lsst::afw::image::PhotoCalib, lsst::afw::image::FilterLabel, lsst::afw::geom::SkyWcs, and lsst::afw::geom::polygon::Polygon.
Definition at line 40 of file Storable.cc.
|
overrideprotectedvirtual |
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 124 of file GaussianPsf.cc.
|
inherited |
Write the object to an already-open FITS object.
[in] | fitsfile | Open FITS object to write to. |
Definition at line 18 of file Persistable.cc.
|
inherited |
Write the object to a FITS image in memory.
[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.
|
inherited |
Write the object to a regular FITS file.
[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.
|
related |
Output operator for Storable.
os | the desired output stream |
storable | the object to print |
os
UnsupportedOperationException | Thrown if storable does not have an implementation of Storable::toString. |
Definition at line 174 of file Storable.h.