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
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
lsst::meas::algorithms::CoaddBoundedField Class Reference

#include <CoaddBoundedField.h>

Inheritance diagram for lsst::meas::algorithms::CoaddBoundedField:
lsst::afw::table::io::PersistableFacade< CoaddBoundedField > lsst::afw::math::BoundedField lsst::afw::table::io::PersistableFacade< BoundedField > lsst::afw::table::io::Persistable

Classes

class  Factory
 

Public Types

typedef CoaddBoundedFieldElement Element
 
typedef std::vector< ElementElementVector
 

Public Member Functions

 CoaddBoundedField (afw::geom::Box2I const &bbox, boost::shared_ptr< afw::image::Wcs const > coaddWcs, ElementVector const &elements)
 
 CoaddBoundedField (afw::geom::Box2I const &bbox, boost::shared_ptr< afw::image::Wcs const > coaddWcs, ElementVector const &elements, double default_)
 
virtual double evaluate (afw::geom::Point2D const &position) const
 
virtual bool isPersistable () const
 Return true if the CoaddBoundedField persistable (always true). More...
 
virtual boost::shared_ptr
< afw::math::BoundedField
operator* (double const scale) const
 
- Public Member Functions inherited from lsst::afw::math::BoundedField
double evaluate (double x, double y) const
 
ndarray::Array< double, 1, 1 > evaluate (ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y) const
 
geom::Box2I getBBox () const
 
template<typename T >
void fillImage (image::Image< T > &image, bool overlapOnly=false) const
 
template<typename T >
void addToImage (image::Image< T > &image, double scaleBy=1.0, bool overlapOnly=false) const
 
template<typename T >
void multiplyImage (image::Image< T > &image, bool overlapOnly=false) const
 
template<typename T >
void divideImage (image::Image< T > &image, bool overlapOnly=false) const
 
boost::shared_ptr< BoundedFieldoperator/ (double scale) const
 
virtual ~BoundedField ()
 
- 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::math::BoundedField
 BoundedField (geom::Box2I const &bbox)
 
- Protected Member Functions inherited from lsst::afw::table::io::Persistable
 Persistable ()
 
 Persistable (Persistable const &other)
 
void operator= (Persistable const &other)
 

Private Attributes

bool _throwOnMissing
 
double _default
 
boost::shared_ptr
< afw::image::Wcs const > 
_coaddWcs
 
ElementVector _elements
 

Additional Inherited Members

- Static Public Member Functions inherited from lsst::afw::table::io::PersistableFacade< CoaddBoundedField >
static boost::shared_ptr
< CoaddBoundedField > 
readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static boost::shared_ptr
< CoaddBoundedField > 
readFits (std::string const &fileName, int hdu=0)
 Read an object from a regular FITS file. More...
 
static boost::shared_ptr
< CoaddBoundedField > 
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::table::io::PersistableFacade< BoundedField >
static boost::shared_ptr
< BoundedField > 
readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static boost::shared_ptr
< BoundedField > 
readFits (std::string const &fileName, int hdu=0)
 Read an object from a regular FITS file. More...
 
static boost::shared_ptr
< BoundedField > 
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

Definition at line 50 of file CoaddBoundedField.h.

Member Typedef Documentation

Definition at line 56 of file CoaddBoundedField.h.

Definition at line 57 of file CoaddBoundedField.h.

Constructor & Destructor Documentation

lsst::meas::algorithms::CoaddBoundedField::CoaddBoundedField ( afw::geom::Box2I const &  bbox,
boost::shared_ptr< afw::image::Wcs const >  coaddWcs,
ElementVector const &  elements 
)
explicit

Definition at line 34 of file CoaddBoundedField.cc.

38  :
39  afw::math::BoundedField(bbox),
40  _throwOnMissing(true),
41  _default(0.0), // unused
43  _elements(elements)
44 {}
boost::shared_ptr< afw::image::Wcs const > _coaddWcs
tbl::Key< int > coaddWcs
lsst::meas::algorithms::CoaddBoundedField::CoaddBoundedField ( afw::geom::Box2I const &  bbox,
boost::shared_ptr< afw::image::Wcs const >  coaddWcs,
ElementVector const &  elements,
double  default_ 
)
explicit

Definition at line 46 of file CoaddBoundedField.cc.

51  :
52  afw::math::BoundedField(bbox),
53  _throwOnMissing(false),
56  _elements(elements)
57 {}
boost::shared_ptr< afw::image::Wcs const > _coaddWcs
tbl::Key< double > default_
tbl::Key< int > coaddWcs

Member Function Documentation

double lsst::meas::algorithms::CoaddBoundedField::evaluate ( afw::geom::Point2D const &  position) const
virtual

Evaluate the field at the given point.

This is the only abstract method to be implemented by subclasses.

Subclasses should not provide bounds checking on the given position; this is the responsibility of the user, who can almost always do it more efficiently.

Implements lsst::afw::math::BoundedField.

Definition at line 59 of file CoaddBoundedField.cc.

