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 | Private Attributes | List of all members
lsst::meas::base::CentroidTransform Class Reference

#include <CentroidUtilities.h>

Inheritance diagram for lsst::meas::base::CentroidTransform:
lsst::meas::base::BaseTransform lsst::meas::base::GaussianCentroidTransform lsst::meas::base::NaiveCentroidTransform lsst::meas::base::SdssCentroidTransform

Public Member Functions

 CentroidTransform (std::string const &name, afw::table::SchemaMapper &mapper)
 
virtual void operator() (afw::table::SourceCatalog const &inputCatalog, afw::table::BaseCatalog &outputCatalog, afw::image::Wcs const &wcs, afw::image::Calib const &calib) const
 
- Public Member Functions inherited from lsst::meas::base::BaseTransform
 BaseTransform (std::string const &name)
 
virtual ~BaseTransform ()
 

Private Attributes

afw::table::CoordKey _coordKey
 
afw::table::CovarianceMatrixKey
< ErrElement, 2 > 
_coordErrKey
 

Additional Inherited Members

- Protected Member Functions inherited from lsst::meas::base::BaseTransform
void checkCatalogSize (afw::table::BaseCatalog const &cat1, afw::table::BaseCatalog const &cat2) const
 Ensure that catalogs have the same size. More...
 
- Protected Attributes inherited from lsst::meas::base::BaseTransform
std::string _name
 

Detailed Description

Base for centroid measurement transformations.

Provides a basic transform from centroid plus associated uncertainty to celestial position with uncertainty. The basic "flag" attribute for the measurement algorithm is propagated to the output.

Subclasses should define a constructor which take a Control argument corresponding to the measurement algorithm being transformed and ensure that any other necessary flags are propagated.

Definition at line 182 of file CentroidUtilities.h.

Constructor & Destructor Documentation

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

Definition at line 133 of file CentroidUtilities.cc.

136  :
138 {
139  // Map the flag through to the output
140  mapper.addMapping(mapper.getInputSchema().find<afw::table::Flag>(name + "_flag").key);
141 
142  // Add keys for the coordinates
143  auto & s = mapper.editOutputSchema();
144  _coordKey = afw::table::CoordKey::addFields(s, name, "ICRS coordinates");
145 
146  // If the centroid has an error key we also include one on the celestial
147  // coordinates; otherwise, it isn't necessary. Note that if we provide for
148  // errors in celestial coordinates, we always need the full covariance.
149  if (CentroidResultKey(mapper.getInputSchema()[name]).getCentroidErr().isValid()) {
150  std::vector< afw::table::Key<ErrElement> > sigma(2);
151  std::vector< afw::table::Key<ErrElement> > cov(1);
152  sigma[0] = s.addField<ErrElement>(s.join(name, "raSigma"), "Uncertainty on RA", "radians");
153  sigma[1] = s.addField<ErrElement>(s.join(name, "decSigma"), "Uncertainty on dec", "radians");
154  cov[0] = s.addField<ErrElement>(s.join(name, "ra_dec_Cov"),
155  "Uncertainty covariance in RA and dec", "radians^2");
156  _coordErrKey = afw::table::CovarianceMatrixKey<ErrElement,2>(sigma, cov);
157  }
158 
159 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
static CoordKey addFields(afw::table::Schema &schema, std::string const &name, std::string const &doc)
float ErrElement
Definition: constants.h:53
BaseTransform(std::string const &name)
Definition: Transform.h:85
afw::table::Key< double > sigma
Definition: GaussianPsf.cc:43
afw::table::CovarianceMatrixKey< ErrElement, 2 > _coordErrKey

Member Function Documentation

void lsst::meas::base::CentroidTransform::operator() ( afw::table::SourceCatalog const &  inputCatalog,
afw::table::BaseCatalog outputCatalog,
afw::image::Wcs const &  wcs,
afw::image::Calib const &  calib 
) const
virtual

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

Definition at line 161 of file CentroidUtilities.cc.

166  {
167  checkCatalogSize(inputCatalog, outputCatalog);
168  CentroidResultKey centroidResultKey(inputCatalog.getSchema()[_name]);
169 
170  afw::table::SourceCatalog::const_iterator inSrc = inputCatalog.begin();
171  afw::table::BaseCatalog::iterator outSrc = outputCatalog.begin();
172 
173  for (; inSrc != inputCatalog.end() && outSrc != outputCatalog.end(); ++inSrc, ++outSrc) {
174  CentroidResult centroidResult = centroidResultKey.get(*inSrc);
175 
176  _coordKey.set(*outSrc, *wcs.pixelToSky(centroidResult.getCentroid()));
177 
178  if (centroidResultKey.getCentroidErr().isValid()) {
179  CentroidCov centroidCov = centroidResult.getCentroidErr();
180  if (!(utils::isnan(centroidCov(0,0)) || utils::isnan(centroidCov(1,1)))) {
181  auto transform = wcs.linearizePixelToSky(centroidResult.getCentroid(),
182  afw::geom::radians).getLinear().getMatrix();
183  _coordErrKey.set(*outSrc, (transform * centroidResult.getCentroidErr().cast<double>() *
184  transform.transpose()).cast<ErrElement>());
185  }
186  }
187  }
188 }
void checkCatalogSize(afw::table::BaseCatalog const &cat1, afw::table::BaseCatalog const &cat2) const
Ensure that catalogs have the same size.
Definition: Transform.h:101
tbl::Key< int > wcs
int isnan(T t)
Definition: ieee.h:110
AngleUnit const radians
constant with units of radians
Definition: Angle.h:91
virtual void set(BaseRecord &record, coord::IcrsCoord const &value) const
Set an IcrsCoord in the given record.
afw::table::CovarianceMatrixKey< ErrElement, 2 > _coordErrKey
Base::const_iterator const_iterator
Definition: SortedCatalog.h:49
virtual void set(BaseRecord &record, Eigen::Matrix< T, N, N > const &value) const
Set a covariance matrix in the given record (uses only the lower triangle of the given matrix) ...
Eigen::Matrix< ErrElement, 2, 2, Eigen::DontAlign > CentroidCov
Definition: constants.h:57
CatalogIterator< typename Internal::iterator > iterator
Definition: Catalog.h:107

Member Data Documentation

afw::table::CovarianceMatrixKey<ErrElement,2> lsst::meas::base::CentroidTransform::_coordErrKey
private

Definition at line 201 of file CentroidUtilities.h.

afw::table::CoordKey lsst::meas::base::CentroidTransform::_coordKey
private

Definition at line 200 of file CentroidUtilities.h.


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