LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Related Functions | List of all members
lsst::meas::algorithms::ImagePsfTrampoline< Base > Class Template Reference

"Trampoline" for ImagePsf to let it be used as a base class in Python. More...

#include <python.h>

Inheritance diagram for lsst::meas::algorithms::ImagePsfTrampoline< Base >:
lsst::afw::detection::PsfTrampoline< Base > lsst::afw::typehandling::StorableHelper< Base > lsst::afw::typehandling::Storable lsst::afw::table::io::Persistable

Public Types

using Image = typename Base::Image
 

Public Member Functions

template<typename... Args>
 ImagePsfTrampoline (Args... args)
 Delegating constructor for wrapped class. More...
 
double doComputeApertureFlux (double radius, geom::Point2D const &position, afw::image::Color const &color) const override
 
afw::geom::ellipses::Quadrupole doComputeShape (geom::Point2D const &position, afw::image::Color const &color) const override
 
std::shared_ptr< Psf > clone () const override
 
std::shared_ptr< Psf > resized (int width, int height) const override
 
lsst::geom::Point2D getAveragePosition () const override
 
std::shared_ptr< ImagedoComputeImage (lsst::geom::Point2D const &position, image::Color const &color) const override
 
std::shared_ptr< ImagedoComputeKernelImage (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
 
std::shared_ptr< Storable > cloneStorable () const override
 Create a new object that is a copy of this one (optional operation). More...
 
std::string toString () const override
 Create a string representation of this object (optional operation). More...
 
std::size_t hash_value () const override
 Return a hash of this object (optional operation). More...
 
bool equals (Storable const &other) const noexcept override
 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...
 
virtual bool isPersistable () const noexcept
 Return true if this particular object can be persisted using afw::table::io. More...
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

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...
 

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::ostreamoperator<< (std::ostream &os, Storable const &storable)
 Output operator for Storable. More...
 

Detailed Description

template<typename Base = ImagePsf>
class lsst::meas::algorithms::ImagePsfTrampoline< Base >

"Trampoline" for ImagePsf to let it be used as a base class in Python.

Subclasses of ImagePsf that are wrapped in pybind11 should have a similar helper that subclasses ImagePsfTrampoline<subclass>. This helper can be skipped if the subclass neither adds any virtual methods nor implements any abstract methods.

Template Parameters
Basethe exact (most specific) class being wrapped
See also
pybind11 documentation

Definition at line 52 of file python.h.

Member Typedef Documentation

◆ Image

template<typename Base = Psf>
using lsst::afw::detection::PsfTrampoline< Base >::Image = typename Base::Image
inherited

Definition at line 52 of file python.h.

◆ OutputArchiveHandle

typedef io::OutputArchiveHandle lsst::afw::table::io::Persistable::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

Constructor & Destructor Documentation

◆ ImagePsfTrampoline()

template<typename Base = ImagePsf>
template<typename... Args>
lsst::meas::algorithms::ImagePsfTrampoline< Base >::ImagePsfTrampoline ( Args...  args)
inline

Delegating constructor for wrapped class.

While we would like to simply inherit base class constructors, when doing so, we cannot change their access specifiers. One consequence is that it's not possible to use inheritance to expose a protected constructor to python. The alternative, used here, is to create a new public constructor that delegates to the base class public or protected constructor with the same signature.

Template Parameters
ArgsVariadic type specification
Parameters
...argsArguments to forward to the Base class constructor.

Definition at line 1 of file python.h.

Member Function Documentation

◆ clone()

template<typename Base = Psf>
std::shared_ptr<Psf> lsst::afw::detection::PsfTrampoline< Base >::clone ( ) const
inlineoverrideinherited

Definition at line 69 of file python.h.

69  {
70  /* __deepcopy__ takes an optional dict, but PYBIND11_OVERLOAD_* won't
71  * compile unless you give it arguments that work for the C++ method
72  */
73  PYBIND11_OVERLOAD_PURE_NAME(std::shared_ptr<Psf>, Base, "__deepcopy__", clone,);
74  }

◆ cloneStorable()

template<class Base = Storable>
std::shared_ptr<Storable> lsst::afw::typehandling::StorableHelper< Base >::cloneStorable ( ) const
inlineoverridevirtualinherited

Create a new object that is a copy of this one (optional operation).

This operation is required for Storables that are stored in GenericMap by value, but not for those stored by shared pointer.

Exceptions
UnsupportedOperationExceptionThrown if this object is not cloneable.
Note
If this class supports a clone operation, the two should behave identically except for the formal return type.
When called on Python classes, this method delegates to __deepcopy__ if it exists.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 69 of file python.h.

69  {
70  /* __deepcopy__ takes an optional dict, but PYBIND11_OVERLOAD_* won't
71  * compile unless you give it arguments that work for the C++ method
72  */
73  PYBIND11_OVERLOAD_NAME(std::shared_ptr<Storable>, Base, "__deepcopy__", cloneStorable, );
74  }

◆ doComputeApertureFlux()

template<typename Base = ImagePsf>
double lsst::meas::algorithms::ImagePsfTrampoline< Base >::doComputeApertureFlux ( double  radius,
geom::Point2D const &  position,
afw::image::Color const &  color 
) const
inlineoverride

Definition at line 69 of file python.h.

72  {
73  PYBIND11_OVERLOAD_NAME(
74  double, Base, "_doComputeApertureFlux", doComputeApertureFlux, radius, position, color
75  );
76  }

◆ doComputeBBox()

template<typename Base = Psf>
lsst::geom::Box2I lsst::afw::detection::PsfTrampoline< Base >::doComputeBBox ( lsst::geom::Point2D const &  position,
image::Color const &  color 
) const
inlineoverrideinherited

Definition at line 121 of file python.h.

124  {
125  PYBIND11_OVERLOAD_PURE_NAME(
126  lsst::geom::Box2I, Base, "_doComputeBBox", doComputeBBox, position, color
127  );
128  }

◆ doComputeImage()

template<typename Base = Psf>
std::shared_ptr<Image> lsst::afw::detection::PsfTrampoline< Base >::doComputeImage ( lsst::geom::Point2D const &  position,
image::Color const &  color 
) const
inlineoverrideinherited

Definition at line 85 of file python.h.

88  {
89  PYBIND11_OVERLOAD_NAME(
90  std::shared_ptr<Image>, Base, "_doComputeImage", doComputeImage, position, color
91  );
92  }

◆ doComputeKernelImage()

template<typename Base = Psf>
std::shared_ptr<Image> lsst::afw::detection::PsfTrampoline< Base >::doComputeKernelImage ( lsst::geom::Point2D const &  position,
image::Color const &  color 
) const
inlineoverrideinherited

Definition at line 94 of file python.h.

97  {
98  PYBIND11_OVERLOAD_PURE_NAME(
99  std::shared_ptr<Image>, Base, "_doComputeKernelImage", doComputeKernelImage, position, color
100  );
101  }

◆ doComputeShape()

template<typename Base = ImagePsf>
afw::geom::ellipses::Quadrupole lsst::meas::algorithms::ImagePsfTrampoline< Base >::doComputeShape ( geom::Point2D const &  position,
afw::image::Color const &  color 
) const
inlineoverride

Definition at line 78 of file python.h.

81  {
82  PYBIND11_OVERLOAD_NAME(
83  afw::geom::ellipses::Quadrupole, Base, "_doComputeShape", doComputeShape, position, color
84  );
85  }

◆ equals()

template<class Base = Storable>
bool lsst::afw::typehandling::StorableHelper< Base >::equals ( Storable const &  other) const
inlineoverridevirtualnoexceptinherited

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.

Returns
This implementation returns whether the two objects are the same.
Warning
This method compares an object to any type of Storable, although cross-class comparisons should usually return 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.
See also
singleClassEquals
Note
When called on Python classes, this method delegates to __eq__ if it exists.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 84 of file python.h.

84  {
85  PYBIND11_OVERLOAD_NAME(bool, Base, "__eq__", equals, other);
86  }

◆ getAveragePosition()

template<typename Base = Psf>
lsst::geom::Point2D lsst::afw::detection::PsfTrampoline< Base >::getAveragePosition ( ) const
inlineoverrideinherited

Definition at line 80 of file python.h.

80  {
81  PYBIND11_OVERLOAD(lsst::geom::Point2D, Base, getAveragePosition,);
82  }

◆ getPersistenceName()

std::string lsst::afw::table::io::Persistable::getPersistenceName ( ) const
protectedvirtualinherited

◆ getPythonModule()

std::string lsst::afw::table::io::Persistable::getPythonModule ( ) const
protectedvirtualinherited

◆ hash_value()

template<class Base = Storable>
std::size_t lsst::afw::typehandling::StorableHelper< Base >::hash_value ( ) const
inlineoverridevirtualinherited

Return a hash of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object is not hashable.
Note
C++ subclass authors are responsible for any associated specializations of std::hash.
When called on Python classes, this method delegates to __hash__ if it exists.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 80 of file python.h.

80  {
81  PYBIND11_OVERLOAD_NAME(std::size_t, Base, "__hash__", hash_value, );
82  }

◆ isPersistable()

virtual bool lsst::afw::table::io::Persistable::isPersistable ( ) const
inlinevirtualnoexceptinherited

◆ resized()

template<typename Base = Psf>
std::shared_ptr<Psf> lsst::afw::detection::PsfTrampoline< Base >::resized ( int  width,
int  height 
) const
inlineoverrideinherited

Definition at line 76 of file python.h.

76  {
77  PYBIND11_OVERLOAD_PURE(std::shared_ptr<Psf>, Base, resized, width, height);
78  }

◆ singleClassEquals()

template<class T >
static bool lsst::afw::typehandling::Storable::singleClassEquals ( T const &  lhs,
Storable const &  rhs 
)
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.

Template Parameters
TThe class expected of the two objects to be compared.
Parameters
lhs,rhsThe objects to compare. Note that rhs need not be a T, while lhs must be.
Returns
true if rhs is a T and lhs == rhs; false otherwise.
Exception Safety
Provides the same level of exception safety as operator==. Most implementations of operator== do not throw.
Note
This method template calls 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.

151  {
152  auto typedRhs = dynamic_cast<T const*>(&rhs);
153  if (typedRhs != nullptr) {
154  return lhs == *typedRhs;
155  } else {
156  return false;
157  }
158  }

◆ toString()

template<class Base = Storable>
std::string lsst::afw::typehandling::StorableHelper< Base >::toString ( ) const
inlineoverridevirtualinherited

Create a string representation of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object does not have a string representation.
Note
When called on Python classes, this method delegates to __repr__.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 76 of file python.h.

76  {
77  PYBIND11_OVERLOAD_NAME(std::string, Base, "__repr__", toString, );
78  }

◆ write()

void lsst::afw::table::io::Persistable::write ( OutputArchiveHandle handle) const
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::image::FilterLabel, lsst::afw::math::LinearCombinationKernel, lsst::afw::math::DeltaFunctionKernel, lsst::afw::math::AnalyticKernel, lsst::afw::math::FixedKernel, lsst::afw::image::PhotoCalib, lsst::afw::geom::SkyWcs, lsst::meas::modelfit::Mixture, lsst::afw::detection::Footprint, lsst::afw::geom::Transform< FromEndpoint, ToEndpoint >, lsst::afw::geom::Transform< afw::geom::Point2Endpoint, afw::geom::GenericEndpoint >, lsst::afw::geom::polygon::Polygon, lsst::afw::image::Filter, lsst::afw::math::ChebyshevBoundedField, lsst::afw::image::VisitInfo, lsst::meas::algorithms::CoaddPsf, lsst::afw::cameraGeom::DetectorCollection, lsst::afw::cameraGeom::Camera, lsst::afw::detection::HeavyFootprint< ImagePixelT, MaskPixelT, VariancePixelT >, lsst::meas::algorithms::CoaddBoundedField, lsst::afw::math::PixelAreaBoundedField, lsst::afw::image::CoaddInputs, lsst::afw::detection::GaussianPsf, lsst::afw::math::TransformBoundedField, lsst::afw::math::ProductBoundedField, lsst::meas::algorithms::KernelPsf, lsst::meas::algorithms::DoubleGaussianPsf, lsst::meas::algorithms::SingleGaussianPsf, lsst::meas::extensions::psfex::PsfexPsf, lsst::afw::math::Chebyshev1Function2< ReturnT >, lsst::afw::math::PolynomialFunction2< ReturnT >, lsst::afw::math::DoubleGaussianFunction2< ReturnT >, and lsst::afw::math::GaussianFunction2< ReturnT >.

Definition at line 38 of file Persistable.cc.

38  {
39  assert(!isPersistable());
40  throw LSST_EXCEPT(pex::exceptions::LogicError,
41  "afw::table-based persistence is not supported for this object.");
42 }

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.

18  {
19  OutputArchive archive;
20  archive.put(this);
21  archive.writeFits(fitsfile);
22 }

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager manager,
std::string const &  mode = "w" 
) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "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.

