35 #ifndef LSST_IP_DIFFIM_IMAGESTATISTICS_H
36 #define LSST_IP_DIFFIM_IMAGESTATISTICS_H
58 template <
typename PixelT>
65 _xsum(0.), _x2sum(0.), _npix(0), _bpMask(0) {
69 mi != detBadMaskPlanes.
end(); ++mi){
75 "Cannot update bad bit mask with %s", (*mi).c_str());
84 void reset() { _xsum = _x2sum = 0.; _npix = 0;}
96 y1 =
image.getHeight();
98 x1 =
image.getWidth();
107 for (
int y = y0;
y != y1; ++
y) {
110 if (!((*ptr).mask() & _bpMask)) {
111 double const ivar = 1. / (*ptr).variance();
113 _xsum += (*ptr).image() * sqrt(ivar);
114 _x2sum += (*ptr).image() * (*ptr).image() * ivar;
122 "Nan/Inf in ImageStatistics.apply");
135 return (_npix > 1) ? (_x2sum/_npix - _xsum/_npix * _xsum/_npix) * _npix/(_npix-1.) :
#define LSST_EXCEPT(type,...)
#define LOGL_DEBUG(logger, message...)
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
std::vector< T > getArray(std::string const &name) const
double getAsDouble(std::string const &name) const
Class to calculate difference image statistics.
void setBpMask(lsst::afw::image::MaskPixel bpMask)
ImageStatistics(lsst::daf::base::PropertySet const &ps)
void apply(lsst::afw::image::MaskedImage< PixelT > const &image, int core)
void apply(lsst::afw::image::MaskedImage< PixelT > const &image)
std::shared_ptr< ImageStatistics > Ptr
virtual ~ImageStatistics()
double getVariance() const
lsst::afw::image::MaskedImage< PixelT >::x_iterator x_iterator
bool evaluateQuality(lsst::daf::base::PropertySet const &ps)
lsst::afw::image::MaskPixel getBpMask()
virtual char const * what(void) const noexcept