Exemple #1
0
 def test_eigenvalues(self):
     # do it with PCA metric
     my_cov_matrix = PCAMetric.create_covariance_matrix(testPCAMetric.coordsets)
     biggest_eigenvalue = PCAMetric.calculate_biggest_eigenvalue(my_cov_matrix)
      
     # Do it with prody
     pca = prody.PCA('pcametric_pca')
     pca.buildCovariance(testPCAMetric.ensemble)
     pca.calcModes(n_modes=1)
     self.assertAlmostEqual(pca.getEigvals()[0], biggest_eigenvalue,10)
Exemple #2
0
 def test_covariance_matrix_vs_prody(self):
     # do it with PCA metric
     my_cov_matrix = PCAMetric.create_covariance_matrix(testPCAMetric.coordsets)
      
     # Do it with prody
     pca = prody.PCA('pcametric_pca')
     pca.buildCovariance(testPCAMetric.ensemble)
     prody_cov_matrix = pca._cov
      
     # Compare
     numpy.testing.assert_almost_equal(my_cov_matrix, prody_cov_matrix,10)
Exemple #3
0
    def test_eigenvalues(self):
        # do it with PCA metric
        my_cov_matrix = PCAMetric.create_covariance_matrix(
            testPCAMetric.coordsets)
        biggest_eigenvalue = PCAMetric.calculate_biggest_eigenvalue(
            my_cov_matrix)

        # Do it with prody
        pca = prody.PCA('pcametric_pca')
        pca.buildCovariance(testPCAMetric.ensemble)
        pca.calcModes(n_modes=1)
        self.assertAlmostEqual(pca.getEigvals()[0], biggest_eigenvalue, 10)
Exemple #4
0
    def test_covariance_matrix_vs_prody(self):
        # do it with PCA metric
        my_cov_matrix = PCAMetric.create_covariance_matrix(
            testPCAMetric.coordsets)

        # Do it with prody
        pca = prody.PCA('pcametric_pca')
        pca.buildCovariance(testPCAMetric.ensemble)
        prody_cov_matrix = pca._cov

        # Compare
        numpy.testing.assert_almost_equal(my_cov_matrix, prody_cov_matrix, 10)