#include <CircularApertureFlux.h>
|
| CircularApertureFluxAlgorithm (Control const &ctrl, std::string const &name, afw::table::Schema &schema, daf::base::PropertySet &metadata) |
|
virtual void | measure (afw::table::SourceRecord &record, afw::image::Exposure< float > const &exposure) const |
| Measure the configured apertures on the given image. More...
|
|
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. More...
|
|
virtual void | measureForced (afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure, afw::table::SourceRecord const &refRecord, afw::geom::SkyWcs const &refWcs) const |
| Called to measure a single child source in an image. More...
|
|
virtual void | measureNForced (afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure, afw::table::SourceCatalog const &refRecord, afw::geom::SkyWcs const &refWcs) const |
| Called to simultaneously measure all children in a deblend family, in a single image. More...
|
|
virtual void | measureN (afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure) const |
| Called to simultaneously measure all children in a deblend family, in a single image. More...
|
|
std::string | getLogName () const |
|
|
static FlagDefinitionList const & | getFlagDefinitions () |
|
static std::string | makeFieldPrefix (std::string const &name, double radius) |
| Construct an appropriate prefix for table fields. More...
|
|
|
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. More...
|
|
template<typename T > |
static Result | computeSincFlux (afw::image::MaskedImage< 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. More...
|
|
|
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. More...
|
|
template<typename T > |
static Result | computeNaiveFlux (afw::image::MaskedImage< 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. More...
|
|
|
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. More...
|
|
template<typename T > |
static Result | computeFlux (afw::image::MaskedImage< 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. More...
|
|
Definition at line 40 of file CircularApertureFlux.h.
◆ Control
◆ Result
Result object returned by static methods.
Definition at line 92 of file ApertureFlux.h.
◆ CircularApertureFluxAlgorithm()
Definition at line 33 of file CircularApertureFlux.cc.
37 for (
std::size_t i = 0; i < ctrl.radii.size(); ++i) {
38 if (ctrl.radii[i] > ctrl.maxSincRadius)
break;
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.
static void cache(float rInner, float rOuter)
Cache the coefficients for a particular aperture.
◆ computeFlux() [1/2]
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. |
Definition at line 221 of file ApertureFlux.cc.
224 return (afw::geom::ellipses::Axes(
ellipse.getCore()).getB() <= ctrl.maxSincRadius)
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...
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...
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
◆ computeFlux() [2/2]
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. |
Definition at line 230 of file ApertureFlux.cc.
233 return (afw::geom::ellipses::Axes(
ellipse.getCore()).getB() <= ctrl.maxSincRadius)
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...
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...
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
◆ computeNaiveFlux() [1/2]
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. |
Definition at line 174 of file ApertureFlux.cc.
185 spanIter != spanEnd; ++spanIter) {
187 image.x_at(spanIter->getBeginX() -
image.getX0(), spanIter->getY() -
image.getY0());
188 result.instFlux +=
std::accumulate(pixIter, pixIter + spanIter->getWidth(), 0.0);
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
FastFinder::Iterator Iterator
static FlagDefinition const FAILURE
static FlagDefinition const APERTURE_TRUNCATED
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
ApertureFluxResult Result
Result object returned by static methods.
◆ computeNaiveFlux() [2/2]
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. |
Definition at line 194 of file ApertureFlux.cc.
204 result.instFlux = 0.0;
205 result.instFluxErr = 0.0;
207 spanIter != spanEnd; ++spanIter) {
209 spanIter->getBeginX() -
image.getX0(), spanIter->getY() -
image.getY0());
211 spanIter->getBeginX() -
image.getX0(), spanIter->getY() -
image.getY0());
212 result.instFlux +=
std::accumulate(pixIter, pixIter + spanIter->getWidth(), 0.0);
214 result.instFluxErr +=
std::accumulate(varIter, varIter + spanIter->getWidth(), 0.0);
216 result.instFluxErr =
std::sqrt(result.instFluxErr);
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
FastFinder::Iterator Iterator
static FlagDefinition const FAILURE
static FlagDefinition const APERTURE_TRUNCATED
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
ApertureFluxResult Result
Result object returned by static methods.
◆ computeSincFlux() [1/2]
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. |
Definition at line 144 of file ApertureFlux.cc.
149 afw::image::Image<T> subImage(
image, cImage->getBBox());
151 (ndarray::asEigenArray(subImage.getArray()) * ndarray::asEigenArray(cImage->getArray())).sum();
#define CONST_PTR(...)
A shared pointer to a const object.
static FlagDefinition const APERTURE_TRUNCATED
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
ApertureFluxResult Result
Result object returned by static methods.
◆ computeSincFlux() [2/2]
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. |
Definition at line 156 of file ApertureFlux.cc.
163 result.instFlux = (ndarray::asEigenArray(subImage.getImage()->getArray()) *
164 ndarray::asEigenArray(cImage->getArray()))
167 std::sqrt((ndarray::asEigenArray(subImage.getVariance()->getArray()).
template cast<T>() *
168 ndarray::asEigenArray(cImage->getArray()).square())
#define CONST_PTR(...)
A shared pointer to a const object.
static FlagDefinition const APERTURE_TRUNCATED
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
ApertureFluxResult Result
Result object returned by static methods.
◆ copyResultToRecord()
Definition at line 94 of file ApertureFlux.cc.
96 record.set(_keys[index].instFluxKey,
result);
static FlagDefinition const FAILURE
static FlagDefinition const APERTURE_TRUNCATED
static FlagDefinition const SINC_COEFFS_TRUNCATED
◆ fail()
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.
Implements lsst::meas::base::BaseAlgorithm.
Definition at line 85 of file ApertureFlux.cc.
90 _keys[i].flags.handleFailure(measRecord,
error);
std::vector< double > radii
"Radius (in pixels) of apertures." ;
◆ getFlagDefinitions()
FlagDefinitionList const & lsst::meas::base::ApertureFluxAlgorithm::getFlagDefinitions |
( |
| ) |
|
|
staticinherited |
◆ getFlagHandler()
FlagHandler const& lsst::meas::base::ApertureFluxAlgorithm::getFlagHandler |
( |
int |
index | ) |
const |
|
inlineprotectedinherited |
◆ getLogName()
std::string lsst::meas::base::BaseAlgorithm::getLogName |
( |
| ) |
const |
|
inlineinherited |
◆ makeFieldPrefix()
std::string lsst::meas::base::ApertureFluxAlgorithm::makeFieldPrefix |
( |
std::string const & |
name, |
|
|
double |
radius |
|
) |
| |
|
staticinherited |
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.
- Parameters
-
[in] | pluginName | Name of measurement plugin. |
[in] | radius | Aperture radius (pixels). |
- Returns
- Table field name prefix.
Definition at line 57 of file ApertureFlux.cc.
59 return boost::replace_all_copy(prefix,
".",
"_");
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
◆ measure()
Measure the configured apertures on the given image.
Python plugins will delegate to this method.
- Parameters
-
[in,out] | record | Record used to save outputs and retrieve positions. |
[in] | exposure | Image to be measured. |
Implements lsst::meas::base::ApertureFluxAlgorithm.
Definition at line 43 of file CircularApertureFlux.cc.
45 afw::geom::ellipses::Ellipse
ellipse(afw::geom::ellipses::Axes(1.0, 1.0, 0.0));
46 PTR(afw::geom::ellipses::Axes)
void copyResultToRecord(Result const &result, afw::table::SourceRecord &record, int index) const
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...
FlagHandler const & getFlagHandler(int index) const
T static_pointer_cast(T... args)
std::vector< double > radii
"Radius (in pixels) of apertures." ;
ApertureFluxResult Result
Result object returned by static methods.
SafeCentroidExtractor _centroidExtractor
◆ measureForced()
◆ measureN()
Called to simultaneously measure all children in a deblend family, in a single image.
Outputs should be saved in the given SourceCatalog, which can also be used to obtain centroid (see SafeCentroidExtractor) and shape (see SafeShapeExtractor) information.
The default implementation simply throws an exception, indicating that simultaneous measurement is not supported.
Definition at line 31 of file Algorithm.cc.
33 throw LSST_EXCEPT(pex::exceptions::LogicError,
"measureN not implemented for this algorithm");
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
◆ measureNForced()
Called to simultaneously measure all children in a deblend family, in a single image.
Outputs should be saved in the given SourceCatalog, which can also be used to obtain centroid (see SafeCentroidExtractor) and shape (see SafeShapeExtractor) information.
The default implementation simply throws an exception, indicating that simultaneous measurement is not supported.
Reimplemented from lsst::meas::base::ForcedAlgorithm.
Definition at line 179 of file Algorithm.h.
virtual void measureN(afw::table::SourceCatalog const &measCat, afw::image::Exposure< float > const &exposure) const
Called to simultaneously measure all children in a deblend family, in a single image.
◆ _centroidExtractor
◆ _ctrl
Control const lsst::meas::base::ApertureFluxAlgorithm::_ctrl |
|
protectedinherited |
◆ _logName
◆ APERTURE_TRUNCATED
FlagDefinition const lsst::meas::base::ApertureFluxAlgorithm::APERTURE_TRUNCATED |
|
staticinherited |
Initial value:=
flagDefinitions.add("flag_apertureTruncated", "aperture did not fit within measurement image")
Definition at line 86 of file ApertureFlux.h.
◆ FAILURE
FlagDefinition const lsst::meas::base::ApertureFluxAlgorithm::FAILURE = flagDefinitions.addFailureFlag() |
|
staticinherited |
◆ N_FLAGS
unsigned int const lsst::meas::base::ApertureFluxAlgorithm::N_FLAGS = 3 |
|
staticinherited |
◆ SINC_COEFFS_TRUNCATED
FlagDefinition const lsst::meas::base::ApertureFluxAlgorithm::SINC_COEFFS_TRUNCATED |
|
staticinherited |
Initial value:= flagDefinitions.add(
"flag_sincCoeffsTruncated", "full sinc coefficient image did not fit within measurement image")
Definition at line 87 of file ApertureFlux.h.
The documentation for this class was generated from the following files: