-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Reader.timeseries #1400
Adds Reader.timeseries #1400
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ mm/dd/yy | |
|
||
* 0.16.2 | ||
|
||
Deprecations | ||
* deprecated core.Timeseries module (Issue #1383) | ||
|
||
Enhancements | ||
|
||
Fixes | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ | |
import os | ||
import errno | ||
import numpy as np | ||
from numpy.lib.utils import deprecate | ||
import struct | ||
import types | ||
import warnings | ||
|
@@ -578,6 +579,7 @@ def timeseries(self, asel=None, start=None, stop=None, step=None, skip=None, | |
# XXX needs to be implemented | ||
return self._read_timeseries(atom_numbers, start, stop, step, format) | ||
|
||
@deprecate(message="This method will be removed in 0.17") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the deprecations can go in now. I somehow missed your PR and did the reST deprecations in PR #1403 |
||
def correl(self, timeseries, start=None, stop=None, step=None, skip=None): | ||
"""Populate a :class:`~MDAnalysis.core.Timeseries.TimeseriesCollection` object | ||
with time series computed from the trajectory. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1461,6 +1461,60 @@ def __repr__(self): | |
natoms=self.n_atoms | ||
)) | ||
|
||
def timeseries(self, asel=None, start=None, stop=None, step=None, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a new feature for trajectory readers. It cannot go into a patch release. It has to be in 0.17.0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I'll bump this into 0.17 then |
||
format='fac'): | ||
"""Return a subset of coordinate data for an AtomGroup | ||
|
||
Parameters | ||
---------- | ||
asel : :class:`~MDAnalysis.core.groups.AtomGroup` (optional) | ||
The :class:`~MDAnalysis.core.groups.AtomGroup` to read the | ||
coordinates from. Defaults to None, in which case the full set of | ||
coordinate data is returned. | ||
start : int (optional) | ||
Begin reading the trajectory at frame index `start` (where 0 is the index | ||
of the first frame in the trajectory); the default ``None`` starts | ||
at the beginning. | ||
stop : int (optional) | ||
End reading the trajectory at frame index `stop`-1, i.e, `stop` is excluded. | ||
The trajectory is read to the end with the default ``None``. | ||
step : int (optional) | ||
Step size for reading; the default ``None`` is equivalent to 1 and means to | ||
read every frame. | ||
format : str (optional) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw I'm for naming this option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #1063 where this was already mooted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #1453 for the issue. |
||
the order/shape of the return data array, corresponding | ||
to (a)tom, (f)rame, (c)oordinates all six combinations | ||
of 'a', 'f', 'c' are allowed ie "fac" - return array | ||
where the shape is (frame, number of atoms, | ||
coordinates) | ||
|
||
""" | ||
start, stop, step = self.check_slice_indices(start, stop, step) | ||
nframes = len(range(start, stop, step)) | ||
|
||
if asel is not None: | ||
if len(asel) == 0: | ||
raise NoDataError( | ||
"Timeseries requires at least one atom to analyze") | ||
atom_numbers = asel.indices | ||
natoms = len(atom_numbers) | ||
else: | ||
atom_numbers = None | ||
natoms = self.n_atoms | ||
|
||
if not format in ('fac', None): | ||
# need to add swapping around axes etc | ||
raise NotImplementedError | ||
|
||
# allocate output array | ||
coordinates = np.empty((nframes, natoms, 3), dtype=np.float32) | ||
for i, ts in enumerate(self[start:stop:step]): | ||
# if atom_number == None, this will cause view of array | ||
# do we need copy in this case? | ||
coordinates[i] = ts.positions[atom_numbers].copy() | ||
|
||
return coordinates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not implementing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And yeah, I'll have to deal with that in this PR too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And we wanted to change the |
||
|
||
def add_auxiliary(self, auxname, auxdata, format=None, **kwargs): | ||
"""Add auxiliary data to be read alongside trajectory. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be moved up the timeline or removed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's leftover from when this also did the deprecation