Namespace lsst::meas::base

namespace base

Unnamed Group

typedef int ElementCount
typedef double Flux
typedef double FluxErrElement
typedef double Mag
typedef double MagErrElement
typedef float ErrElement
typedef double CentroidElement
typedef double ShapeElement
typedef geom::Point<CentroidElement, 2> Centroid
typedef Eigen::Matrix<ErrElement, 2, 2, Eigen::DontAlign> CentroidCov
typedef afw::geom::ellipses::Quadrupole Shape
typedef Eigen::Matrix<ErrElement, 3, 3, Eigen::DontAlign> ShapeCov
typedef Eigen::Matrix<ShapeElement, 3, 3, Eigen::DontAlign> ShapeTrMatrix

Enums

enum UncertaintyEnum

An enum used to specify how much uncertainty information measurement algorithms provide.

Currently, only ResultMappers (not Results) make use of these distinctions; Result structs always have data members that could hold the full-covariance, but may set some of these to NaN.

Values:

NO_UNCERTAINTY = 0

Algorithm provides no uncertainy information at all.

SIGMA_ONLY = 1

Only the diagonal elements of the covariance matrix are provided.

FULL_COVARIANCE = 2

The full covariance matrix is provided.

Functions

LSST_EXCEPTION_TYPE(FatalAlgorithmError, lsst::pex::exceptions::RuntimeError, lsst::meas::base::FatalAlgorithmError)

Exception to be thrown when a measurement algorithm experiences a fatal error.

This error type causes the meas_base framework to throw completely out of the measurement loop which is run for each exposure, sourceCatalog pair.

LSST_EXCEPTION_TYPE(PixelValueError, lsst::pex::exceptions::DomainError, lsst::meas::base::PixelValueError)

Exception to be thrown when a measurement algorithm encounters a NaN or infinite pixel.

When caught by the plugin framework, this exception will generate a log message.

ShapeTrMatrix makeShapeTransformMatrix(geom::LinearTransform const &xform)

Construct a matrix suitable for transforming second moments.

Given an LinearTransform which maps from positions (x, y) to (a, d), returns a 3-by-3 matrix which transforms (xx, yy, xy) to (aa, dd, ad).

That is, given an input transform described by the matrix

| A11 | A12 | | A21 | A22 |

we return the matrix

| A11*A11 | A12*A12 | 2*A11*A12 | | A21*A21 | A22*A22 | 2*A21*A22 | | A11*A21 | A12*A22 | A11*A22 + A12*A21 |

Return

A 3-by-3 transformation matrix for the second order moments

Parameters
  • [in] xform: LinearTransform describing the coordinate mapping

class ApertureFluxAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <ApertureFlux.h>

Base class for multiple-aperture photometry algorithms

ApertureFluxAlgorithm serves as an intermediate base class for all aperture fluxes, which it assumes have that capability of measuring multiple apertures (even if they are not always configured to do so).

Concrete implementations for single-aperture flux measurements are provided as static methods, as well as a consistent interface and control object for its derived classes. Currently, we only have one derived class, CircularApertureFluxAlgorithm, but in the future we anticipate adding more derived classes for e.g. elliptical apertures, or apertures that are circular in sky coordinates rather than pixel coordinates.

Subclassed by lsst::meas::base::CircularApertureFluxAlgorithm

class ApertureFluxControl
#include <ApertureFlux.h>

Configuration object for multiple-aperture flux algorithms

struct ApertureFluxResult : public lsst::meas::base::FluxResult
#include <ApertureFlux.h>

A Result struct for running an aperture flux algorithm with a single radius.

This simply extends FluxResult to add the appropriate error flags for aperture fluxes.

class ApertureFluxTransform : public lsst::meas::base::BaseTransform
#include <ApertureFlux.h>

Measurement transformation for aperture fluxes

Transforms instFluxes with associated errors to magnitudes. Correctly handles multiple apertures. Flags are propagated from input to output.

class BaseAlgorithm
#include <Algorithm.h>

Ultimate abstract base class for all C++ measurement algorithms

New algorithms should not inherit directly from this class.

Subclassed by lsst::meas::base::ForcedAlgorithm, lsst::meas::base::SingleFrameAlgorithm

class BaseTransform
#include <Transform.h>

Abstract base class for all C++ measurement transformations

Measurement plugins return results in raw, uncalibrated units (eg fluxes or positions in pixels). The transformation system provides a mechanism for post-processing those results into a calibrated form (magnitudes, celestial coordinates, etc).

