Example #1
0
 def test_dist_bray_curtis_magurran2(self):
     """ should match hand-calculated values"""
     res = dist_bray_curtis_magurran(
         numpy.array([[1, 4, 3], [1, 3, 5], [0, 2, 0]]))
     assert_allclose(
         res,
         numpy.array([
             [0, 1 - 14 / 17, 1 - (0.4)],
             [1 - 14 / 17, 0, 1 - 4 / 11],
             [1 - 0.4, 1 - 4 / 11, 0],
         ]),
     )
Example #2
0
 def test_dist_bray_curtis_magurran1(self):
     """ zero values should return zero dist, or 1 with nonzero samples"""
     res = dist_bray_curtis_magurran(
         numpy.array([[0, 0, 0], [0, 0, 0], [1, 1, 1]]))
     assert_allclose(res, numpy.array([[0, 0, 1], [0, 0, 1], [1, 1, 0]]))