Exemple #1
0
 def test_skip(self):
     for skip in [0, 3, 13]:
         r1 = FeatureReader(self.trajfile, self.topfile)
         out_with_skip = r1.get_output(skip=skip)[0]
         r2 = FeatureReader(self.trajfile, self.topfile)
         out = r2.get_output()[0]
         np.testing.assert_almost_equal(out_with_skip, out[skip::],
                                        err_msg="The first %s rows were skipped, but that did not "
                                                "match the rows with skip=0 and sliced by [%s::]" % (skip, skip))
Exemple #2
0
 def test_skip_input_list(self):
     for skip in [0, 3, 13]:
         r1 = FeatureReader([self.trajfile, self.trajfile2], self.topfile)
         out_with_skip = r1.get_output(skip=skip)
         r2 = FeatureReader([self.trajfile, self.trajfile2], self.topfile)
         out = r2.get_output()
         np.testing.assert_almost_equal(out_with_skip[0], out[0][skip::],
                                        err_msg="The first %s rows of the first file were skipped, but that did not "
                                                "match the rows with skip=0 and sliced by [%s::]" % (skip, skip))
         np.testing.assert_almost_equal(out_with_skip[1], out[1][skip::],
                                        err_msg="The first %s rows of the second file were skipped, but that did not"
                                                " match the rows with skip=0 and sliced by [%s::]" % (skip, skip))
Exemple #3
0
    def test_partial_fit(self):
        reader = FeatureReader(self.trajnames, self.temppdb, chunksize=10000)
        output = reader.get_output()
        params = {'dim': self.dim, 'lag': 1001}
        ref = api.tica(reader, **params)
        partial = api.tica(**params)

        for traj in output:
            partial.partial_fit(traj)

        np.testing.assert_allclose(partial.eigenvalues, ref.eigenvalues, atol=1e-3)
        # only compare first two eigenvectors, because we only have two metastable processes
        np.testing.assert_allclose(np.abs(partial.eigenvectors[:2]),
                                   np.abs(ref.eigenvectors[:2]), rtol=1e-3, atol=1e-3)