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 Member Functions | Static Public Member Functions | Private Attributes | List of all members
lsst::meas::base::SdssShapeResultKey Class Reference

A FunctorKey that maps SdssShapeResult to afw::table Records. More...

#include <SdssShape.h>

Inheritance diagram for lsst::meas::base::SdssShapeResultKey:
lsst::afw::table::FunctorKey< SdssShapeResult > lsst::afw::table::OutputFunctorKey< SdssShapeResult > lsst::afw::table::InputFunctorKey< SdssShapeResult >

Public Member Functions

 SdssShapeResultKey ()
 Default constructor; instance will not be usuable unless subsequently assigned to. More...
 
 SdssShapeResultKey (afw::table::SubSchema const &s)
 Construct from a subschema, assuming _xx, _yy, etc. subfields. More...
 
virtual SdssShapeResult get (afw::table::BaseRecord const &record) const
 Get a CentroidResult from the given record. More...
 
virtual void set (afw::table::BaseRecord &record, SdssShapeResult const &value) const
 Set a CentroidResult in the given record. More...
 
bool isValid () const
 Return True if the key is valid. More...
 
FlagHandler const & getFlagHandler () const
 
bool operator== (SdssShapeResultKey const &other) const
 Compare the FunctorKey for equality with another, using the underlying Keys. More...
 
bool operator!= (SdssShapeResultKey const &other) const
 Compare the FunctorKey for equality with another, using the underlying Keys. More...
 
- Public Member Functions inherited from lsst::afw::table::OutputFunctorKey< SdssShapeResult >
virtual ~OutputFunctorKey ()
 
- Public Member Functions inherited from lsst::afw::table::InputFunctorKey< SdssShapeResult >
virtual void set (BaseRecord &record, SdssShapeResultconst &value) const =0
 
virtual ~InputFunctorKey ()
 

Static Public Member Functions

static SdssShapeResultKey addFields (afw::table::Schema &schema, std::string const &name)
 Add the appropriate fields to a Schema, and return a SdssShapeResultKey that manages them. More...
 

Private Attributes

ShapeResultKey _shapeResult
 
CentroidResultKey _centroidResult
 
FluxResultKey _fluxResult
 
afw::table::Key< ErrElement_flux_xx_Cov
 
afw::table::Key< ErrElement_flux_yy_Cov
 
afw::table::Key< ErrElement_flux_xy_Cov
 
FlagHandler _flagHandler
 

Detailed Description

A FunctorKey that maps SdssShapeResult to afw::table Records.

This is used internally by SdssShapeAlgorithm to transfer results from SdssShapeResult to SourceRecord, but it can also be used in the other direction by codes that need to extra an SdssShapeResult from a record.

Definition at line 66 of file SdssShape.h.

Constructor & Destructor Documentation

lsst::meas::base::SdssShapeResultKey::SdssShapeResultKey ( )
inline

Default constructor; instance will not be usuable unless subsequently assigned to.

Definition at line 82 of file SdssShape.h.

82 {}
lsst::meas::base::SdssShapeResultKey::SdssShapeResultKey ( afw::table::SubSchema const &  s)

Construct from a subschema, assuming _xx, _yy, etc. subfields.

If a schema has "a_xx", "a_yy", etc. fields, this constructor allows you to construct a SdssShapeResultKey via:

Definition at line 686 of file SdssShape.cc.

686  :
687  _shapeResult(s),
688  _centroidResult(s),
689  _fluxResult(s),
690  _flux_xx_Cov(s["flux"]["xx"]["Cov"]),
691  _flux_yy_Cov(s["flux"]["yy"]["Cov"]),
692  _flux_xy_Cov(s["flux"]["xy"]["Cov"]),
693  _flagHandler(s, flagDefs.begin(), flagDefs.end())
694 {}
afw::table::Key< ErrElement > _flux_yy_Cov
Definition: SdssShape.h:117
afw::table::Key< ErrElement > _flux_xy_Cov
Definition: SdssShape.h:118
afw::table::Key< ErrElement > _flux_xx_Cov
Definition: SdssShape.h:116

Member Function Documentation

SdssShapeResultKey lsst::meas::base::SdssShapeResultKey::addFields ( afw::table::Schema schema,
std::string const &  name 
)
static

Add the appropriate fields to a Schema, and return a SdssShapeResultKey that manages them.

