| 547 | self.assertEqual(get(h, i, j).value, m[i][j]) |
| 548 | |
| 549 | def test_add_2d(self): |
| 550 | for uoflow in (False, True): |
| 551 | h = histogram(integer(-1, 2, uoflow=uoflow), |
| 552 | regular(4, -2, 2, uoflow=uoflow)) |
| 553 | h(-1, -2) |
| 554 | h(-1, -1) |
| 555 | h(0, 0) |
| 556 | h(0, 1) |
| 557 | h(1, 0) |
| 558 | h(3, -1) |
| 559 | h(0, -3) |
| 560 | |
| 561 | m = [[1, 1, 0, 0, 0, 0], |
| 562 | [0, 0, 1, 1, 0, 1], |
| 563 | [0, 0, 1, 0, 0, 0], |
| 564 | [0, 1, 0, 0, 0, 0], |
| 565 | [0, 0, 0, 0, 0, 0]] |
| 566 | |
| 567 | h += h |
| 568 | |
| 569 | for i in range(-uoflow, len(h.axis(0)) + uoflow): |
| 570 | for j in range(-uoflow, len(h.axis(1)) + uoflow): |
| 571 | self.assertEqual(h.at(i, j).value, 2 * m[i][j]) |
| 572 | self.assertEqual(h.at(i, j).variance, 2 * m[i][j]) |
| 573 | |
| 574 | def test_add_2d_bad(self): |
| 575 | a = histogram(integer(-1, 1)) |