39 Histo2d::Histo2d(
int nnx,
float mminx,
float mmaxx,
int nny,
float mminy,
float mmaxy) {
45 scalex = nx / (mmaxx - mminx);
47 LOGL_WARN(_log,
"Histo2d: minx = maxx requested");
51 scaley = ny / (mmaxy - mminy);
53 LOGL_WARN(_log,
"Histo2d: maxy = miny requested");
56 data.
reset(
new float[nx * ny]);
62 data.
reset(
new float[nx * ny]);
66 bool Histo2d::indices(
double x,
double y,
int &ix,
int &iy)
const {
68 if (ix < 0 || ix >= nx)
return false;
70 return (iy >= 0 && iy < ny);
75 if (indices(x, y, ix, iy)) data[iy + ny * ix] +=
weight;
83 for (p = data.
get(), pend = p + nx * ny; pend - p; p++) {
86 imax = p - (data.
get());
90 int iy = imax - ix * ny;
91 x = minx + ((
float)ix + 0.5) / scalex;
92 y = miny + ((
float)iy + 0.5) / scaley;
98 if (indices(x, y, ix, iy)) data[iy + ny * ix] = 0;
103 if (indices(x, y, ix, iy))
return data[iy + ny * ix];
104 LOGL_WARN(_log,
"Histo2D::binContent outside limits requested");
double binContent(double x, double y) const
void fill(float x, float y, float weight=1.)
void zeroBin(double x, double y)
double maxBin(double &x, double &y) const
LSST DM logging module built on log4cxx.
A base class for image defects.
#define LOGL_WARN(logger, message...)
Log a warn-level message using a varargs/printf style interface.
afw::table::Key< double > weight
ItemVariant const * other
#define LOG_GET(logger)
Returns a Log object associated with logger.