Пример #1
0
 def test_2_to_1(self):
     data1 = np.random.rand(100)
     data2 = np.random.rand(100)
     h = physt.histogram2d(data1, data2, (4, 5), axis_names=["1", "2"])
     h2 = h.projection(1)
     assert isinstance(h2, Histogram1D)
     assert h2.total == h.total
     assert h2.axis_name == "2"
     assert h2.shape == h2.frequencies.shape
     assert h2.shape == (5, )
Пример #2
0
 def test_shapes(self):
     data1 = np.random.rand(100)
     data2 = np.random.rand(100)
     h = physt.histogram2d(data1, data2, (4, 5), axis_names=["1", "2"])
     assert h[2].shape == (5, )
     assert h[:, 2].shape == (4, )
Пример #3
0
 def test_total_size(self):
     data = np.random.rand(100)
     h = physt.histogram2d(data, data, range=(0, 0.5))
     assert h.total_size == 0.25
Пример #4
0
 def test_slicing_with_upper_bound_only(self):
     data1 = np.random.rand(100)
     data2 = np.random.rand(100)
     h = physt.histogram2d(data1, data2, (4, 5), axis_names=["1", "2"])
     assert h[:2].shape == (2, 5)