LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Attributes | List of all members
lsst::meas::algorithms::PsfAttributes Class Reference

#include <PSF.h>

Public Types

enum  Method {
  ADAPTIVE_MOMENT, FIRST_MOMENT, SECOND_MOMENT, NOISE_EQUIVALENT,
  BICKERTON
}
 

Public Member Functions

 PsfAttributes (boost::shared_ptr< lsst::afw::detection::Psf const > psf, int const iX, int const iY)
 Constructor for PsfAttributes. More...
 
 PsfAttributes (boost::shared_ptr< lsst::afw::detection::Psf const > psf, lsst::afw::geom::Point2I const &cen)
 Constructor for PsfAttributes. More...
 
double computeGaussianWidth (Method how=ADAPTIVE_MOMENT) const
 Compute the 'sigma' value for an equivalent gaussian psf. More...
 
double computeEffectiveArea () const
 Compute the effective area of the psf ( sum(I)^2/sum(I^2) ) More...
 

Private Attributes

boost::shared_ptr
< lsst::afw::image::Image
< double > > 
_psfImage
 

Detailed Description

A class to contain various attributes of the Psf

Deprecated:
This class is deprecated in favour of virtual methods on Psf

An example of the new API is:

* afwGeom::ellipses::Quadrupole shape = psf->computeShape();
* double const smoothingSigma = shape.getDeterminantRadius();
*

Definition at line 66 of file PSF.h.

Member Enumeration Documentation

Enumerator
ADAPTIVE_MOMENT 

Calculate width using adaptive Gaussian weights.

FIRST_MOMENT 

Calculate width using <r>

SECOND_MOMENT 

Calculate width using <r^2>

NOISE_EQUIVALENT 

Calculate width as sqrt(n_eff/(4 pi))

BICKERTON 

Weight <r^2> by I^2 to avoid negative fluxes.

Definition at line 68 of file PSF.h.

68  { ADAPTIVE_MOMENT,
69  FIRST_MOMENT,
72  BICKERTON
73  };
Calculate width as sqrt(n_eff/(4 pi))
Definition: PSF.h:71
Calculate width using &lt;r^2&gt;
Definition: PSF.h:70
Calculate width using &lt;r&gt;
Definition: PSF.h:69
Weight &lt;r^2&gt; by I^2 to avoid negative fluxes.
Definition: PSF.h:72
Calculate width using adaptive Gaussian weights.
Definition: PSF.h:68

Constructor & Destructor Documentation

lsst::meas::algorithms::PsfAttributes::PsfAttributes ( boost::shared_ptr< lsst::afw::detection::Psf const >  psf,
int const  iX,
int const  iY 
)

Constructor for PsfAttributes.

Parameters
psfThe psf whose attributes we want
iXthe x position in the frame we want the attributes at
iYthe y position in the frame we want the attributes at

Definition at line 58 of file PsfAttributes.cc.

63 {
64  // N.b. (iX, iY) are ints so that we know this image is centered in the central pixel of _psfImage
65  _psfImage = psf->computeImage(afwGeom::PointD(iX, iY));
66 }
boost::shared_ptr< lsst::afw::image::Image< double > > _psfImage
Definition: PSF.h:82
lsst::meas::algorithms::PsfAttributes::PsfAttributes ( boost::shared_ptr< lsst::afw::detection::Psf const >  psf,
lsst::afw::geom::Point2I const &  cen 
)

Constructor for PsfAttributes.

Parameters
psfThe psf whose attributes we want
centhe position in the frame we want the attributes at

Definition at line 71 of file PsfAttributes.cc.

74  :
75  // N.b. cen is a PointI so that we know this image is centered in the central pixel of _psfImage
76  _psfImage(psf->computeImage(afwGeom::PointD(cen)))
77 {
78 }
boost::shared_ptr< lsst::afw::image::Image< double > > _psfImage
Definition: PSF.h:82

Member Function Documentation

double lsst::meas::algorithms::PsfAttributes::computeEffectiveArea ( ) const

Compute the effective area of the psf ( sum(I)^2/sum(I^2) )

Definition at line 353 of file PsfAttributes.cc.

