LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
lsst.afw.detection::GaussianPsf Class Reference

A circularly symmetric Gaussian Psf class with no spatial variation, intended mostly for testing purposes. More...

#include <GaussianPsf.h>

Inheritance diagram for lsst.afw.detection::GaussianPsf:
lsst.afw.table.io::PersistableFacade< GaussianPsf > lsst.afw.detection::Psf lsst::daf::base::Citizen lsst::daf::base::Persistable lsst.afw.table.io::PersistableFacade< Psf > lsst.afw.table.io::Persistable

Public Member Functions

 GaussianPsf (int width, int height, double sigma)
 Constructor for a GaussianPsf. More...
 
 GaussianPsf (geom::Extent2I const &dimensions, double sigma)
 Constructor for a GaussianPsf. More...
 
virtual boost::shared_ptr
< afw::detection::Psf
clone () const
 Polymorphic deep copy; should usually be unnecessary because Psfs are immutable. More...
 
geom::Extent2I getDimensions () const
 Return the dimensions of the images returned by computeImage() More...
 
double getSigma () const
 Return the radius of the Gaussian. More...
 
virtual bool isPersistable () const
 Whether the Psf is persistable; always true. More...
 
- Public Member Functions inherited from lsst.afw.detection::Psf
virtual ~Psf ()
 
