LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+a41d3748ce,g1470d8bcf6+6be6c9203b,g2079a07aa2+14824f138e,g212a7c68fe+a4f2ea4efa,g2305ad1205+72971fe858,g295015adf3+ab2c85acae,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+31b3a28dff,g487adcacf7+082e807817,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+b2918d57ae,g5a732f18d5+66d966b544,g64a986408d+a41d3748ce,g858d7b2824+a41d3748ce,g8a8a8dda67+a6fc98d2e7,g99cad8db69+7fe4acdf18,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+84af8b3ff8,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gba4ed39666+9664299f35,gbb8dafda3b+d8d527deb2,gc07e1c2157+b2dbe6b631,gc120e1dc64+61440b2abb,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+31b3a28dff,gdaeeff99f8+a38ce5ea23,ge6526c86ff+39927bb362,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+a41d3748ce,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::meas::base::SdssShapeResultKey Class Referenceabstract

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< T > lsst::afw::table::InputFunctorKey< T >

Public Types

using Value
 The data type for get and set.
 

Public Member Functions

 SdssShapeResultKey ()
 Default constructor; instance will not be usuable unless subsequently assigned to.
 
 SdssShapeResultKey (afw::table::SubSchema const &s)
 Construct from a subschema, assuming _xx, _yy, etc.
 
virtual SdssShapeResult get (afw::table::BaseRecord const &record) const
 Get an SdssShapeResult from the given record.
 
virtual void set (afw::table::BaseRecord &record, SdssShapeResult const &value) const
 Set an SdssShapeResult in the given record.
 
virtual afw::geom::ellipses::Quadrupole getPsfShape (afw::table::BaseRecord const &record) const
 Get a Quadrupole for the Psf from the given record.
 
virtual void setPsfShape (afw::table::BaseRecord &record, afw::geom::ellipses::Quadrupole const &value) const
 Set a Quadrupole for the Psf at the position of the given record.
 
bool operator== (SdssShapeResultKey const &other) const
 Compare the FunctorKey for equality with another, using the underlying Keys.
 
bool operator!= (SdssShapeResultKey const &other) const
 
bool isValid () const
 Return True if the key is valid.
 
FlagHandler const & getFlagHandler () const
 
virtual void set (BaseRecord &record, T const &value) const =0
 

Static Public Member Functions

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

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 73 of file SdssShape.h.

Member Typedef Documentation

◆ Value

using lsst::afw::table::FunctorKey< SdssShapeResult >::Value
inherited

The data type for get and set.

Definition at line 77 of file FunctorKey.h.

Constructor & Destructor Documentation

◆ SdssShapeResultKey() [1/2]

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

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

Definition at line 90 of file SdssShape.h.

90{}

◆ SdssShapeResultKey() [2/2]

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:

SdssShapeResultKey k(schema["a"]);
A FunctorKey that maps SdssShapeResult to afw::table Records.
Definition SdssShape.h:73

Definition at line 688 of file SdssShape.cc.

689 : _shapeResult(s),
690 _centroidResult(s),
691 _instFluxResult(s),
692 _instFlux_xx_Cov(s["instFlux"]["xx"]["Cov"]),
693 _instFlux_yy_Cov(s["instFlux"]["yy"]["Cov"]),
694 _instFlux_xy_Cov(s["instFlux"]["xy"]["Cov"]) {
695 // The input SubSchema may optionally provide for a PSF.
696 try {
697 _psfShapeResult = afw::table::QuadrupoleKey(s["psf"]);
698 _flagHandler = FlagHandler(s, SdssShapeAlgorithm::getFlagDefinitions());
699 _includePsf = true;
700 } catch (pex::exceptions::NotFoundError &e) {
701 _flagHandler =
703 _includePsf = false;
704 }
705}
static FlagDefinitionList const & getFlagDefinitions()
Definition SdssShape.cc:58
static FlagDefinition const PSF_SHAPE_BAD
Definition SdssShape.h:160

Member Function Documentation

◆ addFields()

SdssShapeResultKey lsst::meas::base::SdssShapeResultKey::addFields ( afw::table::Schema & schema,
std::string const & name,
bool doMeasurePsf )
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.
[in]numFlagsInteger to accommodate not setting the Psf shape fields when doMeasurePsf is false.
[in]doMeasurePsfBoolean indicating whether or not the Psf is being measured (as set in the SdssShapeControl class).

