LSST Applications g063fba187b+cac8b7c890,g0f08755f38+6aee506743,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g1a2382251a+b4475c5878,g1dcb35cd9c+8f9bc1652e,g20f6ffc8e0+6aee506743,g217e2c1bcf+73dee94bd0,g28da252d5a+1f19c529b9,g2bbee38e9b+3f2625acfc,g2bc492864f+3f2625acfc,g3156d2b45e+6e55a43351,g32e5bea42b+1bb94961c2,g347aa1857d+3f2625acfc,g35bb328faa+a8ce1bb630,g3a166c0a6a+3f2625acfc,g3e281a1b8c+c5dd892a6c,g3e8969e208+a8ce1bb630,g414038480c+5927e1bc1e,g41af890bb2+8a9e676b2a,g7af13505b9+809c143d88,g80478fca09+6ef8b1810f,g82479be7b0+f568feb641,g858d7b2824+6aee506743,g89c8672015+f4add4ffd5,g9125e01d80+a8ce1bb630,ga5288a1d22+2903d499ea,gb58c049af0+d64f4d3760,gc28159a63d+3f2625acfc,gcab2d0539d+b12535109e,gcf0d15dbbd+46a3f46ba9,gda6a2b7d83+46a3f46ba9,gdaeeff99f8+1711a396fd,ge79ae78c31+3f2625acfc,gef2f8181fd+0a71e47438,gf0baf85859+c1f95f4921,gfa517265be+6aee506743,gfa999e8aa5+17cd334064,w.2024.51
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. | |
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. | |
virtual std::string | toString () const |
Create a string representation of this object (optional operation). | |
virtual std::size_t | hash_value () const |
Return a hash of this object (optional operation). | |
virtual bool | equals (Storable const &other) const noexcept |
Compare this object to another Storable. | |
void | writeFits (std::string const &fileName, std::string const &mode="w") const |
Write the object to a regular FITS file. | |
void | writeFits (fits::MemFileManager &manager, std::string const &mode="w") const |
Write the object to a FITS image in memory. | |
void | writeFits (fits::Fits &fitsfile) const |
Write the object to an already-open FITS object. | |
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 > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
Read an object from a regular FITS file. | |
static std::shared_ptr< GaussianPsf > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
Read an object from a FITS file in memory. | |
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 > | readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU) |
Read an object from a regular FITS file. | |
static std::shared_ptr< Psf > | readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU) |
Read an object from a FITS file in memory. | |
static std::shared_ptr< Psf > | dynamicCast (std::shared_ptr< Persistable > const &ptr) |
Dynamically cast a shared_ptr. | |
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. | |
std::string | getPythonModule () const override |
Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. | |
void | write (OutputArchiveHandle &handle) const override |
Write the object to one or more catalogs. | |
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 |
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. | |
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 |
Related Symbols | |
(Note that these are not member symbols.) | |
std::ostream & | operator<< (std::ostream &os, Storable const &storable) |
Output operator for Storable. | |
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 122 of file Psf.h.
|
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 165 of file Psf.cc.
|
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 127 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 101 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 138 of file Psf.cc.
|
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 |
Definition at line 282 of file Psf.h.
|
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 114 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 158 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 171 of file Psf.cc.
|
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.
Reimplemented in lsst::meas::extensions::psfex::PsfexPsf.
Definition at line 177 of file Psf.cc.
|
protectedvirtualinherited |
Definition at line 183 of file Psf.cc.
|
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.
|
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::typehandling::StorableHelper< Base >, lsst::afw::geom::polygon::Polygon, lsst::afw::geom::SkyWcs, lsst::afw::image::PhotoCalib, and lsst::afw::image::VisitInfo.
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::algorithms::CoaddPsf, lsst::meas::algorithms::KernelPsf, lsst::meas::algorithms::WarpedPsf, and lsst::meas::extensions::psfex::PsfexPsf.
Definition at line 189 of file Psf.cc.
|
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.
Definition at line 149 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::geom::polygon::Polygon, lsst::afw::image::FilterLabel, lsst::afw::image::VisitInfo, and lsst::afw::typehandling::StorableHelper< Base >.
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::geom::polygon::Polygon, lsst::afw::geom::SkyWcs, lsst::afw::image::FilterLabel, lsst::afw::image::PhotoCalib, lsst::afw::image::VisitInfo, and lsst::afw::typehandling::StorableHelper< Base >.
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.