LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
Classes | Public Types | Static Public Member Functions | List of all members
lsst::meas::base::SincCoeffs< PixelT > Class Template Reference

A singleton to calculate and cache the coefficients for sinc photometry. More...

#include <SincCoeffs.h>

Public Types

typedef afw::image::Image< PixelT > CoeffT
 

Static Public Member Functions

static void cache (float rInner, float rOuter)
 Cache the coefficients for a particular aperture. More...
 
static boost::shared_ptr< CoeffT const > get (afw::geom::ellipses::Axes const &outerEllipse, float const innerRadiusFactor=0.0)
 Get the coefficients for an aperture. More...
 
static boost::shared_ptr< CoeffTcalculate (afw::geom::ellipses::Axes const &outerEllipse, double const innerFactor=0.0)
 Calculate the coefficients for an aperture. More...
 

Detailed Description

template<typename PixelT>
class lsst::meas::base::SincCoeffs< PixelT >

A singleton to calculate and cache the coefficients for sinc photometry.

Caching is only performed for circular apertures (because elliptical apertures are assumed to be generated dynamically, and hence not expected to recur). Caching must be explicitly requested for a particular circular aperture (using the 'cache' method).

Definition at line 45 of file SincCoeffs.h.

Member Typedef Documentation

◆ CoeffT

template<typename PixelT>
typedef afw::image::Image<PixelT> lsst::meas::base::SincCoeffs< PixelT >::CoeffT

Definition at line 47 of file SincCoeffs.h.

Member Function Documentation

◆ cache()

template<typename PixelT >
void lsst::meas::base::SincCoeffs< PixelT >::cache ( float  rInner,
float  rOuter 
)
static

Cache the coefficients for a particular aperture.

The aperture is a circular annulus.

Definition at line 490 of file SincCoeffs.cc.

490  {
491  if (r1 < 0.0 || r2 < r1) {
492  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
493  (boost::format("Invalid r1,r2 = %f,%f") % r1 % r2).str());
494  }
495  double const innerFactor = r1 / r2;
496  afw::geom::ellipses::Axes axes(r2, r2, 0.0);
497  if (!getInstance()._lookup(axes, innerFactor)) {
498  PTR(typename SincCoeffs<PixelT>::CoeffT) coeff = calculate(axes, innerFactor);
499  coeff->markPersistent();
500  getInstance()._cache[r2][innerFactor] = coeff;
501  }
502 }
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
table::Key< table::Array< double > > coeff
Definition: PsfexPsf.cc:362
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
#define PTR(...)
Definition: base.h:41
static boost::shared_ptr< CoeffT > calculate(afw::geom::ellipses::Axes const &outerEllipse, double const innerFactor=0.0)
Calculate the coefficients for an aperture.
Definition: SincCoeffs.cc:535
afw::image::Image< PixelT > CoeffT
Definition: SincCoeffs.h:47

◆ calculate()

template<typename PixelT >
boost::shared_ptr< typename SincCoeffs< PixelT >::CoeffT > lsst::meas::base::SincCoeffs< PixelT >::calculate ( afw::geom::ellipses::Axes const &  outerEllipse,
double const  innerFactor = 0.0 
)
static

Calculate the coefficients for an aperture.

Definition at line 535 of file SincCoeffs.cc.

535  {
536  if (innerFactor < 0.0 || innerFactor > 1.0) {
537  throw LSST_EXCEPT(pex::exceptions::InvalidParameterError,
538  (boost::format("innerFactor = %f is not between 0 and 1") % innerFactor).str());
539  }
540 
541  // Kspace-real is fastest, but only slightly faster than kspace cplx
542  // but real won't work for elliptical apertures due to symmetries assumed for real transform
543 
544  double const rad1 = axes.getA() * innerFactor;
545  double const rad2 = axes.getA();
546  // if there's no angle and no ellipticity
547  if (FuzzyCompare<float>().isEqual(axes.getA(), axes.getB())) {
548  // here we call the real transform
549  return calcImageKSpaceReal<PixelT>(rad1, rad2);
550  } else {
551  // here we call the complex transform
552  double const ellipticity = 1.0 - axes.getB() / axes.getA();
553  return calcImageKSpaceCplx<PixelT>(rad1, rad2, axes.getTheta(), ellipticity);
554  }
555 }
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ get()

template<typename PixelT >
boost::shared_ptr< typename SincCoeffs< PixelT >::CoeffT const > lsst::meas::base::SincCoeffs< PixelT >::get ( afw::geom::ellipses::Axes const &  outerEllipse,
float const  innerRadiusFactor = 0.0 
)
static

Get the coefficients for an aperture.

Coefficients are retrieved from the cache, if available; otherwise they will be generated.

Definition at line 506 of file SincCoeffs.cc.

506  {
507  CONST_PTR(CoeffT) coeff = getInstance()._lookup(axes, innerFactor);
508  return coeff ? coeff : calculate(axes, innerFactor);
509 }
#define CONST_PTR(...)
A shared pointer to a const object.
Definition: base.h:47
table::Key< table::Array< double > > coeff
Definition: PsfexPsf.cc:362
static boost::shared_ptr< CoeffT > calculate(afw::geom::ellipses::Axes const &outerEllipse, double const innerFactor=0.0)
Calculate the coefficients for an aperture.
Definition: SincCoeffs.cc:535
afw::image::Image< PixelT > CoeffT
Definition: SincCoeffs.h:47

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