353  {
354 
355  double sum = 0.0;
356  double sumsqr = 0.0;
357  for (int iY = 0; iY != _psfImage->getHeight(); ++iY) {
359  for (afwImage::Image<double>::x_iterator ptr = _psfImage->row_begin(iY); ptr != end; ++ptr) {
360  sum += *ptr;
361  sumsqr += (*ptr)*(*ptr);
362  }
363  }
364  return sum*sum/sumsqr;
365 }
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
Definition: operators.h:1250
boost::shared_ptr< lsst::afw::image::Image< double > > _psfImage
Definition: PSF.h:82
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:415
double lsst::meas::algorithms::PsfAttributes::computeGaussianWidth ( PsfAttributes::Method  how = ADAPTIVE_MOMENT) const

Compute the 'sigma' value for an equivalent gaussian psf.

Definition at line 298 of file PsfAttributes.cc.

298  {
299  /*
300  * Estimate the PSF's center. This *really* needs to be rewritten to avoid using MeasureSources;
301  * we shouldn't need to instantiate source objects just to measure an adaptive centroid!
302  */
304  typedef afwImage::Exposure<double> Exposure;
305  Exposure::Ptr exposure = makeExposure(mi);
306  afwDetection::Footprint::Ptr foot = boost::make_shared<afwDetection::Footprint>(exposure->getBBox(
307  afwImage::LOCAL));
308 
309  afwGeom::Point2D center(_psfImage->getX0() + _psfImage->getWidth()/2,
310  _psfImage->getY0() + _psfImage->getHeight()/2);
311  double x(center.getX());
312  double y(center.getY());
314  double const xCen = fittedCenter.getX();
315  double const yCen = fittedCenter.getY();
316  switch (how) {
317  case ADAPTIVE_MOMENT:
318  return ::sqrt(0.5*computeSecondMomentAdaptive(_psfImage, xCen, yCen));
319  case FIRST_MOMENT:
320  return ::sqrt(2.0/afwGeom::PI)*computeFirstMoment(_psfImage, xCen, yCen);
321  case SECOND_MOMENT:
322  return ::sqrt(0.5*computeSecondMoment(_psfImage, xCen, yCen));
323  case NOISE_EQUIVALENT:
324  return ::sqrt(computeEffectiveArea()/(4*afwGeom::PI));
325  case BICKERTON:
326  {
327  double sum = 0.0;
328  double norm = 0.0;
329  for (int iY = 0; iY != _psfImage->getHeight(); ++iY) {
330  int iX = 0;
331  for (afwImage::Image<double>::x_iterator ptr = _psfImage->row_begin(iY),
332  end = _psfImage->row_end(iY); ptr != end;
333  ++ptr, ++iX) {
334  double const x = iX - xCen;
335  double const y = iY - yCen;
336  double const r = std::sqrt( x*x + y*y );
337  double const m = (*ptr)*r;
338  norm += (*ptr)*(*ptr);
339  sum += m*m;
340  }
341  }
342  return sqrt(sum/norm);
343  }
344  default:
345  abort();
346  }
347 }
int y
Calculate width as sqrt(n_eff/(4 pi))
Definition: PSF.h:71
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:67
A class to contain the data, WCS, and other information needed to describe an image of the sky...
Definition: Exposure.h:48
T norm(const T &x)
Definition: Integrate.h:191
static afw::geom::Point2D fitCentroid(afw::image::Image< PixelT > const &im, double x0, double y0)
x0, y0 is an initial guess for position, column
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
Definition: operators.h:1250
Calculate width using &lt;r^2&gt;
Definition: PSF.h:70
double const PI
The ratio of a circle&#39;s circumference to diameter.
Definition: Angle.h:18
boost::shared_ptr< lsst::afw::image::Image< double > > _psfImage
Definition: PSF.h:82
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:77
double computeEffectiveArea() const
Compute the effective area of the psf ( sum(I)^2/sum(I^2) )
Calculate width using &lt;r&gt;
Definition: PSF.h:69
double x
Weight &lt;r^2&gt; by I^2 to avoid negative fluxes.
Definition: PSF.h:72
tuple m
Definition: lsstimport.py:48
Calculate width using adaptive Gaussian weights.
Definition: PSF.h:68
Exposure< ImagePixelT, MaskPixelT, VariancePixelT >::Ptr makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, boost::shared_ptr< Wcs const > wcs=boost::shared_ptr< Wcs const >())
Definition: Exposure.h:308
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:415

Member Data Documentation

boost::shared_ptr< lsst::afw::image::Image<double> > lsst::meas::algorithms::PsfAttributes::_psfImage
private

Definition at line 82 of file PSF.h.


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