def test_hmtk_histogram_1D_general(self):
     """
     Tests the 1D hmtk histogram with the general case (i.e. no edge-cases)
     Should be exactly equivalent to numpy's histogram function
     """
     xdata = np.random.uniform(0., 10., 100)
     xbins = np.arange(0., 11., 1.)
     np.testing.assert_array_almost_equal(
         utils.hmtk_histogram_1D(xdata, xbins),
         np.histogram(xdata, bins=xbins)[0].astype(float))
 def test_hmtk_histogram_1D_general(self):
     """
     Tests the 1D hmtk histogram with the general case (i.e. no edge-cases)
     Should be exactly equivalent to numpy's histogram function
     """
     xdata = np.random.uniform(0., 10., 100)
     xbins = np.arange(0., 11., 1.)
     np.testing.assert_array_almost_equal(
         utils.hmtk_histogram_1D(xdata, xbins),
         np.histogram(xdata, bins=xbins)[0].astype(float))
 def test_hmtk_histogram_1D_edgecase(self):
     """
     Tests the 1D hmtk histogram with edge cases
     Should be exactly equivalent to numpy's histogram function
     """
     xdata = np.array([3.1, 4.1, 4.56, 4.8, 5.2])
     xbins = np.arange(3.0, 5.35, 0.1)
     expected_counter = np.array([0., 1., 0., 0., 0., 0., 0., 0., 0., 0.,
                                   0., 1., 0., 0., 0., 1., 0., 0., 1., 0.,
                                   0., 0., 1.])
     np.testing.assert_array_almost_equal(
         utils.hmtk_histogram_1D(xdata, xbins),
         expected_counter)
 def test_hmtk_histogram_1D_edgecase(self):
     """
     Tests the 1D hmtk histogram with edge cases
     Should be exactly equivalent to numpy's histogram function
     """
     xdata = np.array([3.1, 4.1, 4.56, 4.8, 5.2])
     xbins = np.arange(3.0, 5.35, 0.1)
     expected_counter = np.array([
         0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 1., 0.,
         0., 1., 0., 0., 0., 1.
     ])
     np.testing.assert_array_almost_equal(
         utils.hmtk_histogram_1D(xdata, xbins), expected_counter)