LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
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 57 of file PsfAttributes.cc.

62 {
63  // N.b. (iX, iY) are ints so that we know this image is centered in the central pixel of _psfImage
64  _psfImage = psf->computeImage(afwGeom::PointD(iX, iY));
65 }
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 70 of file PsfAttributes.cc.

73  :
74  // N.b. cen is a PointI so that we know this image is centered in the central pixel of _psfImage
75  _psfImage(psf->computeImage(afwGeom::PointD(cen)))
76 {
77 }
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 360 of file PsfAttributes.cc.

360  {
361 
362  double sum = 0.0;
363  double sumsqr = 0.0;
364  for (int iY = 0; iY != _psfImage->getHeight(); ++iY) {
366  for (afwImage::Image<double>::x_iterator ptr = _psfImage->row_begin(iY); ptr != end; ++ptr) {
367  sum += *ptr;
368  sumsqr += (*ptr)*(*ptr);
369  }
370  }
371  return sum*sum/sumsqr;
372 }
boost::shared_ptr< lsst::afw::image::Image< double > > _psfImage
Definition: PSF.h:82
double sum
Definition: NaiveFlux.cc:137
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 297 of file PsfAttributes.cc.

297  {
298  /*
299  * Estimate the PSF's center. This *really* needs to be rewritten to avoid using MeasureSources;
300  * we shouldn't need to instantiate source objects just to measure an adaptive centroid!
301  */
303  typedef afwImage::Exposure<double> Exposure;
304  Exposure::Ptr exposure = makeExposure(mi);
305 
306  afwDetection::Footprint::Ptr foot = boost::make_shared<afwDetection::Footprint>(exposure->getBBox(
307  afwImage::LOCAL));
308 
309  GaussianCentroidControl ctrl;
310  afwGeom::Point2D center(_psfImage->getX0() + _psfImage->getWidth()/2,
311  _psfImage->getY0() + _psfImage->getHeight()/2);
312  afw::table::Schema schema = afw::table::SourceTable::makeMinimalSchema();
313  MeasureSources ms = MeasureSourcesBuilder().addAlgorithm(ctrl).build(schema);
314  PTR(afw::table::SourceTable) table = afw::table::SourceTable::make(schema);
315  PTR(afw::table::SourceRecord) source = table->makeRecord();
316  source->setFootprint(foot);
317  ms.apply(*source, *exposure, center);
318  afw::table::Centroid::MeasKey key = table->getSchema()[ctrl.name];
319  afw::table::Centroid::MeasValue centroid = source->get(key);
320  float const xCen = centroid.getX() - _psfImage->getX0();
321  float const yCen = centroid.getY() - _psfImage->getY0();
322 
323  switch (how) {
324  case ADAPTIVE_MOMENT:
325  return ::sqrt(0.5*computeSecondMomentAdaptive(_psfImage, xCen, yCen));
326  case FIRST_MOMENT:
327  return ::sqrt(2.0/afwGeom::PI)*computeFirstMoment(_psfImage, xCen, yCen);
328  case SECOND_MOMENT:
329  return ::sqrt(0.5*computeSecondMoment(_psfImage, xCen, yCen));
330  case NOISE_EQUIVALENT:
331  return ::sqrt(computeEffectiveArea()/(4*afwGeom::PI));
332  case BICKERTON:
333  {
334  double sum = 0.0;
335  double norm = 0.0;
336  for (int iY = 0; iY != _psfImage->getHeight(); ++iY) {
337  int iX = 0;
338  for (afwImage::Image<double>::x_iterator ptr = _psfImage->row_begin(iY),
339  end = _psfImage->row_end(iY); ptr != end;
340  ++ptr, ++iX) {
341  double const x = iX - xCen;
342  double const y = iY - yCen;
343  double const r = std::sqrt( x*x + y*y );
344  double const m = (*ptr)*r;
345  norm += (*ptr)*(*ptr);
346  sum += m*m;
347  }
348  }
349  return sqrt(sum/norm);
350  }
351  default:
352  abort();
353  }
354 }
Calculate width as sqrt(n_eff/(4 pi))
Definition: PSF.h:71
#define PTR(...)
Definition: base.h:41
boost::shared_ptr< Footprint > Ptr
Definition: Footprint.h:78
int y
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
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
tbl::Schema schema
Definition: CoaddPsf.cc:324
boost::shared_ptr< lsst::afw::image::Image< double > > _psfImage
Definition: PSF.h:82
int x
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
static Schema makeMinimalSchema()
Return a minimal schema for Source tables and records.
Definition: Source.h:233
double sum
Definition: NaiveFlux.cc:137
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
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
afw::geom::Point< CentroidElement, 2 > Centroid
Definition: constants.h:54
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: