|
lsst.afw
14.0-22-gc76603d1b
|
A polymorphic base class for representing an image's Point Spread Function. More...
#include <Psf.h>
Public Types | |
| enum | ImageOwnerEnum { COPY = 0, INTERNAL = 1 } |
| Enum passed to computeImage and computeKernelImage to determine image ownership. More... | |
| typedef math::Kernel::Pixel | Pixel |
| Pixel type of Image returned by computeImage. More... | |
| typedef image::Image< Pixel > | Image |
| Image type returned by computeImage. More... | |
| typedef unsigned long | memId |
| typedef memId(* | memNewCallback) (const memId cid) |
| typedef memId(* | memCallback) (const Citizen *ptr) |
| typedef std::shared_ptr< Persistable > | Ptr |
Public Member Functions | |
| virtual | ~Psf () |
| virtual std::shared_ptr< Psf > | clone () const =0 |
| Polymorphic deep-copy. More... | |
| virtual std::shared_ptr< Psf > | resized (int width, int height) const =0 |
| Return clone with specified kernel dimensions. More... | |
| std::shared_ptr< Image > | computeImage (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 (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 (geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Return the peak value of the PSF image. More... | |
| double | computeApertureFlux (double radius, 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 (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 (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... | |
| virtual geom::Point2D | getAveragePosition () const |
| Return the average position of the stars used to construct the Psf. More... | |
| geom::Box2I | computeBBox (geom::Point2D position=makeNullPoint(), image::Color color=image::Color()) const |
| Return the bounding box of the image returned by computeKernelImage() More... | |
| std::string | repr () const |
| void | markPersistent (void) |
| memId | getId () const |
| void | serialize (Archive &, unsigned int const) |
| 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... | |
| virtual bool | isPersistable () const |
| Return true if this particular object can be persisted using afw::table::io. More... | |
Static Public Member Functions | |
| static std::shared_ptr< Image > | recenterKernelImage (std::shared_ptr< Image > im, 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 bool | hasBeenCorrupted () |
| static memId | getNextMemId () |
| static int | init () |
| static int | census (int, memId startingMemId=0) |
| static void | census (std::ostream &stream, memId startingMemId=0) |
| static const std::vector< const Citizen *> * | census () |
| static int | census (int, memId startingMemId=0) |
| static void | census (std::ostream &stream, memId startingMemId=0) |
| static const std::vector< const Citizen *> * | census () |
| static memId | setNewCallbackId (memId id) |
| static memId | setNewCallbackId (memId id) |
| static memId | setDeleteCallbackId (memId id) |
| static memId | setDeleteCallbackId (memId id) |
| static memNewCallback | setNewCallback (memNewCallback func) |
| static memCallback | setDeleteCallback (memCallback func) |
| static memCallback | setCorruptionCallback (memCallback func) |
| 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=INT_MIN) |
| Read an object from a regular FITS file. More... | |
| static std::shared_ptr< Psf > | readFits (fits::MemFileManager &manager, int hdu=INT_MIN) |
| Read an object from a FITS file in memory. More... | |
Public Attributes | |
| magicSentinel | |
Protected Types | |
| typedef io::OutputArchiveHandle | OutputArchiveHandle |
Protected Member Functions | |
| Psf (bool isFixed=false) | |
| Main constructor for subclasses. More... | |
| virtual std::string | getPersistenceName () const |
| Return the unique name used to persist this object and look up its factory. More... | |
| virtual std::string | getPythonModule () const |
| Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More... | |
| virtual void | write (OutputArchiveHandle &handle) const |
| Write the object to one or more catalogs. More... | |
A polymorphic base class for representing an image's Point Spread Function.
Most of a Psf's functionality involves its evaluation at a position and color, either or both of which may be unspecified (which will result in evaluation at some average position or color). Unlike the closely-related Kernel class, there is no requirement that a Psf have a well-defined spatial function or any parameters. Psfs are not necessarily continuous, and the dimensions of image of the Psf at a point may not be fixed.
Psfs have two methods for getting at image at a point:
Because P does not need to have integer coordinates, these two images are fractionally offset from each other and we use interpolation to get (1) from (2).
Psfs are immutable - derived classes should have no non-const methods, and hence should be fully-defined after construction. This allows shared_ptrs to Psfs to be passed around and shared between objects without concern for whether they will be unexpectedly modified.
In most cases, Psf derived classes should inherit from meas::algorithms::ImagePsf or meas::algorithms::KernelPsf, as these will provide default implementions for several member functions.
|
protectedinherited |
Definition at line 107 of file Persistable.h.
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. |
|
explicitprotected |
Main constructor for subclasses.
| [in] | isFixed | Should be true for Psf for which doComputeKernelImage always returns the same image, regardless of color or position arguments. |
|
pure virtual |
Polymorphic deep-copy.
Because Psfs are immutable, clones should generally be unnecessary, but they may be useful in allowing Psfs to maintain separate caches for their most recently returned images.
Implemented in lsst::afw::detection::GaussianPsf.
| double lsst::afw::detection::Psf::computeApertureFlux | ( | double | radius, |
| 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.
| [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.
| geom::Box2I lsst::afw::detection::Psf::computeBBox | ( | geom::Point2D | position = makeNullPoint(), |
| image::Color | color = image::Color() |
||
| ) | const |
Return the bounding box of the image returned by computeKernelImage()
| std::shared_ptr<Image> lsst::afw::detection::Psf::computeImage | ( | 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.
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 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.
| std::shared_ptr<Image> lsst::afw::detection::Psf::computeKernelImage | ( | 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.
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 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.
| double lsst::afw::detection::Psf::computePeak | ( | geom::Point2D | position = makeNullPoint(), |
| image::Color | color = image::Color() |
||
| ) | const |
Return the peak value of the PSF image.
| [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(). |
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).
| geom::ellipses::Quadrupole lsst::afw::detection::Psf::computeShape | ( | geom::Point2D | position = makeNullPoint(), |
| image::Color | color = image::Color() |
||
| ) | const |
Compute the ellipse corresponding to the second moments of the Psf.
| [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 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.
|
inline |
|
virtual |
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.
| std::shared_ptr<math::Kernel const> lsst::afw::detection::Psf::getLocalKernel | ( | geom::Point2D | position = makeNullPoint(), |
| image::Color | color = image::Color() |
||
| ) | const |
Return a FixedKernel corresponding to the Psf image at the given point.
This is implemented by calling computeKernelImage, and is simply provided for convenience.
|
protectedvirtualinherited |
Return the unique name used to persist this object and look up its factory.
Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.
Reimplemented in lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::LinearCombinationKernel, lsst::afw::math::DeltaFunctionKernel, lsst::afw::math::AnalyticKernel, lsst::afw::math::PolynomialFunction2< ReturnT >, lsst::afw::math::FixedKernel, lsst::afw::image::PhotoCalib, lsst::afw::math::DoubleGaussianFunction2< ReturnT >, lsst::afw::image::Wcs, lsst::afw::detection::Footprint, lsst::afw::math::GaussianFunction2< ReturnT >, lsst::afw::geom::polygon::Polygon, lsst::afw::math::ChebyshevBoundedField, lsst::afw::image::Calib, lsst::afw::image::VisitInfo, lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >, lsst::afw::math::TransformBoundedField, lsst::afw::detection::GaussianPsf, and lsst::afw::image::CoaddInputs.
|
protectedvirtualinherited |
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 in lsst::afw::math::Kernel, lsst::afw::image::Wcs, lsst::afw::detection::Footprint, lsst::afw::math::ChebyshevBoundedField, lsst::afw::math::Function< ReturnT >, lsst::afw::math::Function< Kernel::Pixel >, lsst::afw::math::TransformBoundedField, lsst::afw::detection::GaussianPsf, and lsst::afw::image::CoaddInputs.
|
inlinevirtualinherited |
Return true if this particular object can be persisted using afw::table::io.
Reimplemented in lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::LinearCombinationKernel, lsst::afw::math::DeltaFunctionKernel, lsst::afw::geom::SpanSet, lsst::afw::math::AnalyticKernel, lsst::afw::math::PolynomialFunction2< ReturnT >, lsst::afw::math::FixedKernel, lsst::afw::image::PhotoCalib, lsst::afw::math::DoubleGaussianFunction2< ReturnT >, lsst::afw::image::Wcs, lsst::afw::detection::Footprint, lsst::afw::math::GaussianFunction2< ReturnT >, lsst::afw::geom::polygon::Polygon, lsst::afw::image::Calib, lsst::afw::math::ChebyshevBoundedField, lsst::afw::image::VisitInfo, lsst::afw::image::TanWcs, lsst::afw::image::DistortedTanWcs, lsst::afw::detection::GaussianPsf, lsst::afw::image::CoaddInputs, lsst::afw::math::TransformBoundedField, and lsst::afw::image::ApCorrMap.
Definition at line 101 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 180 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 INT_MIN skips the primary HDU if it is empty. |
Definition at line 191 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 INT_MIN skips the primary HDU if it is empty. |
Definition at line 202 of file Persistable.h.
|
static |
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).
|
pure virtual |
Return clone with specified kernel dimensions.
| [in] | width | Number of columns in pixels |
| [in] | height | Number of rows in pixels |
Must be implemented by derived classes.
Implemented in lsst::afw::detection::GaussianPsf.
|
protectedvirtualinherited |
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 in lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::LinearCombinationKernel, lsst::afw::math::DeltaFunctionKernel, lsst::afw::math::AnalyticKernel, lsst::afw::math::PolynomialFunction2< ReturnT >, lsst::afw::math::FixedKernel, lsst::afw::image::PhotoCalib, lsst::afw::math::DoubleGaussianFunction2< ReturnT >, lsst::afw::detection::Footprint, lsst::afw::image::Wcs, lsst::afw::math::GaussianFunction2< ReturnT >, lsst::afw::geom::polygon::Polygon, lsst::afw::math::ChebyshevBoundedField, lsst::afw::image::Calib, lsst::afw::image::VisitInfo, lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >, lsst::afw::math::TransformBoundedField, lsst::afw::detection::GaussianPsf, and lsst::afw::image::CoaddInputs.
|
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. |
|
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. |
|
inherited |
Write the object to an already-open FITS object.
| [in] | fitsfile | Open FITS object to write to. |
1.8.13