diff --git a/package/CHANGELOG b/package/CHANGELOG index 25a6a793a5c..4c9a8fc6861 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -78,6 +78,8 @@ Enhancements convert between a parmed.Structure and MDAnalysis Universe (PR #2404) Changes + * AlignTraj `save()` method has been removed and the `filename` variable now + defaults to the current working directory (Issues #2099, #1745, #2443) * Removed `MDAnalysis.migration` (Issue #2490, PR #2496) * The fasta2select now always assumes that the gap character in a sequence is "-" (Issue #2448, PR #2457) diff --git a/package/MDAnalysis/analysis/align.py b/package/MDAnalysis/analysis/align.py index 405b39a1b8f..ad0a8f6e35d 100644 --- a/package/MDAnalysis/analysis/align.py +++ b/package/MDAnalysis/analysis/align.py @@ -204,7 +204,7 @@ from MDAnalysis.exceptions import SelectionError, SelectionWarning import MDAnalysis.analysis.rms as rms from MDAnalysis.coordinates.memory import MemoryReader -from MDAnalysis.lib.util import get_weights, deprecate +from MDAnalysis.lib.util import get_weights from .base import AnalysisBase @@ -536,6 +536,10 @@ class AlignTraj(AnalysisBase): `filename`. One can also use the same universe if one wants to fit to the current frame. + .. versionchanged:: 1.0.0 + ``save()`` has now been removed, as an alternative use ``np.savetxt()`` + on :attr:`rmsd`. + """ def __init__(self, mobile, reference, select='all', filename=None, @@ -613,6 +617,9 @@ def __init__(self, mobile, reference, select='all', filename=None, already a :class:`MemoryReader` then it is *always* treated as if ``in_memory`` had been set to ``True``. + .. versionchanged:: 1.0.0 + Default ``filename`` has now been changed to the current directory. + .. deprecated:: 0.19.1 Default ``filename`` directory will change in 1.0 to the current directory. @@ -635,13 +642,8 @@ def __init__(self, mobile, reference, select='all', filename=None, logger.info("Moved mobile trajectory to in-memory representation") else: if filename is None: - # DEPRECATED in 0.19.1 - # Change in 1.0 - # - # fn = os.path.split(mobile.trajectory.filename)[1] - # filename = prefix + fn - path, fn = os.path.split(mobile.trajectory.filename) - filename = os.path.join(path, prefix + fn) + fn = os.path.split(mobile.trajectory.filename)[1] + filename = prefix + fn logger.info('filename of rms_align with no filename given' ': {0}'.format(filename)) @@ -699,14 +701,6 @@ def _conclude(self): if not self._verbose: logging.disable(logging.NOTSET) - @deprecate(release="0.19.0", remove="1.0") - def save(self, rmsdfile): - """save rmsd as a numpy array - """ - # these are the values of the new rmsd between the aligned trajectory - # and reference structure - np.savetxt(rmsdfile, self.rmsd) - logger.info("Wrote RMSD timeseries to file %r", rmsdfile) class AverageStructure(AnalysisBase): """RMS-align trajectory to a reference structure using a selection, diff --git a/testsuite/MDAnalysisTests/analysis/test_align.py b/testsuite/MDAnalysisTests/analysis/test_align.py index 56f34f183e7..c8fd4bbf6af 100644 --- a/testsuite/MDAnalysisTests/analysis/test_align.py +++ b/testsuite/MDAnalysisTests/analysis/test_align.py @@ -211,8 +211,6 @@ def test_rmsd_custom_weights(self, universe, reference): assert_almost_equal(rmsd[1], rmsd_weights[1], 6) def test_AlignTraj_outfile_default(self, universe, reference): - # NOTE: Remove the line os.remove() with release 1.0, - # when the default behavior of AlignTraj changes. with tempdir.in_tempdir(): reference.trajectory[-1] x = align.AlignTraj(universe, reference) @@ -220,7 +218,6 @@ def test_AlignTraj_outfile_default(self, universe, reference): assert os.path.basename(x.filename) == 'rmsfit_adk_dims.dcd' finally: x._writer.close() - os.remove(x.filename) def test_AlignTraj_outfile_default_exists(self, universe, reference, tmpdir): reference.trajectory[-1] @@ -250,9 +247,6 @@ def test_AlignTraj(self, universe, reference, tmpdir): x = align.AlignTraj(universe, reference, filename=outfile).run() fitted = mda.Universe(PSF, outfile) - rmsd_outfile = str(tmpdir.join('rmsd')) - x.save(rmsd_outfile) - assert_almost_equal(x.rmsd[0], 6.9290, decimal=3) assert_almost_equal(x.rmsd[-1], 5.2797e-07, decimal=3) @@ -262,11 +256,6 @@ def test_AlignTraj(self, universe, reference, tmpdir): self._assert_rmsd(reference, fitted, 0, 6.929083044751061) self._assert_rmsd(reference, fitted, -1, 0.0) - # superficially check saved file rmsd_outfile - rmsd = np.loadtxt(rmsd_outfile) - assert_array_almost_equal(rmsd, x.rmsd, - err_msg="saved RMSD not correct") - def test_AlignTraj_weighted(self, universe, reference, tmpdir): outfile = str(tmpdir.join('align_test.dcd')) x = align.AlignTraj(universe, reference,