LSSTApplications
21.0.0+75b29a8a7f,21.0.0+e70536a077,21.0.0-1-ga51b5d4+62c747d40b,21.0.0-11-ga6ea59e8e+47cba9fc36,21.0.0-2-g103fe59+914993bf7c,21.0.0-2-g1367e85+e2614ded12,21.0.0-2-g45278ab+e70536a077,21.0.0-2-g4bc9b9f+7b2b5f8678,21.0.0-2-g5242d73+e2614ded12,21.0.0-2-g54e2caa+6403186824,21.0.0-2-g7f82c8f+3ac4acbffc,21.0.0-2-g8dde007+04a6aea1af,21.0.0-2-g8f08a60+9402881886,21.0.0-2-ga326454+3ac4acbffc,21.0.0-2-ga63a54e+81dd751046,21.0.0-2-gc738bc1+5f65c6e7a9,21.0.0-2-gde069b7+26c92b3210,21.0.0-2-gecfae73+0993ddc9bd,21.0.0-2-gfc62afb+e2614ded12,21.0.0-21-gba890a8+5a4f502a26,21.0.0-23-g9966ff26+03098d1af8,21.0.0-3-g357aad2+8ad216c477,21.0.0-3-g4be5c26+e2614ded12,21.0.0-3-g6d51c4a+4d2fe0280d,21.0.0-3-g7d9da8d+75b29a8a7f,21.0.0-3-gaa929c8+522e0f12c2,21.0.0-3-ge02ed75+4d2fe0280d,21.0.0-4-g3300ddd+e70536a077,21.0.0-4-gc004bbf+eac6615e82,21.0.0-4-gccdca77+f94adcd104,21.0.0-4-gd1c1571+18b81799f9,21.0.0-5-g7b47fff+4d2fe0280d,21.0.0-5-gb155db7+d2632f662b,21.0.0-5-gdf36809+637e4641ee,21.0.0-6-g722ad07+28c848f42a,21.0.0-7-g959bb79+522e0f12c2,21.0.0-7-gfd72ab2+cf01990774,21.0.0-9-g87fb7b8d+e2ab11cdd6,w.2021.04
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
26 #include "boost/algorithm/string.hpp"
28 #include "ndarray/eigen.h"
40 FlagDefinitionList flagDefinitions;
45 flagDefinitions.add(
"flag_apertureTruncated",
"aperture did not fit within measurement image");
47 "flag_sincCoeffsTruncated",
"full sinc coefficient image did not fit within measurement image");
53 static std::array<double, 10> defaultRadii = {{3.0, 4.5, 6.0, 9.0, 12.0, 17.0, 25.0, 35.0, 50.0, 70.0}};
59 return boost::replace_all_copy(
prefix,
".",
"_");
75 : _ctrl(ctrl), _centroidExtractor(
schema,
name) {
79 boost::to_upper(upperName);
80 metadata.
add(upperName +
"_RADII", ctrl.
radii[i]);
92 _keys[i].flags.handleFailure(measRecord,
error);
98 record.
set(_keys[index].instFluxKey,
result);
114 template <
typename T>
124 if (!
bbox.contains(cImage->getBBox())) {
138 cImage = std::make_shared<afw::image::Image<T> >(*cImage, overlap);
145 template <
typename T>
153 (ndarray::asEigenArray(subImage.
getArray()) * ndarray::asEigenArray(cImage->getArray())).sum();
157 template <
typename T>
165 result.instFlux = (ndarray::asEigenArray(subImage.
getImage()->getArray()) *
166 ndarray::asEigenArray(cImage->getArray()))
170 ndarray::asEigenArray(cImage->getArray()).square())
175 template <
typename T>
187 spanIter != spanEnd; ++spanIter) {
189 image.x_at(spanIter->getBeginX() -
image.getX0(), spanIter->getY() -
image.getY0());
195 template <
typename T>
209 spanIter != spanEnd; ++spanIter) {
211 spanIter->getBeginX() -
image.getX0(), spanIter->getY() -
image.getY0());
213 spanIter->getBeginX() -
image.getX0(), spanIter->getY() -
image.getY0());
222 template <
typename T>
231 template <
typename T>
239 #define INSTANTIATE(T) \
240 template ApertureFluxAlgorithm::Result ApertureFluxAlgorithm::computeFlux( \
241 afw::image::Image<T> const &, afw::geom::ellipses::Ellipse const &, Control const &); \
242 template ApertureFluxAlgorithm::Result ApertureFluxAlgorithm::computeFlux( \
243 afw::image::MaskedImage<T> const &, afw::geom::ellipses::Ellipse const &, Control const &); \
244 template ApertureFluxAlgorithm::Result ApertureFluxAlgorithm::computeSincFlux( \
245 afw::image::Image<T> const &, afw::geom::ellipses::Ellipse const &, Control const &); \
246 template ApertureFluxAlgorithm::Result ApertureFluxAlgorithm::computeSincFlux( \
247 afw::image::MaskedImage<T> const &, afw::geom::ellipses::Ellipse const &, Control const &); \
248 template ApertureFluxAlgorithm::Result ApertureFluxAlgorithm::computeNaiveFlux( \
249 afw::image::Image<T> const &, afw::geom::ellipses::Ellipse const &, Control const &); \
250 template ApertureFluxAlgorithm::Result ApertureFluxAlgorithm::computeNaiveFlux( \
251 afw::image::MaskedImage<T> const &, afw::geom::ellipses::Ellipse const &, Control const &)
268 .find<afw::table::Flag>(
291 for (; inSrc != inputCatalog.end() && outSrc != outputCatalog.
end(); ++inSrc, ++outSrc) {
293 FluxResult instFluxResult = instFluxKeys[i].get(*inSrc);
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
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...
lsst::geom::Box2I const & getBBox() const
Return the bounding box of the pixel region.
meas::base::Flux instFlux
Measured instFlux in DN.
A reusable result struct for instFlux measurements.
static FlagDefinition const APERTURE_TRUNCATED
Record class that contains measurements made on a single exposure.
std::vector< Span >::const_iterator Iterator
Iterator type used by begin() and end().
double const getB() const
table::Key< table::Array< std::uint8_t > > wcs
lsst::geom::Box2D computeBBox() const
Return the bounding box of the ellipse.
void add(std::string const &name, T const &value)
Append a single value to the vector of values for a property name (possibly hierarchical).
Exception to be thrown when a measurement algorithm experiences a known failure mode.
Defines the fields and offsets for a table.
An ellipse core for the semimajor/semiminor axis and position angle parametrization (a,...
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
A 2-dimensional celestial WCS that transform pixels to ICRS RA/Dec, using the LSST standard for pixel...
int getWidth() const
Return the number of columns in the image.
A Result struct for running an aperture flux algorithm with a single radius.
A FunctorKey for FluxResult.
std::string shiftKernel
"Warping kernel used to shift Sinc photometry coefficients to different center positions" ;
static FlagDefinition const FAILURE
static boost::shared_ptr< CoeffT const > get(afw::geom::ellipses::Axes const &outerEllipse, float const innerRadiusFactor=0.0)
Get the coefficients for an aperture.
vector-type utility class to build a collection of FlagDefinitions
meas::base::FluxErrElement instFluxErr
Standard deviation of instFlux in DN.
A class to manipulate images, masks, and variance as a single object.
double maxSincRadius
"Maximum radius (in pixels) for which the sinc algorithm should be used instead of the " "faster naiv...
Utility class for handling flag fields that indicate the failure modes of an algorithm.
Iterator begin() const
Iterator range over Spans whose pixels are within the Ellipse.
void copyResultToRecord(Result const &result, afw::table::SourceRecord &record, int index) const
lsst::geom::Point2D const & getCenter() const
Return the center point.
bool contains(Point2I const &point) const noexcept
Return true if the box contains the point.
A mapping between the keys of two Schemas, used to copy data between them.
static MagResultKey addFields(afw::table::Schema &schema, std::string const &name)
Add a pair of _mag, _magErr fields to a Schema, and return a MagResultKey that points to them.
Iterator class for CatalogT.
The photometric calibration of an exposure.
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
static std::string makeFieldPrefix(std::string const &name, double radius)
Construct an appropriate prefix for table fields.
A base class for image defects.
VariancePtr getVariance() const
Return a (shared_ptr to) the MaskedImage's variance.
An ellipse defined by an arbitrary BaseCore and a center point.
A pixelized region containing all pixels whose centers are within an Ellipse.
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.
std::size_t size() const
return the current size (number of defined elements) of the collection
static FlagDefinitionList const & getFlagDefinitions()
Simple class used to define and document flags The name and doc constitute the identity of the FlagDe...
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.
std::vector< double > radii
"Radius (in pixels) of apertures." ;
void clip(Box2I const &other) noexcept
Shrink this to ensure that other.contains(*this).
std::shared_ptr< ImageT > offsetImage(ImageT const &image, float dx, float dy, std::string const &algorithmName="lanczos5", unsigned int buffer=0)
Return an image offset by (dx, dy) using the specified algorithm.
Class for storing generic metadata.
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.
An integer coordinate rectangle.
ImagePtr getImage() const
Return a (shared_ptr to) the MaskedImage's image.
Base class for multiple-aperture photometry algorithms.
BaseCore const & getCore() const
Return the ellipse core.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Configuration object for multiple-aperture flux algorithms.
A class to represent a 2-dimensional array of pixels.
iterator begin()
Iterator access.
#define CONST_PTR(...)
A shared pointer to a const object.
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.
int getWidth() const
Return the number of columns in the image.
static FlagDefinition const SINC_COEFFS_TRUNCATED