Skip to content

Commit

Permalink
Remove deprecated format from MemoryReader.timeseries (#2567)
Browse files Browse the repository at this point in the history
* Completes #1453 for MemoryReader (and towards v1.0 #2443)
* Removes support for the deprecated format keyword in MemoryReader.timeseries.
* Removes deprecation test
* Update CHANGELOG
  • Loading branch information
IAlibay authored Feb 29, 2020
1 parent 7efc83d commit 9bcf6f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
2 changes: 2 additions & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ Enhancements
* Improve the distance search in water bridge analysis with capped_distance (PR #2480)

Changes
* Removed `format` keyword from :meth:`MemoryReader.timeseries` (Issue #1453,
#2443)
* Deprecated :class:`LAMMPSDataConverter` has now been removed (Issue #2564)
* Removed AtomGroup stubs (PR #1070, Issue #2443).
* encore.hes() doesn't accept the details keyword anymore, it always returns
Expand Down
31 changes: 9 additions & 22 deletions package/MDAnalysis/coordinates/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,12 @@ class MemoryReader(base.ProtoReader):
A trajectory reader interface to a numpy array of the coordinates.
For compatibility with the timeseries interface, support is provided for
specifying the order of columns through the format option.
specifying the order of columns through the `order` keyword.
.. versionadded:: 0.16.0
.. versionchanged:: 1.0.0
Support for the deprecated `format` keyword for
:meth:`MemoryReader.timeseries` has now been removed.
"""

format = 'MEMORY'
Expand Down Expand Up @@ -488,10 +490,10 @@ def _reopen(self):
self.ts.frame = -1
self.ts.time = -1

def timeseries(self, asel=None, start=0, stop=-1, step=1, order='afc', format=None):
def timeseries(self, asel=None, start=0, stop=-1, step=1, order='afc'):
"""Return a subset of coordinate data for an AtomGroup in desired
column order/format. If no selection is given, it will return a view of
the underlying array, while a copy is returned otherwise.
column order. If no selection is given, it will return a view of the
underlying array, while a copy is returned otherwise.
Parameters
---------
Expand All @@ -510,26 +512,11 @@ def timeseries(self, asel=None, start=0, stop=-1, step=1, order='afc', format=No
of 'a', 'f', 'c' are allowed ie "fac" - return array
where the shape is (frame, number of atoms,
coordinates).
format : str (optional)
deprecated, equivalent to `order`
Note
----
The `format` parameter name is used to mimic the
:class:`MDAnalysis.coordinates.DCD.timeseries` interface. It is
identical to the `order` parameter for :class:`MemoryReader`. In a
future version, `format` will be renamed to `order`.
.. deprecated:: 0.17.0
`format` has been deprecated in favor of the standard keyword `order`.
.. versionchanged:: 1.0.0
Deprecated `format` keyword has been removed. Use `order` instead.
"""
if format is not None:
warnings.warn(
"'format' is deprecated and will be removed in 1.0. Use 'order' instead",
category=DeprecationWarning)
order = format

array = self.get_array()
if order == self.stored_order:
pass
Expand Down
4 changes: 0 additions & 4 deletions testsuite/MDAnalysisTests/coordinates/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ def test_iteration(self, ref, reader):
def test_extract_array_afc(self,reader):
assert_equal(reader.timeseries(order='afc').shape, (3341, 98, 3))

def test_timeseries_deprecation(self, reader):
with pytest.warns(DeprecationWarning):
reader.timeseries(format='fac')

def test_extract_array_afc(self, reader):
assert_equal(reader.timeseries(order='afc').shape, (3341, 98, 3))

Expand Down

0 comments on commit 9bcf6f4

Please sign in to comment.