Definition at line 641 of file SdssShape.cc.

642 {
644 r._shapeResult =
645 ShapeResultKey::addFields(schema, name, "elliptical Gaussian adaptive moments", SIGMA_ONLY);
646 r._centroidResult = CentroidResultKey::addFields(schema, name, "elliptical Gaussian adaptive moments",
648 r._instFluxResult = FluxResultKey::addFields(schema, name, "elliptical Gaussian adaptive moments");
649
650 // Only include PSF shape fields if doMeasurePsf = True
651 if (doMeasurePsf) {
652 r._includePsf = true;
653 r._psfShapeResult = afw::table::QuadrupoleKey::addFields(
654 schema, schema.join(name, "psf"), "adaptive moments of the PSF model at the object position");
655 } else {
656 r._includePsf = false;
657 }
658
659 r._instFlux_xx_Cov =
660 schema.addField<ErrElement>(schema.join(name, "instFlux", "xx", "Cov"),
661 (boost::format("uncertainty covariance between %s and %s") %
662 schema.join(name, "instFlux") % schema.join(name, "xx"))
663 .str(),
664 "count*pixel^2");
665 r._instFlux_yy_Cov =
666 schema.addField<ErrElement>(schema.join(name, "instFlux", "yy", "Cov"),
667 (boost::format("uncertainty covariance between %s and %s") %
668 schema.join(name, "instFlux") % schema.join(name, "yy"))
669 .str(),
670 "count*pixel^2");
671 r._instFlux_xy_Cov =
672 schema.addField<ErrElement>(schema.join(name, "instFlux", "xy", "Cov"),
673 (boost::format("uncertainty covariance between %s and %s") %
674 schema.join(name, "instFlux") % schema.join(name, "xy"))
675 .str(),
676 "count*pixel^2");
677
678 // Skip the psf flag if not recording the PSF shape.
679 if (r._includePsf) {
680 r._flagHandler = FlagHandler::addFields(schema, name, SdssShapeAlgorithm::getFlagDefinitions());
681 } else {
682 r._flagHandler = FlagHandler::addFields(schema, name, SdssShapeAlgorithm::getFlagDefinitions(),
684 }
685 return r;
686}
static QuadrupoleKey addFields(Schema &schema, std::string const &name, std::string const &doc, CoordinateType coordType=CoordinateType::PIXEL)
Add a set of quadrupole subfields to a schema and return a QuadrupoleKey that points to them.
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.
static FlagHandler addFields(afw::table::Schema &schema, std::string const &prefix, FlagDefinitionList const &flagDefs, FlagDefinitionList const &exclDefs=FlagDefinitionList::getEmptyList())
Add Flag fields to a schema, creating a FlagHandler object to manage them.
static FluxResultKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
Add a pair of _instFlux, _instFluxErr fields to a Schema, and return a FluxResultKey that points to t...
SdssShapeResultKey()
Default constructor; instance will not be usuable unless subsequently assigned to.
Definition SdssShape.h:90
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.
@ SIGMA_ONLY
Only the diagonal elements of the covariance matrix are provided.
Definition constants.h:45
@ NO_UNCERTAINTY
Algorithm provides no uncertainy information at all.
Definition constants.h:44

◆ get()

SdssShapeResult lsst::meas::base::SdssShapeResultKey::get ( afw::table::BaseRecord const & record) const
virtual

Get an SdssShapeResult from the given record.

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

Definition at line 707 of file SdssShape.cc.

707 {
708 SdssShapeResult result;
709 static_cast<ShapeResult &>(result) = record.get(_shapeResult);
710 static_cast<CentroidResult &>(result) = record.get(_centroidResult);
711 static_cast<FluxResult &>(result) = record.get(_instFluxResult);
712 result.instFlux_xx_Cov = record.get(_instFlux_xx_Cov);
713 result.instFlux_yy_Cov = record.get(_instFlux_yy_Cov);
714 result.instFlux_xy_Cov = record.get(_instFlux_xy_Cov);
715 for (size_t n = 0; n < SdssShapeAlgorithm::N_FLAGS; ++n) {
716 if (n == SdssShapeAlgorithm::PSF_SHAPE_BAD.number && !_includePsf) continue;
717 result.flags[n] = _flagHandler.getValue(record, n);
718 }
719 return result;
720}
bool getValue(afw::table::BaseRecord const &record, std::size_t i) const
Return the value of the flag field corresponding to the given flag index.
static unsigned int const N_FLAGS
Definition SdssShape.h:154

◆ getFlagHandler()

FlagHandler const & lsst::meas::base::SdssShapeResultKey::getFlagHandler ( ) const
inline

Definition at line 125 of file SdssShape.h.

125{ return _flagHandler; }

◆ getPsfShape()

afw::geom::ellipses::Quadrupole lsst::meas::base::SdssShapeResultKey::getPsfShape ( afw::table::BaseRecord const & record) const
virtual

Get a Quadrupole for the Psf from the given record.

Definition at line 722 of file SdssShape.cc.

722 {
723 return record.get(_psfShapeResult);
724}

◆ isValid()

bool lsst::meas::base::SdssShapeResultKey::isValid ( ) const

Return True if the key is valid.

Definition at line 752 of file SdssShape.cc.

752 {
753 return _shapeResult.isValid() && _centroidResult.isValid() && _instFluxResult.isValid() &&
754 _psfShapeResult.isValid() && _instFlux_xx_Cov.isValid() && _instFlux_yy_Cov.isValid() &&
755 _instFlux_xy_Cov.isValid();
756 // don't bother with flags - if we've gotten this far, it's basically impossible the flags are invalid
757}
bool isValid() const noexcept
Return true if the key was initialized to valid offset.
Definition Key.h:97
bool isValid() const noexcept
Return True if all the constituent Keys are valid.
Definition aggregates.h:429
bool isValid() const
Return True if the centroid key is valid.
bool isValid() const
Return True if both the instFlux and instFluxErr Keys are valid.
bool isValid() const
Return True if the shape key is valid.

◆ operator!=()

bool lsst::meas::base::SdssShapeResultKey::operator!= ( SdssShapeResultKey const & other) const
inline

Definition at line 119 of file SdssShape.h.

119{ return !(*this == other); }

◆ operator==()

bool lsst::meas::base::SdssShapeResultKey::operator== ( SdssShapeResultKey const & other) const

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

Definition at line 744 of file SdssShape.cc.

744 {
745 return _shapeResult == other._shapeResult && _centroidResult == other._centroidResult &&
746 _instFluxResult == other._instFluxResult && _psfShapeResult == other._psfShapeResult &&
747 _instFlux_xx_Cov == other._instFlux_xx_Cov && _instFlux_yy_Cov == other._instFlux_yy_Cov &&
748 _instFlux_xy_Cov == other._instFlux_xy_Cov;
749 // don't bother with flags - if we've gotten this far, it's basically impossible the flags don't match
750}

◆ set() [1/2]

void lsst::meas::base::SdssShapeResultKey::set ( afw::table::BaseRecord & record,
SdssShapeResult const & value ) const
virtual

Set an SdssShapeResult in the given record.

Definition at line 726 of file SdssShape.cc.

726 {
727 record.set(_shapeResult, value);
728 record.set(_centroidResult, value);
729 record.set(_instFluxResult, value);
730 record.set(_instFlux_xx_Cov, value.instFlux_xx_Cov);
731 record.set(_instFlux_yy_Cov, value.instFlux_yy_Cov);
732 record.set(_instFlux_xy_Cov, value.instFlux_xy_Cov);
733 for (size_t n = 0; n < SdssShapeAlgorithm::N_FLAGS; ++n) {
734 if (n == SdssShapeAlgorithm::PSF_SHAPE_BAD.number && !_includePsf) continue;
735 _flagHandler.setValue(record, n, value.flags[n]);
736 }
737}
void setValue(afw::table::BaseRecord &record, std::size_t i, bool value) const
Set the flag field corresponding to the given flag index.

◆ set() [2/2]

template<typename T >
virtual void lsst::afw::table::InputFunctorKey< T >::set ( BaseRecord & record,
T const & value ) const
pure virtualinherited

◆ setPsfShape()

void lsst::meas::base::SdssShapeResultKey::setPsfShape ( afw::table::BaseRecord & record,
afw::geom::ellipses::Quadrupole const & value ) const
virtual

Set a Quadrupole for the Psf at the position of the given record.

Definition at line 739 of file SdssShape.cc.

740 {
741 record.set(_psfShapeResult, value);
742}

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