LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
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. More...
 

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 921 of file SdssShape.cc.

923  : BaseTransform{name}, _instFluxTransform{name, mapper}, _centroidTransform{name, mapper} {
924  // If the input schema has a PSF flag -- it's optional -- assume we are also transforming the PSF.
925  _transformPsf = mapper.getInputSchema().getNames().count("sdssShape_flag_psf") ? true : false;
926 
927  // Skip the last flag if not transforming the PSF shape.
928  for (std::size_t i = 0; i < SdssShapeAlgorithm::getFlagDefinitions().size(); i++) {
929  FlagDefinition const &flag = SdssShapeAlgorithm::getFlagDefinitions()[i];
930  if (flag == SdssShapeAlgorithm::FAILURE) continue;
931  if (mapper.getInputSchema().getNames().count(mapper.getInputSchema().join(name, flag.name)) == 0)
932  continue;
933  afw::table::Key<afw::table::Flag> key =
934  mapper.getInputSchema().find<afw::table::Flag>(name + "_" + flag.name).key;
935  mapper.addMapping(key);
936  }
937 
938  _outShapeKey = ShapeResultKey::addFields(mapper.editOutputSchema(), name, "Shape in celestial moments",
940  if (_transformPsf) {
941  _outPsfShapeKey = afw::table::QuadrupoleKey::addFields(mapper.editOutputSchema(), name + "_psf",
942  "PSF shape in celestial moments",
944  }
945 }
table::Key< std::string > name
Definition: Amplifier.cc:116
SchemaMapper * mapper
Definition: SchemaMapper.cc:71
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.
Definition: aggregates.cc:100
BaseTransform(std::string const &name)
Definition: Transform.h:88
std::size_t size() const
return the current size (number of defined elements) of the collection
Definition: FlagHandler.h:125
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 947 of file SdssShape.cc.

949  {
950  // The instFlux and cetroid transforms will check that the catalog lengths
951  // match and throw if not, so we don't repeat the test here.
952  _instFluxTransform(inputCatalog, outputCatalog, wcs, photoCalib);
953  _centroidTransform(inputCatalog, outputCatalog, wcs, photoCalib);
954 
955  CentroidResultKey centroidKey(inputCatalog.getSchema()[_name]);
956  ShapeResultKey inShapeKey(inputCatalog.getSchema()[_name]);
957  afw::table::QuadrupoleKey inPsfShapeKey;
958  if (_transformPsf) {
959  inPsfShapeKey = afw::table::QuadrupoleKey(
960  inputCatalog.getSchema()[inputCatalog.getSchema().join(_name, "psf")]);
961  }
962 
963  afw::table::SourceCatalog::const_iterator inSrc = inputCatalog.begin();
964  afw::table::BaseCatalog::iterator outSrc = outputCatalog.begin();
965  for (; inSrc != inputCatalog.end(); ++inSrc, ++outSrc) {
966  ShapeResult inShape = inShapeKey.get(*inSrc);
967  ShapeResult outShape;
968 
969  // The transformation from the (x, y) to the (Ra, Dec) basis.
970  geom::AffineTransform crdTr =
971  wcs.linearizePixelToSky(centroidKey.get(*inSrc).getCentroid(), geom::radians);
972  outShape.setShape(inShape.getShape().transform(crdTr.getLinear()));
973 
974  // Transformation matrix from pixel to celestial basis.
976  outShape.setShapeErr((m * inShape.getShapeErr().cast<double>() * m.transpose()).cast<ErrElement>());
977 
978  _outShapeKey.set(*outSrc, outShape);
979 
980  if (_transformPsf) {
981  _outPsfShapeKey.set(*outSrc, inPsfShapeKey.get(*inSrc).transform(crdTr.getLinear()));
982  }
983  }
984 }
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:66
int m
Definition: SpanSet.cc:48
CatalogIterator< typename Internal::iterator > iterator
Definition: Catalog.h:111
void set(BaseRecord &record, geom::ellipses::Quadrupole const &value) const override
Set a Quadrupole in the given record.
Definition: aggregates.cc:114
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.
constexpr AngleUnit radians
constant with units of radians
Definition: Angle.h:108
Eigen::Matrix< ShapeElement, 3, 3, Eigen::DontAlign > ShapeTrMatrix
Definition: constants.h:62
float ErrElement
Definition: constants.h:55
ShapeTrMatrix makeShapeTransformMatrix(geom::LinearTransform const &xform)
Construct a matrix suitable for transforming second moments.
Key< int > photoCalib
Definition: Exposure.cc:67

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: