LSST Applications g02d81e74bb+86cf3d8bc9,g180d380827+7a4e862ed4,g2079a07aa2+86d27d4dc4,g2305ad1205+e1ca1c66fa,g29320951ab+012e1474a1,g295015adf3+341ea1ce94,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+c429d67c83,g48712c4677+f88676dd22,g487adcacf7+27e1e21933,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+b41db86c35,g5a732f18d5+53520f316c,g64a986408d+86cf3d8bc9,g858d7b2824+86cf3d8bc9,g8a8a8dda67+585e252eca,g99cad8db69+84912a7fdc,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+a2b54eae19,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+6681f309db,gc120e1dc64+f0fcc2f6d8,gc28159a63d+0e5473021a,gcf0d15dbbd+c429d67c83,gdaeeff99f8+f9a426f77a,ge6526c86ff+0433e6603d,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+86cf3d8bc9,w.2024.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lsst::meas::base::SdssShapeTransform Class Reference

Transformation for SdssShape measurements. More...

#include <SdssShape.h>

Inheritance diagram for lsst::meas::base::SdssShapeTransform:
lsst::meas::base::BaseTransform

Public Types

typedef SdssShapeControl Control
 

Public Member Functions

 SdssShapeTransform (Control const &ctrl, std::string const &name, afw::table::SchemaMapper &mapper)
 
virtual void operator() (afw::table::SourceCatalog const &inputCatalog, afw::table::BaseCatalog &outputCatalog, afw::geom::SkyWcs const &wcs, afw::image::PhotoCalib const &photoCalib) const
 

Protected Member Functions

void checkCatalogSize (afw::table::BaseCatalog const &cat1, afw::table::BaseCatalog const &cat2) const
 Ensure that catalogs have the same size.
 

Protected Attributes

std::string _name
 

Detailed Description

Transformation for SdssShape measurements.

SdssShape measures not just shape but also instFlux and centroid. This transform operates on the first directly, and delegates to the Flux and Centroid transforms for the other two.

Definition at line 250 of file SdssShape.h.

Member Typedef Documentation

◆ Control

Definition at line 252 of file SdssShape.h.

Constructor & Destructor Documentation

◆ SdssShapeTransform()

lsst::meas::base::SdssShapeTransform::SdssShapeTransform ( Control const & ctrl,
std::string const & name,
afw::table::SchemaMapper & mapper )

Definition at line 934 of file SdssShape.cc.

