33LOG_LOGGER _log =
LOG_GET(
"lsst.jointcal.Histo2d");
39Histo2d::Histo2d(
int nnx,
float mminx,
float mmaxx,
int nny,
float mminy,
float mmaxy) :
data(nnx * nny, 0.) {
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");
64 scalex = other.scalex;
65 scaley = other.scaley;
68bool Histo2d::indices(
double x,
double y,
int &ix,
int &iy)
const {
70 if (ix < 0 || ix >= nx)
return false;
72 return (iy >= 0 && iy < ny);
77 if (indices(
x,
y, ix, iy)) data[iy + ny * ix] +=
weight;
85 if (data[i] > valmax) {
91 int iy = imax - ix * ny;
92 x = minx + ((float)ix + 0.5) / scalex;
93 y = miny + ((float)iy + 0.5) / scaley;
99 if (indices(
x,
y, ix, iy)) data[iy + ny * ix] = 0;
104 if (indices(
x,
y, ix, iy))
return data[iy + ny * ix];
105 LOGL_WARN(_log,
"Histo2D::binContent outside limits requested");
afw::table::Key< double > weight
#define LOGL_WARN(logger, message...)
double maxBin(double &x, double &y) const
double binContent(double x, double y) const
void zeroBin(double x, double y)
void fill(float x, float y, float weight=1.)
Class for a simple mapping implementing a generic AstrometryTransform.