def test_histogram3do2w(self): # in this special case, cf.histogram2d and np.histogram2d must yield equal results # check hist and edges cfh, cfex, cfey, cfez = cf.histogram3d(self.datax, self.datay, self.dataz, weights=self.weights, bins=(20,30,40), range=((0,1), (0,2), (0,3)), shape=2) totalmass = np.sum(self.weights) self.assertAlmostEqual(np.sum(cfh.base) - totalmass, 0)
def test_histogram3do3w(self): cfh, cfex, cfey, cfez = cf.histogram3d(self.datax, self.datay, self.dataz, weights=self.weights, bins=(20,30,40), range=((0,1), (0,2), (0,3)), shape=3) totalmass = np.sum(self.weights) self.assertAlmostEqual(np.sum(cfh.base) - totalmass, 0)