A measurement transformation should derive from BaseTransform. It should implement a constructor which takes three arguments:

  • A Control object describing the configuration of the measurement plugin.

  • The name of the measurement plugin whose outputs are to be transformed (std::string);

  • An lsst::afw::table::SchemaMapper which links the input and output catalogs;

The constructor should use the SchemaMapper to map fields from the input to output schemas and add additional keys to the output as required. For example:


Derived classes should also implement operator() following the interface below. This will be called with a catalog containing the results of the measurement plugin and a catalog to be populated with transformed quantities, as well as WCS and calibration information. For example:


Note that it is safe to assume that both catalogs passed to operator() are contiguous in memory. It is good practice to ensure that they are equal in size: this may be conveniently achieved by calling BaseTransform::checkCatalogSize().

operator() may throw LengthError if the transformation is impossible to complete. In this case, the contents of outputCatalog is not guaranteed.

Subclassed by lsst::meas::base::ApertureFluxTransform, lsst::meas::base::CentroidTransform, lsst::meas::base::FluxTransform, lsst::meas::base::SdssShapeTransform

class BlendednessAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <Blendedness.h>

Compute metrics that measure how blended objects are.

Blendedness is initialized once for a given Schema, then run repeatedly by calls to measureChildPixels and measureParentPixels (in any order, possibly with multiple sources interleaved). Since it needs access to both the image with with noise and the noise replaced children it cannot use the standard plugin interface.

struct CentroidResult
#include <CentroidUtilities.h>

A reusable struct for centroid measurements.

Subclassed by lsst::meas::base::SdssShapeResult

class CentroidResultKey : public lsst::afw::table::FunctorKey<CentroidResult>
#include <CentroidUtilities.h>

A FunctorKey for CentroidResult.

This class makes it easy to copy centroids and their uncertainties to and from records, and provides a method to add the appropriate fields to a Schema.

class CentroidTransform : public lsst::meas::base::BaseTransform
#include <CentroidUtilities.h>

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.

Subclassed by lsst::meas::base::NaiveCentroidTransform, lsst::meas::base::SdssCentroidTransform

struct FlagDefinition
#include <FlagHandler.h>

Simple class used to define and document flags The name and doc constitute the identity of the FlagDefinition The number is used for indexing, but is assigned arbitrarily.

class FlagDefinitionList
#include <FlagHandler.h>

vector-type utility class to build a collection of FlagDefinitions

class FlagHandler
#include <FlagHandler.h>

Utility class for handling flag fields that indicate the failure modes of an algorithm.

The typical pattern for using FlagHandler within an Algorithm is:

  • Add a FlagHandler object as a data member.

  • Create a FlagDefinitionList to specify the name and doc for each flag Add a “general” failure flag if one is needed (this indicates that some failure occurred). Add specific error flags for each type of error (these indicate a specific failure).

  • Initialize the FlagHandler data member within the Algorithm’s constructor, using the static addFields method to add the flags from the FlagDefinitionList to the schema.

See PsfFluxAlgorithm for a complete example.

struct FluxResult
#include <FluxUtilities.h>

A reusable result struct for instFlux measurements.

Subclassed by lsst::meas::base::ApertureFluxResult, lsst::meas::base::SdssShapeResult

class FluxResultKey : public lsst::afw::table::FunctorKey<FluxResult>
#include <FluxUtilities.h>

A FunctorKey for FluxResult.

This class makes it easy to copy instFluxes and their uncertainties to and from records, and provides a method to add the appropriate fields to a Schema.

class FluxTransform : public lsst::meas::base::BaseTransform
#include <FluxUtilities.h>

Base for instFlux measurement transformations

Provides a basic transform from instFlux plus associated uncertainty to magnitude 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.

Subclassed by lsst::meas::base::GaussianFluxTransform, lsst::meas::base::LocalBackgroundTransform, lsst::meas::base::PeakLikelihoodFluxTransform, lsst::meas::base::PsfFluxTransform, lsst::meas::base::ScaledApertureFluxTransform

class ForcedAlgorithm : public virtual lsst::meas::base::BaseAlgorithm
#include <Algorithm.h>

Base class for algorithms that measure the properties of sources on one image, using previous measurements on another image to hold certain quantities fixed.

ForcedAlgorithm can be used when measuring both on single exposures and coadds, and is typically used to measure colors by holding centroids, apertures, or other model parameters fixed while allowing amplitudes to vary.

In addition to the virtual methods defined here, ForcedAlgorithm also puts requirements on constructor signatures; see the wrapForcedAlgorithm Python function for more information.

