LSSTApplications  19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
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 922 of file SdssShape.cc.

924  : BaseTransform{name}, _instFluxTransform{name, mapper}, _centroidTransform{name, mapper} {
925  // If the input schema has a PSF flag -- it's optional -- assume we are also transforming the PSF.
926  _transformPsf = mapper.getInputSchema().getNames().count("sdssShape_flag_psf") ? true : false;
927 
928  // Skip the last flag if not transforming the PSF shape.
929  for (std::size_t i = 0; i < SdssShapeAlgorithm::getFlagDefinitions().size(); i++) {
930  FlagDefinition const &flag = SdssShapeAlgorithm::getFlagDefinitions()[i];
931  if (flag == SdssShapeAlgorithm::FAILURE) continue;
932  if (mapper.getInputSchema().getNames().count(mapper.getInputSchema().join(name, flag.name)) == 0)
933  continue;
934  afw::table::Key<afw::table::Flag> key =
935  mapper.getInputSchema().find<afw::table::Flag>(name + "_" + flag.name).key;
936  mapper.addMapping(key);
937  }
938 
939  _outShapeKey = ShapeResultKey::addFields(mapper.editOutputSchema(), name, "Shape in celestial moments",
941  if (_transformPsf) {
942  _outPsfShapeKey = afw::table::QuadrupoleKey::addFields(mapper.editOutputSchema(), name + "_psf",
943  "PSF shape in celestial moments",
945  }
946 }

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  }

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

950  {
951  // The instFlux and cetroid transforms will check that the catalog lengths
952  // match and throw if not, so we don't repeat the test here.
953  _instFluxTransform(inputCatalog, outputCatalog, wcs, photoCalib);
954  _centroidTransform(inputCatalog, outputCatalog, wcs, photoCalib);
955 
956  CentroidResultKey centroidKey(inputCatalog.getSchema()[_name]);
957  ShapeResultKey inShapeKey(inputCatalog.getSchema()[_name]);
958  afw::table::QuadrupoleKey inPsfShapeKey;
959  if (_transformPsf) {
960  inPsfShapeKey = afw::table::QuadrupoleKey(
961  inputCatalog.getSchema()[inputCatalog.getSchema().join(_name, "psf")]);
962  }
963 
964  afw::table::SourceCatalog::const_iterator inSrc = inputCatalog.begin();
965  afw::table::BaseCatalog::iterator outSrc = outputCatalog.begin();
966  for (; inSrc != inputCatalog.end(); ++inSrc, ++outSrc) {
967  ShapeResult inShape = inShapeKey.get(*inSrc);
968  ShapeResult outShape;
969 
970  // The transformation from the (x, y) to the (Ra, Dec) basis.
971  geom::AffineTransform crdTr =
972  wcs.linearizePixelToSky(centroidKey.get(*inSrc).getCentroid(), geom::radians);
973  outShape.setShape(inShape.getShape().transform(crdTr.getLinear()));
974 
975  // Transformation matrix from pixel to celestial basis.
977  outShape.setShapeErr((m * inShape.getShapeErr().cast<double>() * m.transpose()).cast<ErrElement>());
978 
979  _outShapeKey.set(*outSrc, outShape);
980 
981  if (_transformPsf) {
982  _outPsfShapeKey.set(*outSrc, inPsfShapeKey.get(*inSrc).transform(crdTr.getLinear()));
983  }
984  }
985 }

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:
lsst::meas::base::FULL_COVARIANCE
@ FULL_COVARIANCE
The full covariance matrix is provided.
Definition: constants.h:46
lsst::afw::table::CoordinateType::CELESTIAL
@ CELESTIAL
lsst::afw::table::QuadrupoleKey::set
void set(BaseRecord &record, geom::ellipses::Quadrupole const &value) const override
Set a Quadrupole in the given record.
Definition: aggregates.cc:114
wcs
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
lsst::meas::base::ShapeTrMatrix
Eigen::Matrix< ShapeElement, 3, 3, Eigen::DontAlign > ShapeTrMatrix
Definition: constants.h:62
lsst::geom::AffineTransform
An affine coordinate transformation consisting of a linear transformation and an offset.
Definition: AffineTransform.h:75
lsst::meas::base::BaseTransform::_name
std::string _name
Definition: Transform.h:107
lsst::afw::table::QuadrupoleKey::addFields
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
lsst::meas::base::ShapeResultKey::addFields
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.
Definition: ShapeUtilities.cc:74
lsst::geom::AffineTransform::getLinear
LinearTransform const & getLinear() const noexcept
Definition: AffineTransform.h:155
lsst::afw::table::CatalogT< BaseRecord >::iterator
CatalogIterator< typename Internal::iterator > iterator
Definition: Catalog.h:110
lsst::meas::base::SdssShapeAlgorithm::getFlagDefinitions
static FlagDefinitionList const & getFlagDefinitions()
Definition: SdssShape.cc:58
LSST_EXCEPT
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
lsst::meas::base::FlagDefinitionList::size
std::size_t size() const
return the current size (number of defined elements) of the collection
Definition: FlagHandler.h:125
photoCalib
Key< int > photoCalib
Definition: Exposure.cc:67
lsst::meas::base::makeShapeTransformMatrix
ShapeTrMatrix makeShapeTransformMatrix(geom::LinearTransform const &xform)
Construct a matrix suitable for transforming second moments.
Definition: ShapeUtilities.cc:143
lsst::meas::base::ErrElement
float ErrElement
Definition: constants.h:55
key
Key< U > key
Definition: Schema.cc:281
lsst::meas::base::SdssShapeAlgorithm::FAILURE
static FlagDefinition const FAILURE
Definition: SdssShape.h:155
mapper
SchemaMapper * mapper
Definition: SchemaMapper.cc:78
lsst::geom::radians
constexpr AngleUnit radians
constant with units of radians
Definition: Angle.h:108
std::size_t
lsst::meas::base::BaseTransform::BaseTransform
BaseTransform(std::string const &name)
Definition: Transform.h:88
lsst::meas::base::ShapeResultKey::set
virtual void set(afw::table::BaseRecord &record, ShapeResult const &value) const
Set a ShapeResult in the given record.
Definition: ShapeUtilities.cc:136
m
int m
Definition: SpanSet.cc:49