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;}
107 for (
int y = y0;
y != y1; ++
y) {
108 for (x_iterator ptr = image.
x_at(x0,
y),
end = image.
x_at(x1,
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.) :
147 if ( fabs(
getMean()) > policy.
getDouble(
"maximumFootprintResidualMean") )
return false;
148 if (
getRms() > policy.
getDouble(
"maximumFootprintResidualStd") )
return false;
void apply(lsst::afw::image::MaskedImage< PixelT > const &image)
std::shared_ptr< ImageStatistics > Ptr
virtual char const * what(void) const noexcept
virtual ~ImageStatistics()
void setBpMask(lsst::afw::image::MaskPixel bpMask)
#define LOGL_DEBUG(logger, message...)
lsst::afw::image::MaskedImage< PixelT >::x_iterator x_iterator
x_iterator x_at(int x, int y) const
StringArray getStringArray(const std::string &name) const
double getVariance() const
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Class to calculate difference image statistics.
double getDouble(const std::string &name) const
ImageStatistics(lsst::pex::policy::Policy const &policy)
#define LSST_EXCEPT(type,...)
bool evaluateQuality(lsst::pex::policy::Policy const &policy)
void apply(lsst::afw::image::MaskedImage< PixelT > const &image, int core)
lsst::afw::image::MaskPixel getBpMask()