Most algorithms will not need to make use of the reference record or WCS, as transformed centroids and shapes should generally be available via the slots in measRecord, but these are made available for algorithms that need to transform more complex information. If that is the case, the algorithm may want to inherit from SimpleAlgorithm instead of inheriting from ForcedAlgorithm directly.

Subclassed by lsst::meas::base::SimpleAlgorithm

class GaussianFluxAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <GaussianFlux.h>

A measurement algorithm that estimates instFlux using an elliptical Gaussian weight.

This algorithm computes instFlux as the dot product of an elliptical Gaussian weight function with the image. The size and ellipticity of the weight function are determined using the SdssShape algorithm, or retreived from a named field.

class GaussianFluxControl
#include <GaussianFlux.h>

A C++ control class to handle GaussianFluxAlgorithm’s configuration.

class LocalBackgroundAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <LocalBackground.h>

A measurement algorithm that estimates the local background value per pixel.

class LocalBackgroundControl
#include <LocalBackground.h>

Configuration of LocalBackgroundAlgorithm.

struct MagResult
#include <FluxUtilities.h>

A reusable result struct for magnitudes.

class MagResultKey : public lsst::afw::table::FunctorKey<MagResult>
#include <FluxUtilities.h>

A FunctorKey for MagResult.

This class makes it easy to copy magnitudes and their uncertainties to and from records, and provides a method to add the appropriate fields to a Schema.

class MeasurementError : public RuntimeError
#include <exceptions.h>

Exception to be thrown when a measurement algorithm experiences a known failure mode.

In addition to the usual message, MeasurementError must be constructed with the bit of the algorithm-specific flag that indicates the known failure mode. This allows the measurement framework to set that flag upon failure. Typically, this flag bit is also used to look up the message from the algorithm classes FlagDefinition list; the common pattern is:

if (badThingHappened) {
    // BAD_THING is an enum value from the Algorithm's FlagBits enum; getFlagDefinitions()
    // is a static method algorithms are expected to define.
    throw LSST_EXCEPT(MeasurementError, getFlagDefinitions()[BAD_THING), BAD_THING);
 }

class NaiveCentroidAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <NaiveCentroid.h>

A class that calculates a centroid as a simple unweighted first moment of the 3x3 region around a pixel.

A fixed background (set via config) may optionally be subtracted. This algorithm does not currently report an error, but it probably should.

class NaiveCentroidControl
#include <NaiveCentroid.h>

A C++ control class to handle NaiveCentroidAlgorithm’s configuration.

class PeakLikelihoodFluxAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <PeakLikelihoodFlux.h>

A measurement algorithm that estimates the peak instrument flux, using a filtered image which has been convolved with its own PSF.

class PeakLikelihoodFluxControl
#include <PeakLikelihoodFlux.h>

C++ control object for peak likelihood instrument flux.

Peak likelihood flux requires an image that has been filtered by convolving with its own PSF (or an approximate model). It is equivalent to a PSF instrument flux (e.g. as computed by PsfFluxAlgorithm) computed on a non-preconvolved image.

The PSF must be provided in the exposure, as it is used to compute a weighting factor.

Flux and error are computed as follows:

  • instFlux = sum(unfiltered image * PSF) / sum(PSF^2) = value of peak of filtered source / sum(PSF^2)

  • err = sqrt(sum(unfiltered variance * PSF^2) / sum(PSF^2)^2) = sqrt(value of filtered variance at peak / sum(PSF^2)^2)

  • The pixels in the image are samples of a band-limited function, and by using a sinc interpolation (via a warping kernel) we can evaluate this function at any point. We use this technique to compute the peak of the function, which is assumed to be at the centroid of the filtered source.

class PixelFlagsAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <PixelFlags.h>

A measurement algorithm that gets mask bits from the exposure and sets flag bits to summarize which bits are set within a source’s footprint.

class PixelFlagsControl
#include <PixelFlags.h>

A C++ control class to handle PixelFlagsAlgorithm’s configuration.

class PsfFluxAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <PsfFlux.h>

A measurement algorithm that estimates instFlux using a linear least-squares fit with the Psf model.

The PsfFlux algorithm is extremely simple: we do a least-squares fit of the Psf model (evaluated at a given position) to the data. For point sources, this provides the optimal instFlux measurement in the limit where the Psf model is correct. We do not use per-pixel weights in the fit, as this results in bright stars being fit with a different effective profile than faint stairs.

class PsfFluxControl
#include <PsfFlux.h>

A C++ control class to handle PsfFluxAlgorithm’s configuration.

In C++, we define Control objects to handle configuration information. Using the LSST_CONTROL_FIELD macro and lsst.pex.config.wrap.makeConfigClass, we can turn these into more full-featured Config classes in Python. While the user will usually interact with the Config class, the plugin wrapper system will turn Config instances into Control instances when passing them to C++.