29  {
30  fits::Fits fitsfile(manager, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
31  writeFits(fitsfile);
32 }

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const &  fileName,
std::string const &  mode = "w" 
) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "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.

24  {
25  fits::Fits fitsfile(fileName, mode, fits::Fits::AUTO_CLOSE | fits::Fits::AUTO_CHECK);
26  writeFits(fitsfile);
27 }

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream os,
Storable const &  storable 
)
related

Output operator for Storable.

Parameters
osthe desired output stream
storablethe object to print
Returns
a reference to os
Exceptions
UnsupportedOperationExceptionThrown if storable does not have an implementation of Storable::toString.

Definition at line 174 of file Storable.h.

174  {
175  return os << storable.toString();
176 }

The documentation for this class was generated from the following file:
lsst::afw::table::io::Persistable::writeFits
void writeFits(std::string const &fileName, std::string const &mode="w") const
Write the object to a regular FITS file.
Definition: Persistable.cc:24
std::string
STL class.
std::shared_ptr
STL class.
lsst::meas::algorithms.psfSelectionFromMatchList.args
list args
Definition: psfSelectionFromMatchList.py:27
lsst::afw::typehandling::StorableHelper::equals
bool equals(Storable const &other) const noexcept override
Compare this object to another Storable.
Definition: python.h:84
lsst::afw::typehandling::StorableHelper::hash_value
std::size_t hash_value() const override
Return a hash of this object (optional operation).
Definition: python.h:80
lsst::afw::detection::PsfTrampoline::doComputeBBox
lsst::geom::Box2I doComputeBBox(lsst::geom::Point2D const &position, image::Color const &color) const override
Definition: python.h:121
lsst::afw::detection::PsfTrampoline::doComputeKernelImage
std::shared_ptr< Image > doComputeKernelImage(lsst::geom::Point2D const &position, image::Color const &color) const override
Definition: python.h:94
lsst.pipe.tasks.processCcdWithFakes.radius
radius
Definition: processCcdWithFakes.py:345
lsst::afw::typehandling::StorableHelper::toString
std::string toString() const override
Create a string representation of this object (optional operation).
Definition: python.h:76
lsst::afw::table::io::Persistable::isPersistable
virtual bool isPersistable() const noexcept
Return true if this particular object can be persisted using afw::table::io.
Definition: Persistable.h:102
lsst::afw::detection::PsfTrampoline::getAveragePosition
lsst::geom::Point2D getAveragePosition() const override
Definition: python.h:80
lsst::meas::algorithms::ImagePsfTrampoline::doComputeShape
afw::geom::ellipses::Quadrupole doComputeShape(geom::Point2D const &position, afw::image::Color const &color) const override
Definition: python.h:78
lsst::afw::fits::Fits::AUTO_CHECK
@ AUTO_CHECK
Definition: fits.h:308
lsst::afw::typehandling::StorableHelper::cloneStorable
std::shared_ptr< Storable > cloneStorable() const override
Create a new object that is a copy of this one (optional operation).
Definition: python.h:69
lsst::afw::fits::Fits::AUTO_CLOSE
@ AUTO_CLOSE
Definition: fits.h:307
other
ItemVariant const * other
Definition: Schema.cc:56
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
lsst::afw::detection::PsfTrampoline::clone
std::shared_ptr< Psf > clone() const override
Definition: python.h:69
os
std::ostream * os
Definition: Schema.cc:746
lsst::geom::Point< double, 2 >
lsst::afw::detection::PsfTrampoline
"Trampoline" for Psf to let it be used as a base class in Python.
Definition: python.h:50
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
std::size_t
lsst::afw::detection::PsfTrampoline::doComputeImage
std::shared_ptr< Image > doComputeImage(lsst::geom::Point2D const &position, image::Color const &color) const override
Definition: python.h:85
lsst::meas::algorithms::ImagePsfTrampoline::doComputeApertureFlux
double doComputeApertureFlux(double radius, geom::Point2D const &position, afw::image::Color const &color) const override
Definition: python.h:69
lsst::afw::detection::PsfTrampoline::resized
std::shared_ptr< Psf > resized(int width, int height) const override
Definition: python.h:76