Parameters
[in,out]schemaSchema to add fields to.
[in]nameName prefix for all fields; "_xx", "_yy", etc. will be appended to this to form the full field names.

Definition at line 654 of file SdssShape.cc.

657  {
659  r._shapeResult = ShapeResultKey::addFields(schema, name, "elliptical Gaussian adaptive moments",
660  SIGMA_ONLY);
661  r._centroidResult = CentroidResultKey::addFields(schema, name, "elliptical Gaussian adaptive moments",
663  r._fluxResult = FluxResultKey::addFields(schema, name, "elliptical Gaussian adaptive moments");
664  r._flux_xx_Cov = schema.addField<ErrElement>(
665  schema.join(name, "flux", "xx", "Cov"),
666  (boost::format("uncertainty covariance between %s and %s")
667  % schema.join(name, "flux") % schema.join(name, "xx")).str(),
668  "dn*pixels^2"
669  );
670  r._flux_yy_Cov = schema.addField<ErrElement>(
671  schema.join(name, "flux", "yy", "Cov"),
672  (boost::format("uncertainty covariance between %s and %s")
673  % schema.join(name, "flux") % schema.join(name, "yy")).str(),
674  "dn*pixels^2"
675  );
676  r._flux_xy_Cov = schema.addField<ErrElement>(
677  schema.join(name, "flux", "xy", "Cov"),
678  (boost::format("uncertainty covariance between %s and %s")
679  % schema.join(name, "flux") % schema.join(name, "xy")).str(),
680  "dn*pixels^2"
681  );
682  r._flagHandler = FlagHandler::addFields(schema, name, flagDefs.begin(), flagDefs.end());
683  return r;
684 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
afw::table::Schema schema
Definition: GaussianPsf.cc:41
Only the diagonal elements of the covariance matrix are provided.
Definition: constants.h:43
static FluxResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
float ErrElement
Definition: constants.h:53
static CentroidResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc, UncertaintyEnum uncertainty)
Add the appropriate fields to a Schema, and return a CentroidResultKey that manages them...
Algorithm provides no uncertainy information at all.
Definition: constants.h:42
SdssShapeResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
Definition: SdssShape.h:82
static FlagHandler addFields(afw::table::Schema &schema, std::string const &prefix, FlagDefinition const *begin, FlagDefinition const *end)
Definition: FlagHandler.cc:28
static ShapeResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc, UncertaintyEnum uncertainty, afw::table::CoordinateType coordType=afw::table::CoordinateType::PIXEL)
Add the appropriate fields to a Schema, and return a ShapeResultKey that manages them.
SdssShapeResult lsst::meas::base::SdssShapeResultKey::get ( afw::table::BaseRecord const &  record) const
virtual

Get a CentroidResult from the given record.

Implements lsst::afw::table::OutputFunctorKey< SdssShapeResult >.

Definition at line 696 of file SdssShape.cc.

696  {
697  SdssShapeResult result;
698  static_cast<ShapeResult&>(result) = record.get(_shapeResult);
699  static_cast<CentroidResult&>(result) = record.get(_centroidResult);
700  static_cast<FluxResult&>(result) = record.get(_fluxResult);
701  result.flux_xx_Cov = record.get(_flux_xx_Cov);
702  result.flux_yy_Cov = record.get(_flux_yy_Cov);
703  result.flux_xy_Cov = record.get(_flux_xy_Cov);
704  for (int n = 0; n < SdssShapeAlgorithm::N_FLAGS; ++n) {
705  result.flags[n] = _flagHandler.getValue(record, n);
706  }
707  return result;
708 }
bool getValue(afw::table::BaseRecord const &record, int i) const
Definition: FlagHandler.h:68
afw::table::Key< ErrElement > _flux_yy_Cov
Definition: SdssShape.h:117
afw::table::Key< ErrElement > _flux_xy_Cov
Definition: SdssShape.h:118
afw::table::Key< ErrElement > _flux_xx_Cov
Definition: SdssShape.h:116
FlagHandler const& lsst::meas::base::SdssShapeResultKey::getFlagHandler ( ) const
inline

Definition at line 110 of file SdssShape.h.

110 { return _flagHandler; }
bool lsst::meas::base::SdssShapeResultKey::isValid ( ) const

Return True if the key is valid.

Definition at line 732 of file SdssShape.cc.

