def test_bin_centers(self):
# constructor
cnt = Counter()
for i in range(10):
cnt[i*2] = i
vc = ValueCounts(key='x', counts=cnt)
bin_specs = { 'bin_width': 1, 'bin_offset': 0 }
h = Histogram(vc, variable='x', bin_specs = bin_specs)
bin_centers = [0.5, 2.5, 4.5, 6.5, 8.5, 10.5, 12.5, 14.5, 16.5, 18.5]
h_bin_centers = h.bin_centers()
self.assertIsInstance(h_bin_centers, np.ndarray)
self.assertListEqual(h_bin_centers.tolist(), bin_centers)
评论列表
文章目录