File ApertureFlux.h

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace meas
namespace base
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

Unnamed Group

template<typename T>
static Result computeSincFlux(afw::image::Image<T> const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl = Control())

Compute the instFlux (and optionally, uncertanties) within an aperture using Sinc photometry

The Sinc algorithm is slower than a naive aperture, but more accurate, in that it correctly handles sub-pixel aperture boundaries on well-sampled data. This improved accuracy is most important for smaller apertures.

Parameters
  • [in] image: Image or MaskedImage to be measured. If a MaskedImage is provided, uncertainties will be returned as well as instFluxes.

  • [in] ellipse: Ellipse that defines the outer boundary of the aperture.

  • [in] ctrl: Control object.

template<typename T>
static Result computeSincFlux(afw::image::MaskedImage<T> const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl = Control())

Unnamed Group

template<typename T>
static Result computeNaiveFlux(afw::image::Image<T> const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl = Control())

Compute the instFlux (and optionally, uncertanties) within an aperture using naive photometry

The naive algorithm just counts the instFlux in pixels whose centers lie within the aperture, ignoring the effects of sub-pixel aperture boundaries.

Parameters
  • [in] image: Image or MaskedImage to be measured. If a MaskedImage is provided, uncertainties will be returned as well as instFluxes.

  • [in] ellipse: Ellipse that defines the outer boundary of the aperture.

template<typename T>
static Result computeNaiveFlux(afw::image::MaskedImage<T> const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl = Control())

Unnamed Group

template<typename T>
static Result computeFlux(afw::image::Image<T> const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl = Control())

Compute the instFlux (and optionally, uncertanties) within an aperture using the algorithm determined by its size and the maxSincRadius control parameter.

This method delegates to computeSincFlux is the minor axis of the aperture is smaller than ctrl.maxSincRadius, and delegates to computeNaiveFlux otherwise.

Parameters
  • [in] image: Image or MaskedImage to be measured. If a MaskedImage is provided, uncertainties will be returned as well as instFluxes.

  • [in] ellipse: Ellipse that defines the outer boundary of the aperture.

  • [in] ctrl: Control object.

template<typename T>
static Result computeFlux(afw::image::MaskedImage<T> const &image, afw::geom::ellipses::Ellipse const &ellipse, Control const &ctrl = Control())

Public Types

typedef ApertureFluxControl Control
typedef ApertureFluxResult Result

Result object returned by static methods.

Public Functions

ApertureFluxAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema, daf::base::PropertySet &metadata)

Construct the algorithm and add its fields to the given Schema.

virtual ~ApertureFluxAlgorithm()
virtual void measure(afw::table::SourceRecord &record, afw::image::Exposure<float> const &exposure) const = 0

Measure the configured apertures on the given image.

Python plugins will delegate to this method.

Parameters
  • [inout] record: Record used to save outputs and retrieve positions.

  • [in] exposure: Image to be measured.

virtual void fail(afw::table::SourceRecord &measRecord, MeasurementError *error = nullptr) const

Handle an exception thrown by the current algorithm by setting flags in the given record.

fail() is called by the measurement framework when an exception is allowed to propagate out of one the algorithm’s measure() methods. It should generally set both a general failure flag for the algorithm as well as a specific flag indicating the error condition, if possible. To aid in this, if the exception was an instance of MeasurementError, it will be passed in, carrying information about what flag to set.

An algorithm can also to chose to set flags within its own measure() methods, and then just return, rather than throw an exception. However, fail() should be implemented even when all known failure modes do not throw exceptions, to ensure that unexpected exceptions thrown in lower-level code are properly handled.

Public Static Functions

static FlagDefinitionList const &getFlagDefinitions()
static std::string makeFieldPrefix(std::string const &name, double radius)

Construct an appropriate prefix for table fields.

Given a plugin name (e.g. base_CircularApertureFlux) and an aperture radius (e.g. 12 pixels) return an appropriate prefix for table fields to contain the measurement results (e.g. base_CircularApertureFlux_12_0). Table fields can then be created named <prefix>_instFlux, <prefix>_instFluxErr, etc.

Return

Table field name prefix.

Parameters
  • [in] pluginName: Name of measurement plugin.

  • [in] radius: Aperture radius (pixels).

Public Static Attributes

unsigned int const N_FLAGS = 3
FlagDefinition const FAILURE
FlagDefinition const APERTURE_TRUNCATED
FlagDefinition const SINC_COEFFS_TRUNCATED

Protected Functions

void copyResultToRecord(Result const &result, afw::table::SourceRecord &record, int index) const
FlagHandler const &getFlagHandler(int index) const

Protected Attributes

Control const _ctrl
SafeCentroidExtractor _centroidExtractor

Private Members

std::vector<Keys> _keys
struct Keys

Public Functions

Keys(afw::table::Schema &schema, std::string const &prefix, std::string const &doc, bool isSinc)

Public Members

FluxResultKey instFluxKey
FlagHandler flags
class ApertureFluxControl
#include <ApertureFlux.h>

Configuration object for multiple-aperture flux algorithms

Public Functions

ApertureFluxControl()
lsst::meas::base::ApertureFluxControl::LSST_CONTROL_FIELD(radii, std::vector< double >, "Radius (in pixels) of apertures.")
lsst::meas::base::ApertureFluxControl::LSST_CONTROL_FIELD(maxSincRadius, double, "Maximum radius (in pixels) for which the sinc algorithm should be used instead of the " "faster naive algorithm. For elliptical apertures, this is the minor axis radius.")
lsst::meas::base::ApertureFluxControl::LSST_CONTROL_FIELD(shiftKernel, std::string, "Warping kernel used to shift Sinc photometry coefficients to different center positions")
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.

Public Functions

bool getFlag(unsigned int index) const

Return the flag value associated with the given bit.

bool getFlag(std::string const &name) const

Return the flag value associated with the given flag name.

void setFlag(unsigned int index, bool value = true)

Set the flag value associated with the given bit.

void unsetFlag(unsigned int index)

Clear (i.e. set to false) the flag associated with the given bit.

Private Members

std::bitset<ApertureFluxAlgorithm::N_FLAGS> _flags
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.

Public Types

typedef ApertureFluxControl Control

Public Functions

ApertureFluxTransform(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

Private Members

std::vector<MagResultKey> _magKeys
Control _ctrl