59  {
60  PTR(afw::coord::Coord) coord = _coaddWcs->pixelToSky(position);
61  double sum = 0.0;
62  double wSum = 0.0;
63  for (ElementVector::const_iterator i = _elements.begin(); i != _elements.end(); ++i) {
64  afw::geom::Point2D transformedPosition = i->wcs->skyToPixel(*coord);
65  bool inValidArea = i->validPolygon ? i->validPolygon->contains(transformedPosition) : true;
66  if (afw::geom::Box2D(i->field->getBBox()).contains(transformedPosition) && inValidArea) {
67  sum += i->weight * i->field->evaluate(transformedPosition);
68  wSum += i->weight;
69  }
70  }
71  if (wSum == 0.0) {
72  if (_throwOnMissing) {
73  throw LSST_EXCEPT(
74  pex::exceptions::DomainError,
75  (boost::format("No constituent fields to evaluate at point %f, %f")
76  % position.getX() % position.getY()).str()
77  );
78  } else {
79  return _default;
80  }
81  }
82  return sum / wSum;
83 }
lsst::afw::coord::Coord Coord
Definition: misc.h:36
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
Definition: saturated.cc:82
boost::shared_ptr< afw::image::Wcs const > _coaddWcs
#define PTR(...)
Definition: base.h:41
Point< double, 2 > Point2D
Definition: Point.h:286
boost::enable_if< typename ExpressionTraits< Scalar >::IsScalar, Scalar >::type sum(Scalar const &scalar)
Definition: operators.h:1250
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::string lsst::meas::algorithms::CoaddBoundedField::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 197 of file CoaddBoundedField.cc.

197 { return getCoaddBoundedFieldPersistenceName(); }
std::string lsst::meas::algorithms::CoaddBoundedField::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 199 of file CoaddBoundedField.cc.

199 { return "lsst.meas.algorithms"; }
virtual bool lsst::meas::algorithms::CoaddBoundedField::isPersistable ( ) const
inlinevirtual

Return true if the CoaddBoundedField persistable (always true).

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

Definition at line 78 of file CoaddBoundedField.h.

78 { return true; }
boost::shared_ptr< afw::math::BoundedField > lsst::meas::algorithms::CoaddBoundedField::operator* ( double const  scale) const
virtual

Return a scaled BoundedField

Parameters
[in]scaleScaling factor

Implements lsst::afw::math::BoundedField.

Definition at line 222 of file CoaddBoundedField.cc.

222  {
223  throw LSST_EXCEPT(pex::exceptions::NotFoundError, "Scaling of CoaddBoundedField is not implemented");
224 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
void lsst::meas::algorithms::CoaddBoundedField::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 201 of file CoaddBoundedField.cc.

201  {
202  CoaddBoundedFieldPersistenceKeys1 const & keys1 = CoaddBoundedFieldPersistenceKeys1::get();
203  CoaddBoundedFieldPersistenceKeys2 const & keys2 = CoaddBoundedFieldPersistenceKeys2::get();
204  tbl::BaseCatalog cat1 = handle.makeCatalog(keys1.schema);
205  PTR(tbl::BaseRecord) record1 = cat1.addNew();
206  record1->set(keys1.bboxMin, getBBox().getMin());
207  record1->set(keys1.bboxMax, getBBox().getMax());
208  record1->set(keys1.coaddWcs, handle.put(_coaddWcs));
209  record1->set(keys1.default_, _default);
210  handle.saveCatalog(cat1);
211  tbl::BaseCatalog cat2 = handle.makeCatalog(keys2.schema);
212  for (ElementVector::const_iterator i = _elements.begin(); i != _elements.end(); ++i) {
213  PTR(tbl::BaseRecord) record2 = cat2.addNew();
214  record2->set(keys2.field, handle.put(i->field));
215  record2->set(keys2.wcs, handle.put(i->wcs));
216  record2->set(keys2.validPolygon, handle.put(i->validPolygon));
217  record2->set(keys2.weight, i->weight);
218  }
219  handle.saveCatalog(cat2);
220 }
table::PointKey< int > bboxMax
for(FootprintList::const_iterator ptr=feet->begin(), end=feet->end();ptr!=end;++ptr)
Definition: saturated.cc:82
boost::shared_ptr< afw::image::Wcs const > _coaddWcs
tbl::Key< double > weight
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:61
afw::table::Schema schema
Definition: GaussianPsf.cc:41
#define PTR(...)
Definition: base.h:41
tbl::Key< int > wcs
geom::Box2I getBBox() const
Definition: BoundedField.h:95
tbl::Key< int > validPolygon
tbl::Key< double > default_
table::PointKey< int > bboxMin
table::Key< int > field
Definition: ApCorrMap.cc:72
tbl::Key< int > coaddWcs

Member Data Documentation

boost::shared_ptr< afw::image::Wcs const > lsst::meas::algorithms::CoaddBoundedField::_coaddWcs
private

Definition at line 100 of file CoaddBoundedField.h.

double lsst::meas::algorithms::CoaddBoundedField::_default
private

Definition at line 99 of file CoaddBoundedField.h.

ElementVector lsst::meas::algorithms::CoaddBoundedField::_elements
private

Definition at line 101 of file CoaddBoundedField.h.

bool lsst::meas::algorithms::CoaddBoundedField::_throwOnMissing
private

Definition at line 98 of file CoaddBoundedField.h.


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