LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
24 #include "ndarray/eigen.h"
40 FlagDefinitionList flagDefinitions;
79 double computeGaussianWidth(Method how = ADAPTIVE_MOMENT)
const;
80 double computeEffectiveArea()
const;
100 PsfAttributes::PsfAttributes(
111 double PsfAttributes::computeEffectiveArea()
const {
114 for (
int iY = 0; iY != _psfImage->getHeight(); ++iY) {
118 sumsqr += (*ptr) * (*ptr);
121 return sum * sum / sumsqr;
133 template <
typename T>
147 os <<
"fracShift = " << fracShift <<
" too large; abs value must be < 1 in both axes";
152 if (fracShift[0] < 0) {
153 warpingKernelPtr->setCtr(warpingKernelPtr->getCtr() +
geom::Extent2I(1, 0));
155 if (fracShift[1] < 0) {
156 warpingKernelPtr->setCtr(warpingKernelPtr->getCtr() +
geom::Extent2I(0, 1));
159 warpingKernelPtr->getDimensions());
162 os <<
"Warping kernel extends off the edge"
163 <<
"; kernel bbox = " << warpingOverlapBBox <<
"; exposure bbox = " << maskedImage.
getBBox();
166 warpingKernelPtr->setKernelParameters(
std::make_pair(fracShift[0], fracShift[1]));
167 KernelImageT warpingKernelImage(warpingKernelPtr->getDimensions());
168 warpingKernelPtr->computeImage(warpingKernelImage,
true);
169 typename KernelImageT::const_xy_locator
const warpingKernelLoc = warpingKernelImage.xy_at(0, 0);
174 typename MaskedImageT::const_xy_locator
const mimageLoc =
175 maskedImage.
xy_at(subimMin.getX(), subimMin.getY());
176 return afw::math::convolveAtAPoint<MaskedImageT, MaskedImageT>(
177 mimageLoc, warpingKernelLoc, warpingKernelPtr->getWidth(), warpingKernelPtr->getHeight());
191 geom::Point2D center = _centroidExtractor(measRecord, _flagHandler);
212 os <<
"Center = " << center <<
" not in exposure bbox" << mimage.getBBox();
221 geom::Point2I ctrPixParentInd(xCtrPixParentIndFrac.first, yCtrPixParentIndFrac.first);
226 PsfAttributes psfAttr(psfPtr, ctrPixParentInd);
227 double weight = psfAttr.computeEffectiveArea();
235 geom::Point2D(xCtrPixParentIndFrac.second, yCtrPixParentIndFrac.second), ctrPixParentInd);
236 double instFlux = mimageCtrPix.image() *
weight;
238 result.instFlux = instFlux;
240 measRecord.
set(_instFluxResultKey,
result);
static FlagDefinition const FAILURE
std::shared_ptr< lsst::afw::detection::Psf const > getPsf() const
Return the Exposure's Psf object.
xy_locator xy_at(int x, int y) const
Return an xy_locator at the point (x, y)
A reusable result struct for instFlux measurements.
int positionToIndex(double pos)
Convert image position to nearest integer index.
void handleFailure(afw::table::BaseRecord &record, MeasurementError const *error=nullptr) const
Handle an expected or unexpected Exception thrown by a measurement algorithm.
Record class that contains measurements made on a single exposure.
A single pixel of the same type as a MaskedImage.
C++ control object for peak likelihood instrument flux.
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Reports when the result of an operation cannot be represented by the destination type.
Angle abs(Angle const &a)
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.
std::shared_ptr< SeparableKernel > makeWarpingKernel(std::string name)
Return a warping kernel given its name.
Exception to be thrown when a measurement algorithm experiences a known failure mode.
bool hasPsf() const
Does this Exposure have a Psf?
Defines the fields and offsets for a table.
lsst::geom::Box2I getBBox(ImageOrigin const origin=PARENT) const
Point2I const getMin() const noexcept
double indexToPosition(double ind)
Convert image index to image position.
PeakLikelihoodFluxAlgorithm(Control const &ctrl, std::string const &name, afw::table::Schema &schema)
A FunctorKey for FluxResult.
MaskedImageT getMaskedImage()
Return the MaskedImage.
afw::table::Key< std::string > warpingKernelName
vector-type utility class to build a collection of FlagDefinitions
std::string warpingKernelName
"Name of warping kernel (e.g. \"lanczos4") used to compute the peak" ;
void setValue(afw::table::BaseRecord &record, std::size_t i, bool value) const
Set the flag field corresponding to the given flag index.
A class to manipulate images, masks, and variance as a single object.
bool contains(Point2I const &point) const noexcept
Return true if the box contains the point.
virtual void measure(afw::table::SourceRecord &measRecord, afw::image::Exposure< float > const &exposure) const
Called to measure a single child source in an image.
afw::image::MaskedImage< T >::SinglePixel computeShiftedValue(afw::image::MaskedImage< T > const &maskedImage, std::string const &warpingKernelName, geom::Point2D const &fracShift, geom::Point2I const &parentInd)
Compute the value of one pixel of an image after a fractional pixel shift Since we only want the valu...
#define CONST_PTR(...)
A shared pointer to a const object.
afw::table::Key< double > weight
_view_t::x_iterator x_iterator
An iterator for traversing the pixels in a row.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Reports invalid arguments.
std::vector< double > PointD
Vector of double; used for bounds, points.
An integer coordinate rectangle.
A polymorphic base class for representing an image's Point Spread Function.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
A floating-point coordinate rectangle geometry.
A class to represent a 2-dimensional array of pixels.
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
static FlagHandler addFields(afw::table::Schema &schema, std::string const &prefix, FlagDefinitionList const &flagDefs, FlagDefinitionList const &exclDefs=FlagDefinitionList::getEmptyList())
Add Flag fields to a schema, creating a FlagHandler object to manage them.
static FlagDefinitionList const & getFlagDefinitions()