def test_hist_bins(self): """ test hist_bins """ x = asarray([3., 4.12310563, 4.24264069, 4.47213595, 5., 5., 5., 5., 5.38516481, 5.65685425, 6.40312424, 6.40312424, 6.70820393, 7.,7.07106781, 7.07106781, 7.28010989, 7.81024968, 8., 8.06225775, 8.06225775, 8.24621125, 9., 9.48683298, 9.48683298, 9.89949494, 9.89949494, 10., 10.04987562, 10.04987562]) bins = [2.0, 5.0, 7.5, 10.0, 11.0] hist_res = [0., 8., 9., 11., 2.] vals, hist = hist_bins(bins , x) self.assertFloatEqual(vals, bins) self.assertFloatEqual(hist, hist_res)
def test_hist_bins(self): """ test hist_bins """ x = asarray([3., 4.12310563, 4.24264069, 4.47213595, 5., 5., 5., 5., 5.38516481, 5.65685425, 6.40312424, 6.40312424, 6.70820393, 7.,7.07106781, 7.07106781, 7.28010989, 7.81024968, 8., 8.06225775, 8.06225775, 8.24621125, 9., 9.48683298, 9.48683298, 9.89949494, 9.89949494, 10., 10.04987562, 10.04987562]) bins = [2.0, 5.0, 7.5, 10.0, 11.0] hist_res = [0., 8., 9., 11., 2.] vals, hist = hist_bins(bins , x) self.assertFloatEqual(vals, bins) self.assertFloatEqual(hist, hist_res)