boost::shared_ptr< ImagecomputeImage (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...
 
boost::shared_ptr< ImagecomputeKernelImage (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...
 
boost::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...
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (Citizen const &)
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. More...
 
- Public Member Functions inherited from lsst::daf::base::Persistable
 Persistable (void)
 
virtual ~Persistable (void)
 
template<class Archive >
void serialize (Archive &, unsigned int const)
 
- Public Member Functions inherited from lsst.afw.table.io::Persistable
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 ~Persistable ()
 

Protected Member Functions

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...
 
- Protected Member Functions inherited from lsst.afw.detection::Psf
 Psf (bool isFixed=false)
 
- Protected Member Functions inherited from lsst.afw.table.io::Persistable
 Persistable ()
 
 Persistable (Persistable const &other)
 
void operator= (Persistable const &other)
 

Private Member Functions

virtual boost::shared_ptr< ImagedoComputeKernelImage (geom::Point2D const &position, image::Color const &color) const
 
virtual double doComputeApertureFlux (double radius, geom::Point2D const &position, image::Color const &color) const
 
virtual geom::ellipses::Quadrupole doComputeShape (geom::Point2D const &position, image::Color const &color) const
 

Private Attributes

geom::Extent2I _dimensions
 
double _sigma
 

Additional Inherited Members

- Public Types inherited from lsst.afw.detection::Psf
enum  ImageOwnerEnum { COPY =0, INTERNAL =1 }
 Enum passed to computeImage and computeKernelImage to determine image ownership. More...
 
typedef boost::shared_ptr< PsfPtr
 
typedef boost::shared_ptr
< const Psf
ConstPtr
 
typedef math::Kernel::Pixel Pixel
 Pixel type of Image returned by computeImage. More...
 
typedef image::Image< PixelImage
 Image type returned by computeImage. More...
 
- Public Types inherited from lsst::daf::base::Citizen
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback )(const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback )(const Citizen *ptr)
 
- Public Types inherited from lsst::daf::base::Persistable
typedef boost::shared_ptr
< Persistable
Ptr
 
- Static Public Member Functions inherited from lsst.afw.table.io::PersistableFacade< GaussianPsf >
static boost::shared_ptr
< GaussianPsf > 
readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static boost::shared_ptr
< GaussianPsf > 
readFits (std::string const &fileName, int hdu=0)
 Read an object from a regular FITS file. More...
 
static boost::shared_ptr
< GaussianPsf > 
readFits (fits::MemFileManager &manager, int hdu=0)
 Read an object from a FITS file in memory. More...
 
- Static Public Member Functions inherited from lsst.afw.detection::Psf
static boost::shared_ptr< ImagerecenterKernelImage (boost::shared_ptr< Image > im, geom::Point2D const &position, std::string const &warpAlgorithm="lanczos5", unsigned int warpBuffer=5)
 
- Static Public Member Functions inherited from lsst::daf::base::Citizen
static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector
< const Citizen * > * 
census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. More...
 
- Static Public Member Functions inherited from lsst.afw.table.io::PersistableFacade< Psf >
static boost::shared_ptr< Psf > readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static boost::shared_ptr< Psf > readFits (std::string const &fileName, int hdu=0)
 Read an object from a regular FITS file. More...
 
static boost::shared_ptr< Psf > readFits (fits::MemFileManager &manager, int hdu=0)
 Read an object from a FITS file in memory. More...
 
- Protected Types inherited from lsst.afw.table.io::Persistable
typedef io::OutputArchiveHandle OutputArchiveHandle
 

Detailed Description

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 41 of file GaussianPsf.h.

Constructor & Destructor Documentation

lsst.afw.detection::GaussianPsf::GaussianPsf ( int  width,
int  height,
double  sigma 
)

Constructor for a GaussianPsf.

Parameters
[in]widthNumber of columns in realizations of the PSF at a point.
[in]heightNumber of rows in realizations of the PSF at a point.
[in]sigmaRadius of the Gaussian.

Definition at line 100 of file GaussianPsf.cc.

100  :
101  Psf(true), _dimensions(width, height), _sigma(sigma)
102 {
103  checkDimensions(_dimensions);
104 }
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:43
Psf(bool isFixed=false)
lsst.afw.detection::GaussianPsf::GaussianPsf ( geom::Extent2I const &  dimensions,
double  sigma 
)

Constructor for a GaussianPsf.

Parameters
[in]dimensionsNumber of columns, rows in realizations of the PSF at a point.
[in]sigmaRadius of the Gaussian.

Definition at line 106 of file GaussianPsf.cc.

106  :
108 {
109  checkDimensions(_dimensions);
110 }
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:43
afw::table::PointKey< int > dimensions
Psf(bool isFixed=false)

Member Function Documentation

boost::shared_ptr< afw::detection::Psf > lsst.afw.detection::GaussianPsf::clone ( void  ) const
virtual

Polymorphic deep copy; should usually be unnecessary because Psfs are immutable.

Implements lsst.afw.detection::Psf.

Definition at line 112 of file GaussianPsf.cc.

112  {
113  return boost::make_shared<GaussianPsf>(_dimensions, _sigma);
114 }
double lsst.afw.detection::GaussianPsf::doComputeApertureFlux ( double  radius,
geom::Point2D const &  position,
image::Color const &  color 
) const
privatevirtual

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 147 of file GaussianPsf.cc.

149  {
150  return 1.0 - std::exp(-0.5*radius*radius/(_sigma*_sigma));
151 }
boost::shared_ptr< GaussianPsf::Image > lsst.afw.detection::GaussianPsf::doComputeKernelImage ( geom::Point2D const &  position,
image::Color const &  color 
) const
privatevirtual

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 130 of file GaussianPsf.cc.

132  {
133  PTR(Image) r(new Image(_dimensions));
134  Image::Array array = r->getArray();
135  r->setXY0(geom::Point2I(-_dimensions / 2)); // integer truncation intentional
136  double sum = 0.0;
137  for (int yIndex = 0, y = r->getY0(); yIndex < _dimensions.getY(); ++yIndex, ++y) {
138  Image::Array::Reference row = array[yIndex];
139  for (int xIndex = 0, x = r->getX0(); xIndex < _dimensions.getX(); ++xIndex, ++x) {
140  sum += row[xIndex] = std::exp(-0.5*(x*x + y*y)/(_sigma*_sigma));
141  }
142  }
143  array.asEigen() /= sum;
144  return r;
145 }
int y
#define PTR(...)
Definition: base.h:41
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
Definition: saturated.cc:82
Traits::Reference Reference
Nested array or element reference.
Definition: ArrayBase.h:67
Point< int, 2 > Point2I
Definition: PSF.h:39
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
Definition: operators.h:1250
int x
int row
Definition: CR.cc:153
image::Image< Pixel > Image
Image type returned by computeImage.
Definition: Psf.h:79
geom::ellipses::Quadrupole lsst.afw.detection::GaussianPsf::doComputeShape ( geom::Point2D const &  position,
image::Color const &  color 
) const
privatevirtual

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 153 of file GaussianPsf.cc.

155  {
156  return geom::ellipses::Quadrupole(_sigma*_sigma, _sigma*_sigma, 0.0);
157 }
geom::Extent2I lsst.afw.detection::GaussianPsf::getDimensions ( ) const
inline

Return the dimensions of the images returned by computeImage()

Definition at line 65 of file GaussianPsf.h.

65 { return _dimensions; }
std::string lsst.afw.detection::GaussianPsf::getPersistenceName ( ) const
protectedvirtual

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 116 of file GaussianPsf.cc.

116 { return "GaussianPsf"; }
std::string lsst.afw.detection::GaussianPsf::getPythonModule ( ) const
protectedvirtual

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 118 of file GaussianPsf.cc.

118 { return "lsst.afw.detection"; }
double lsst.afw.detection::GaussianPsf::getSigma ( ) const
inline

Return the radius of the Gaussian.

Definition at line 68 of file GaussianPsf.h.

68 { return _sigma; }
virtual bool lsst.afw.detection::GaussianPsf::isPersistable ( ) const
inlinevirtual

Whether the Psf is persistable; always true.

Reimplemented from lsst.afw.table.io::Persistable.

Definition at line 71 of file GaussianPsf.h.

71 { return true; }
void lsst.afw.detection::GaussianPsf::write ( OutputArchiveHandle handle) const
protectedvirtual

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 120 of file GaussianPsf.cc.

120  {
121  static GaussianPsfPersistenceHelper const & keys = GaussianPsfPersistenceHelper::get();
122  afw::table::BaseCatalog catalog = handle.makeCatalog(keys.schema);
123  PTR(afw::table::BaseRecord) record = catalog.addNew();
124  (*record)[keys.dimensions.getX()] = _dimensions.getX();
125  (*record)[keys.dimensions.getY()] = _dimensions.getY();
126  (*record)[keys.sigma] = getSigma();
127  handle.saveCatalog(catalog);
128 }
#define PTR(...)
Definition: base.h:41
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:61
double getSigma() const
Return the radius of the Gaussian.
Definition: GaussianPsf.h:68
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:43
afw::table::PointKey< int > dimensions

Member Data Documentation

geom::Extent2I lsst.afw.detection::GaussianPsf::_dimensions
private

Definition at line 103 of file GaussianPsf.h.

double lsst.afw.detection::GaussianPsf::_sigma
private

Definition at line 104 of file GaussianPsf.h.


The documentation for this class was generated from the following files: