Exemple #1
0
    def test_int_behaviour(self):
        data = np.random.rand(100)
        the_binning = binnings.numpy_binning(data, 10)
        assert np.allclose(the_binning.numpy_bins, np.histogram(data, 10)[1])

        the_binning = binnings.numpy_binning(data, 10, range=(0.2, 1.0))
        assert np.allclose(the_binning.numpy_bins, np.histogram(data, 10, range=(0.2, 1.0))[1])
Exemple #2
0
    def test_int_behaviour(self):
        data = np.random.rand(100)
        the_binning = binnings.numpy_binning(data, 10)
        assert np.allclose(the_binning.numpy_bins, np.histogram(data, 10)[1])

        the_binning = binnings.numpy_binning(data, 10, range=(0.2, 1.0))
        assert np.allclose(the_binning.numpy_bins, np.histogram(data, 10, range=(0.2, 1.0))[1])
Exemple #3
0
 def test_bin_list_behaviour(self):
     data = np.random.rand(100)
     edges = [0.3, 4.5, 5.3, 8.6]
     the_binning = binnings.numpy_binning(data, edges)
     assert np.allclose(the_binning.numpy_bins, edges)
     assert np.allclose(the_binning.numpy_bins,
                        np.histogram(data, edges)[1])
Exemple #4
0
 def test_bin_list_behaviour(self):
     data = np.random.rand(100)
     edges = [0.3, 4.5, 5.3, 8.6]
     the_binning = binnings.numpy_binning(data, edges)
     assert np.allclose(the_binning.numpy_bins, edges)
     assert np.allclose(the_binning.numpy_bins, np.histogram(data, edges)[1])