Example #1
0
 def test_mntd(self):
     """Test if mean nearest taxon distance (mntd) is calculated correctly.
     Notes:
      The formula used is found Webb et al. 2002. Paper available at:
      http://www.annualreviews.org/doi/pdf/10.1146/annurev.ecolsys.33.010802.150448
     """
     distmat = array([[0.0, 0.4, 2.0, 1.3], [0.4, 0.0, 1.6, 0.2], [2.0, 1.6, 0.0, 1.1], [1.3, 0.2, 1.1, 0.0]])
     self.assertFloatEqual(1.9 / 4.0, mntd(distmat))
Example #2
0
 def test_mntd(self):
     """Test if mean nearest taxon distance (mntd) is calculated correctly.
     Notes:
      The formula used is found Webb et al. 2002. Paper available at:
      http://www.annualreviews.org/doi/pdf/10.1146/annurev.ecolsys.33.010802.150448
     """
     distmat = array([[0.0, 0.4, 2.0, 1.3], [0.4, 0.0, 1.6, 0.2],
                      [2.0, 1.6, 0.0, 1.1], [1.3, 0.2, 1.1, 0.0]])
     assert_almost_equal(1.9 / 4., mntd(distmat))
Example #3
0
    def test_mntd(self):
        """test mntd walks through input matrices correctly"""
        # define datamtx
        datamtx = array([[0.0, 0.4, 2.0, 1.3], [0.4, 0.0, 1.6, 0.2],
                         [2.0, 1.6, 0.0, 1.1], [1.3, 0.2, 1.1, 0.0]])

        expected_out_m = 1.9 / 4.
        actual_out_m = mntd(datamtx)
        self.assertFloatEqual(expected_out_m, actual_out_m)
Example #4
0
    def test_mntd(self):
        """test mntd walks through input matrices correctly"""
        # define datamtx
        datamtx = array([[0.0, 0.4, 2.0, 1.3],
                         [0.4, 0.0, 1.6, 0.2],
                         [2.0, 1.6, 0.0, 1.1],
                         [1.3, 0.2, 1.1, 0.0]])

        expected_out_m = 1.9/4.
        actual_out_m = mntd(datamtx)
        self.assertFloatEqual(expected_out_m, actual_out_m)