예제 #1
0
    def test_from_binned_data(self):
        bins = np.linspace(0, 10, 11)
        iris_bc, iris_be = np.histogram(self.iris_sepal_length, bins=bins)

        iris_hist = Hist1d.from_binned_data(bin_counts=iris_bc,
                                            bin_edges=iris_be)

        np.testing.assert_array_equal(iris_hist.bin_counts, iris_bc)
        np.testing.assert_array_equal(iris_hist.bin_errors, np.sqrt(iris_bc))
        np.testing.assert_array_equal(iris_hist.bin_edges, iris_be)
예제 #2
0
 def y_projection(self):
     return Hist1d.from_binned_data(
         np.sum(self.bin_counts, axis=0),
         self.y_edges,
         np.sqrt(np.sum(self._bin_errors_sq, axis=0))
     )