コード例 #1
0
class TestRDAResults(object):
    # STATUS: L&L only shows results with scaling 1, and they agree
    # with vegan's (module multiplying by a constant). I can also
    # compute scaling 2, agreeing with vegan, but there are no written
    # results in L&L.
    def setup(self):
        """Data from table 11.3 in Legendre & Legendre 1998."""
        Y = np.loadtxt(get_data_path("example2_Y"))
        X = np.loadtxt(get_data_path("example2_X"))
        self.ordination = RDA(
            Y,
            X,
            ["Site0", "Site1", "Site2", "Site3", "Site4", "Site5", "Site6", "Site7", "Site8", "Site9"],
            ["Species0", "Species1", "Species2", "Species3", "Species4", "Species5"],
        )

    def test_scaling1(self):
        scores = self.ordination.scores(1)

        # Load data as computed with vegan 2.0-8
        vegan_species = np.loadtxt(get_data_path("example2_species_scaling1_from_vegan"))
        npt.assert_almost_equal(scores.species, vegan_species, decimal=6)

        vegan_site = np.loadtxt(get_data_path("example2_site_scaling1_from_vegan"))
        npt.assert_almost_equal(scores.site, vegan_site, decimal=6)

    def test_scaling2(self):
        scores = self.ordination.scores(2)

        # Load data as computed with vegan 2.0-8
        vegan_species = np.loadtxt(get_data_path("example2_species_scaling2_from_vegan"))
        npt.assert_almost_equal(scores.species, vegan_species, decimal=6)

        vegan_site = np.loadtxt(get_data_path("example2_site_scaling2_from_vegan"))
        npt.assert_almost_equal(scores.site, vegan_site, decimal=6)
コード例 #2
0
 def setup(self):
     """Data from table 11.3 in Legendre & Legendre 1998."""
     Y = np.loadtxt(get_data_path('example2_Y'))
     X = np.loadtxt(get_data_path('example2_X'))
     self.ordination = RDA(Y, X,
                           ['Site0', 'Site1', 'Site2', 'Site3', 'Site4',
                            'Site5', 'Site6', 'Site7', 'Site8', 'Site9'],
                           ['Species0', 'Species1', 'Species2', 'Species3',
                            'Species4', 'Species5'])
コード例 #3
0
ファイル: test_ordination.py プロジェクト: 7924102/scikit-bio
 def setup(self):
     """Data from table 11.3 in Legendre & Legendre 1998."""
     Y = np.loadtxt(get_data_path('example2_Y'))
     X = np.loadtxt(get_data_path('example2_X'))
     self.ordination = RDA(Y, X,
                           ['Site0', 'Site1', 'Site2', 'Site3', 'Site4',
                            'Site5', 'Site6', 'Site7', 'Site8', 'Site9'],
                           ['Species0', 'Species1', 'Species2', 'Species3',
                            'Species4', 'Species5'])
コード例 #4
0
 def setup(self):
     """Data from table 11.3 in Legendre & Legendre 1998."""
     Y = np.loadtxt(get_data_path("example2_Y"))
     X = np.loadtxt(get_data_path("example2_X"))
     self.ordination = RDA(
         Y,
         X,
         ["Site0", "Site1", "Site2", "Site3", "Site4", "Site5", "Site6", "Site7", "Site8", "Site9"],
         ["Species0", "Species1", "Species2", "Species3", "Species4", "Species5"],
     )
コード例 #5
0
class TestRDAResults(object):
    # STATUS: L&L only shows results with scaling 1, and they agree
    # with vegan's (module multiplying by a constant). I can also
    # compute scaling 2, agreeing with vegan, but there are no written
    # results in L&L.
    def setup(self):
        """Data from table 11.3 in Legendre & Legendre 1998."""
        Y = np.loadtxt(get_data_path('example2_Y'))
        X = np.loadtxt(get_data_path('example2_X'))
        self.ordination = RDA(Y, X, [
            'Site0', 'Site1', 'Site2', 'Site3', 'Site4', 'Site5', 'Site6',
            'Site7', 'Site8', 'Site9'
        ], [
            'Species0', 'Species1', 'Species2', 'Species3', 'Species4',
            'Species5'
        ])

    def test_scaling1(self):
        scores = self.ordination.scores(1)

        # Load data as computed with vegan 2.0-8
        vegan_species = np.loadtxt(
            get_data_path('example2_species_scaling1_from_vegan'))
        npt.assert_almost_equal(scores.species, vegan_species, decimal=6)

        vegan_site = np.loadtxt(
            get_data_path('example2_site_scaling1_from_vegan'))
        npt.assert_almost_equal(scores.site, vegan_site, decimal=6)

    def test_scaling2(self):
        scores = self.ordination.scores(2)

        # Load data as computed with vegan 2.0-8
        vegan_species = np.loadtxt(
            get_data_path('example2_species_scaling2_from_vegan'))
        npt.assert_almost_equal(scores.species, vegan_species, decimal=6)

        vegan_site = np.loadtxt(
            get_data_path('example2_site_scaling2_from_vegan'))
        npt.assert_almost_equal(scores.site, vegan_site, decimal=6)