732  {
733  return _shapeResult.isValid() &&
735  _fluxResult.isValid() &&
736  _flux_xx_Cov.isValid() &&
737  _flux_yy_Cov.isValid() &&
739  // don't bother with flags - if we've gotten this far, it's basically impossible the flags don't match
740 }
bool isValid() const
Return true if the key was initialized to valid offset.
Definition: Key.h:83
afw::table::Key< ErrElement > _flux_yy_Cov
Definition: SdssShape.h:117
bool isValid() const
Return True if the centroid key is valid.
bool isValid() const
Return True if both the flux and fluxSigma Keys are valid.
bool isValid() const
Return True if the shape key is valid.
afw::table::Key< ErrElement > _flux_xy_Cov
Definition: SdssShape.h:118
afw::table::Key< ErrElement > _flux_xx_Cov
Definition: SdssShape.h:116
bool lsst::meas::base::SdssShapeResultKey::operator!= ( SdssShapeResultKey const &  other) const
inline

Compare the FunctorKey for equality with another, using the underlying Keys.

Definition at line 104 of file SdssShape.h.

104 { return !(*this == other); }
bool lsst::meas::base::SdssShapeResultKey::operator== ( SdssShapeResultKey const &  other) const

Compare the FunctorKey for equality with another, using the underlying Keys.

Definition at line 722 of file SdssShape.cc.

722  {
723  return _shapeResult == other._shapeResult &&
724  _centroidResult == other._centroidResult &&
725  _fluxResult == other._fluxResult &&
726  _flux_xx_Cov == other._flux_xx_Cov &&
727  _flux_yy_Cov == other._flux_yy_Cov &&
728  _flux_xy_Cov == other._flux_xy_Cov;
729  // don't bother with flags - if we've gotten this far, it's basically impossible the flags don't match
730 }
afw::table::Key< ErrElement > _flux_yy_Cov
Definition: SdssShape.h:117
afw::table::Key< ErrElement > _flux_xy_Cov
Definition: SdssShape.h:118
afw::table::Key< ErrElement > _flux_xx_Cov
Definition: SdssShape.h:116
void lsst::meas::base::SdssShapeResultKey::set ( afw::table::BaseRecord record,
SdssShapeResult const &  value 
) const
virtual

Set a CentroidResult in the given record.

Definition at line 710 of file SdssShape.cc.

710  {
711  record.set(_shapeResult, value);
712  record.set(_centroidResult, value);
713  record.set(_fluxResult, value);
714  record.set(_flux_xx_Cov, value.flux_xx_Cov);
715  record.set(_flux_yy_Cov, value.flux_yy_Cov);
716  record.set(_flux_xy_Cov, value.flux_xy_Cov);
717  for (int n = 0; n < SdssShapeAlgorithm::N_FLAGS; ++n) {
718  _flagHandler.setValue(record, n, value.flags[n]);
719  }
720 }
afw::table::Key< ErrElement > _flux_yy_Cov
Definition: SdssShape.h:117
void setValue(afw::table::BaseRecord &record, int i, bool value) const
Definition: FlagHandler.h:72
afw::table::Key< ErrElement > _flux_xy_Cov
Definition: SdssShape.h:118
afw::table::Key< ErrElement > _flux_xx_Cov
Definition: SdssShape.h:116

Member Data Documentation

CentroidResultKey lsst::meas::base::SdssShapeResultKey::_centroidResult
private

Definition at line 114 of file SdssShape.h.

FlagHandler lsst::meas::base::SdssShapeResultKey::_flagHandler
private

Definition at line 119 of file SdssShape.h.

afw::table::Key<ErrElement> lsst::meas::base::SdssShapeResultKey::_flux_xx_Cov
private

Definition at line 116 of file SdssShape.h.

afw::table::Key<ErrElement> lsst::meas::base::SdssShapeResultKey::_flux_xy_Cov
private

Definition at line 118 of file SdssShape.h.

afw::table::Key<ErrElement> lsst::meas::base::SdssShapeResultKey::_flux_yy_Cov
private

Definition at line 117 of file SdssShape.h.

FluxResultKey lsst::meas::base::SdssShapeResultKey::_fluxResult
private

Definition at line 115 of file SdssShape.h.

ShapeResultKey lsst::meas::base::SdssShapeResultKey::_shapeResult
private

Definition at line 113 of file SdssShape.h.


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