This should logically be an inner class, but Swig doesn’t know how to parse those.

class SafeCentroidExtractor
#include <InputUtilities.h>

Utility class for measurement algorithms that extracts a position from the Centroid slot and handles errors in a safe and consistent way.

class SafeShapeExtractor
#include <InputUtilities.h>

Utility class for measurement algorithms that extracts an ellipse from the Shape slot and handles errors in a safe and consistent way.

class ScaledApertureFluxAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <ScaledApertureFlux.h>

Measure the instFlux in an aperture scaled to the PSF.

This algorithm performs a sinc aperture instFlux measurement where they size of the aperture is determined by multiplying the FWHM of the PSF by the scaling factor specified in the algorithm configuration.

class SdssCentroidAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <SdssCentroid.h>

The Sdss Centroid Algorithm.

class SdssCentroidControl
#include <SdssCentroid.h>

A C++ control class to handle SdssCentroidAlgorithm’s configuration.

class SdssShapeAlgorithm : public lsst::meas::base::SimpleAlgorithm
#include <SdssShape.h>

Measure the image moments of source using adaptive Gaussian weights.

This algorithm measures the weighted second moments of an image using a Gaussian weight function, which is iteratively updated to match the current weights. If this iteration does not converge, it can fall back to using unweighted moments, which can be significantly noisier.

See Bernstein & Jarvis, 2002, for more information on this type of algorithm. Note that the code here makes no attempt to correct for the PSF; for PSF corrected ellipticities using weighted moments please use the shapeHSM package.

class SdssShapeControl
#include <SdssShape.h>

A C++ control class to handle SdssShapeAlgorithm’s configuration.

class SdssShapeResult : public lsst::meas::base::ShapeResult, public lsst::meas::base::CentroidResult, public lsst::meas::base::FluxResult
#include <SdssShape.h>

Result object SdssShapeAlgorithm.

Because we have use cases for running SdssShape outside of the measurement framework (in particular, we need to run it on PSF model images), we provide an interface that doesn’t need to use SourceRecord for its inputs and outputs. Instead, it returns an instance of this class.

Note: for what I guess are historical reasons, SdssShape computes covariance terms between the instFlux and the shape, but not between the instFlux and centroid or centroid and shape.

This should logically be an inner class, but Swig doesn’t know how to parse those.

class SdssShapeResultKey : public lsst::afw::table::FunctorKey<SdssShapeResult>
#include <SdssShape.h>

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.

class SdssShapeTransform : public lsst::meas::base::BaseTransform
#include <SdssShape.h>

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.

struct ShapeResult
#include <ShapeUtilities.h>

A reusable struct for moments-based shape measurements.

Shape measurements and their errors should always be in pixels coordinates. This struct should generally be preferred over a custom struct with other ellipse parametrizations unless the measurement takes place in another parametrization and a transformation to this one would result in a loss of information or obfuscate the results of the measurement (i.e. use this one unless you have a good reason not to).

Subclassed by lsst::meas::base::SdssShapeResult

class ShapeResultKey : public lsst::afw::table::FunctorKey<ShapeResult>
#include <ShapeUtilities.h>

A FunctorKey for ShapeResult.

This class makes it easy to copy shapes and their uncertainties to and from records, and provides a method to add the appropriate fields to a Schema.

class SimpleAlgorithm : public lsst::meas::base::SingleFrameAlgorithm, public lsst::meas::base::ForcedAlgorithm
#include <Algorithm.h>

An abstract base classes for which the same implementation can be used for both SingleFrameAlgorithm and ForcedAlgorithm.

SimpleAlgorithm allows a ForcedAlgorithm to be defined using the measure() and measureN() signatures of SingleFrameAlgorithm. It should be used for any algorithm for which the forced version of the algorithm does not require anything to be transformed beyond the centroid and shape, and for which the the parameters being fit are the same for both single-frame and forced measurement. This should be the case for all flux algorithms that don’t involve fitting any additional model parameters. It can also be used for centroid and shape algorithms, where having a version that can re-measure values in forced mode may be useful for diagnostic purposes even if it is not useful for science.