936 : BaseTransform{name}, _instFluxTransform{name, mapper}, _centroidTransform{name, mapper} {
937 // If the input schema has a PSF flag -- it's optional -- assume we are also transforming the PSF.
938 _transformPsf = mapper.getInputSchema().getNames().count("sdssShape_flag_psf") ? true : false;
939
940 // Skip the last flag if not transforming the PSF shape.
942 FlagDefinition const &flag = SdssShapeAlgorithm::getFlagDefinitions()[i];
943 if (flag == SdssShapeAlgorithm::FAILURE) continue;
944 if (mapper.getInputSchema().getNames().count(mapper.getInputSchema().join(name, flag.name)) == 0)
945 continue;
946 afw::table::Key<afw::table::Flag> key =
947 mapper.getInputSchema().find<afw::table::Flag>(name + "_" + flag.name).key;
948 mapper.addMapping(key);
949 }
950
951 _outShapeKey = ShapeResultKey::addFields(mapper.editOutputSchema(), name, "Shape in celestial moments",
953 if (_transformPsf) {
954 _outPsfShapeKey = afw::table::QuadrupoleKey::addFields(mapper.editOutputSchema(), name + "_psf",
955 "PSF shape in celestial moments",
957 }
958}
table::Key< std::string > name
Definition Amplifier.cc:116
SchemaMapper * mapper
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.
std::size_t size() const
return the current size (number of defined elements) of the collection
static FlagDefinitionList const & getFlagDefinitions()
Definition SdssShape.cc:58
static FlagDefinition const FAILURE
Definition SdssShape.h:155
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.
@ FULL_COVARIANCE
The full covariance matrix is provided.
Definition constants.h:46

Member Function Documentation

◆ checkCatalogSize()

void lsst::meas::base::BaseTransform::checkCatalogSize ( afw::table::BaseCatalog const & cat1,
afw::table::BaseCatalog const & cat2 ) const
inlineprotectedinherited

Ensure that catalogs have the same size.

Parameters
[in]cat1Catalog for comparison
[in]cat2Catalog for comparison
Exceptions
LengthErrorCatalog sizes do not match

Definition at line 102 of file Transform.h.

102 {
103 if (cat1.size() != cat2.size()) {
104 throw LSST_EXCEPT(pex::exceptions::LengthError, "Catalog size mismatch");
105 }
106 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48

◆ operator()()

void lsst::meas::base::SdssShapeTransform::operator() ( afw::table::SourceCatalog const & inputCatalog,
afw::table::BaseCatalog & outputCatalog,
afw::geom::SkyWcs const & wcs,
afw::image::PhotoCalib const & photoCalib ) const
virtual

Implements lsst::meas::base::BaseTransform.

Definition at line 960 of file SdssShape.cc.

962 {
963 // The instFlux and cetroid transforms will check that the catalog lengths
964 // match and throw if not, so we don't repeat the test here.
965 _instFluxTransform(inputCatalog, outputCatalog, wcs, photoCalib);
966 _centroidTransform(inputCatalog, outputCatalog, wcs, photoCalib);
967
968 CentroidResultKey centroidKey(inputCatalog.getSchema()[_name]);
969 ShapeResultKey inShapeKey(inputCatalog.getSchema()[_name]);
970 afw::table::QuadrupoleKey inPsfShapeKey;
971 if (_transformPsf) {
972 inPsfShapeKey = afw::table::QuadrupoleKey(
973 inputCatalog.getSchema()[inputCatalog.getSchema().join(_name, "psf")]);
974 }
975
976 afw::table::SourceCatalog::const_iterator inSrc = inputCatalog.begin();
977 afw::table::BaseCatalog::iterator outSrc = outputCatalog.begin();
978 for (; inSrc != inputCatalog.end(); ++inSrc, ++outSrc) {
979 ShapeResult inShape = inShapeKey.get(*inSrc);
980 ShapeResult outShape;
981
982 // The transformation from the (x, y) to the (Ra, Dec) basis.
984 wcs.linearizePixelToSky(centroidKey.get(*inSrc).getCentroid(), geom::radians);
985 outShape.setShape(inShape.getShape().transform(crdTr.getLinear()));
986
987 // Transformation matrix from pixel to celestial basis.
989 outShape.setShapeErr((m * inShape.getShapeErr().cast<double>() * m.transpose()).cast<ErrElement>());
990
991 _outShapeKey.set(*outSrc, outShape);
992
993 if (_transformPsf) {
994 _outPsfShapeKey.set(*outSrc, inPsfShapeKey.get(*inSrc).transform(crdTr.getLinear()));
995 }
996 }
997}
int m
Definition SpanSet.cc:48
CatalogIterator< typename Internal::iterator > iterator
Definition Catalog.h:110
void set(BaseRecord &record, geom::ellipses::Quadrupole const &value) const override
Set a Quadrupole in the given record.
typename Base::const_iterator const_iterator
An affine coordinate transformation consisting of a linear transformation and an offset.
LinearTransform const & getLinear() const noexcept
virtual void set(afw::table::BaseRecord &record, ShapeResult const &value) const
Set a ShapeResult in the given record.
AngleUnit constexpr radians
constant with units of radians
Definition Angle.h:109
Eigen::Matrix< ShapeElement, 3, 3, Eigen::DontAlign > ShapeTrMatrix
Definition constants.h:62
ShapeTrMatrix makeShapeTransformMatrix(geom::LinearTransform const &xform)
Construct a matrix suitable for transforming second moments.

Member Data Documentation

◆ _name

std::string lsst::meas::base::BaseTransform::_name
protectedinherited

Definition at line 107 of file Transform.h.


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