diff --git a/package/MDAnalysis/coordinates/src/dcd.c b/package/MDAnalysis/coordinates/src/dcd.c index 0edc7abd29d..d0d3956dbe9 100644 --- a/package/MDAnalysis/coordinates/src/dcd.c +++ b/package/MDAnalysis/coordinates/src/dcd.c @@ -535,7 +535,7 @@ __read_timeseries(PyObject *self, PyObject *args) for (i=0;i 1 && i>0) { // Check if we have fixed atoms -- // XXX not done + // XXX not done /* Figure out how many steps to step over, if step = n, np array slicing treats this as skip over n-1, read the nth. */ numskip = step -1; diff --git a/testsuite/MDAnalysisTests/coordinates/test_dcd.py b/testsuite/MDAnalysisTests/coordinates/test_dcd.py index c7ebb4e523e..f42ec25dc68 100644 --- a/testsuite/MDAnalysisTests/coordinates/test_dcd.py +++ b/testsuite/MDAnalysisTests/coordinates/test_dcd.py @@ -14,7 +14,7 @@ RefNAMDtriclinicDCD) from MDAnalysisTests.coordinates.base import BaseTimestepTest from MDAnalysisTests import module_not_found, tempdir - +from MDAnalysisTests.plugins.knownfailure import knownfailure @attr('issue') def TestDCD_Issue32(): @@ -137,18 +137,30 @@ def test_volume(self): def test_timeseries_slicing(self): # check that slicing behaves correctly - # should fail before issue #914 resolved + # should before issue #914 resolved x = [(0, 1, 1), (1,1,1), (1, 2, 1), (1, 2, 2), (1, 4, 2), (1, 4, 4), - (0, 5, 5), (3, 5, 1), (5, 0, -2), (5, 0, -1), (None, None, None)] + (0, 5, 5), (3, 5, 1), (None, None, None)] for start, stop, step in x: yield self._slice_generation_test, start, stop, step + def test_backwards_stepping(self): + x = [(4, 0, -1), (5, 0, -2), (5, 0, -4)] + for start, stop, step in x: + yield self._failed_slices_test, start, stop, step + def _slice_generation_test(self, start, stop, step): self.u = mda.Universe(PSF, DCD) ts = self.u.trajectory.timeseries(self.u.atoms) ts_skip = self.u.trajectory.timeseries(self.u.atoms, start, stop, step) assert_array_almost_equal(ts[:, start:stop:step,:], ts_skip, 5) + @knownfailure() + def _failed_slices_test(self, start, stop, step): + self.u = mda.Universe(PSF, DCD) + ts = self.u.trajectory.timeseries(self.u.atoms) + ts_skip = self.u.trajectory.timeseries(self.u.atoms, start, stop, step) + assert_array_almost_equal(ts[:, start:stop:step,:], ts_skip, 5) + def test_DCDReader_set_dt(dt=100., frame=3): u = mda.Universe(PSF, DCD, dt=dt)