Subclassed by lsst::ip::diffim::DipoleCentroidAlgorithm, lsst::ip::diffim::DipoleFluxAlgorithm, lsst::meas::base::ApertureFluxAlgorithm, lsst::meas::base::BlendednessAlgorithm, lsst::meas::base::GaussianFluxAlgorithm, lsst::meas::base::LocalBackgroundAlgorithm, lsst::meas::base::NaiveCentroidAlgorithm, lsst::meas::base::PeakLikelihoodFluxAlgorithm, lsst::meas::base::PixelFlagsAlgorithm, lsst::meas::base::PsfFluxAlgorithm, lsst::meas::base::ScaledApertureFluxAlgorithm, lsst::meas::base::SdssCentroidAlgorithm, lsst::meas::base::SdssShapeAlgorithm, lsst::meas::extensions::photometryKron::KronFluxAlgorithm, lsst::meas::extensions::simpleShape::SimpleShape, lsst::meas::modelfit::DoubleShapeletPsfApproxAlgorithm

template<typename PixelT>
class SincCoeffs
#include <SincCoeffs.h>

A singleton to calculate and cache the coefficients for sinc photometry

Caching is only performed for circular apertures (because elliptical apertures are assumed to be generated dynamically, and hence not expected to recur). Caching must be explicitly requested for a particular circular aperture (using the ‘cache’ method).

class SingleFrameAlgorithm : public virtual lsst::meas::base::BaseAlgorithm
#include <Algorithm.h>

Base class for algorithms that measure the properties of sources on single image.

SingleFrameAlgorithm defines the interface used in measuring both on single exposure images and on coadds.

In addition to the virtual methods defined here, SingleFrameAlgorithm also puts requirements on constructor signatures; see the wrapSingleFrameAlgorithm Python function for more information.

Subclassed by lsst::meas::base::SimpleAlgorithm

namespace python

Functions

template<class Algorithm, class PyAlg>
std::enable_if<!std::is_abstract<Algorithm>::value, void>::type declareAlgorithmConstructor(PyAlg &cls)

Wrap the standard algorithm constructor.

Template Parameters
  • Algorithm: The algorithm class.

  • PyAlg: The pybind11::class_ class corresponding to Algorithm.

Parameters
  • [inout] cls: The pybind11 wrapper for Algorithm.

template<class Algorithm, class PyAlg>
std::enable_if<std::is_abstract<Algorithm>::value, void>::type declareAlgorithmConstructor(PyAlg &cls)

Dummy function for not wrapping the constructor of an abstract base class.

Pybind11 cannot wrap such constructors, and there is no reason to call them from Python anyway.

Template Parameters
  • Algorithm: The algorithm class.

  • PyAlg: The pybind11::class_ class corresponding to Algorithm.

Parameters
  • [inout] cls: The pybind11 wrapper for Algorithm.

template<class Algorithm, class PyAlg>
void declareAlgorithm(PyAlg &clsAlgorithm)

Wrap the implicit API used by meas_base’s algorithms.

This function only initializes constructors, fields, and methods common to all Algorithms.

Template Parameters
  • Algorithm: The algorithm class.

  • PyAlg: The pybind11::class_ class corresponding to Algorithm.

Parameters
  • [inout] clsAlgorithm: The pybind11 wrapper for Algorithm.

template<class Algorithm, class Control, class PyAlg, class PyCtrl>
void declareAlgorithm(PyAlg &clsAlgorithm, PyCtrl &clsControl)

Wrap the implicit API used by meas_base’s algorithm-control pairs (no transform).

This function only initializes constructors, fields, and methods common to all Algorithms and Controls.

Template Parameters
  • Algorithm: The algorithm class.

  • Control: The control class. Must equal Algorithm::Control and Transform::Control.

  • PyAlg: The pybind11::class_ class corresponding to Algorithm.

  • PyCtrl: The pybind11::class_ class corresponding to Control.

Parameters
  • [inout] clsAlgorithm[inout] clsControl: The pybind11 wrappers for the respective C++ classes.

template<class Algorithm, class Control, class Transform, class PyAlg, class PyCtrl, class PyXform>
void declareAlgorithm(PyAlg &clsAlgorithm, PyCtrl &clsControl, PyXform &clsTransform)

Wrap the implicit API used by meas_base’s algorithm-control-transform triads.

This function only initializes constructors, fields, and methods common to all Algorithms, Controls, and Transforms.

Template Parameters
  • Algorithm: The algorithm class.

  • Control: The control class. Must equal Algorithm::Control and Transform::Control.

  • Transform: The transform class.

  • PyAlg: The pybind11::class_ class corresponding to Algorithm.

  • PyCtrl: The pybind11::class_ class corresponding to Control.

  • PyXform: The pybind11::class_ class corresponding to Transform.

Parameters
  • [inout] clsAlgorithm[inout] clsControl[inout] clsTransform: The pybind11 wrappers for the respective C++ classes.