Conversation
- updated format -> order kwarg - updated docs - note: general reader.timeseries only supports order="FAC" at the moment - CHANGELOG
Codecov Report
@@ Coverage Diff @@
## develop #2271 +/- ##
===========================================
- Coverage 89.66% 89.54% -0.13%
===========================================
Files 172 172
Lines 21398 21429 +31
Branches 2785 2788 +3
===========================================
+ Hits 19186 19188 +2
- Misses 1616 1645 +29
Partials 596 596
Continue to review full report at Codecov.
|
| 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() |
There was a problem hiding this comment.
I think this might be double copying in the case of a non-memoryview. I think maybe either np.array or np.asarray lets you specify copy=True which will end up with one copy max.
There was a problem hiding this comment.
I think you're right.
But note that you gave the MemoryReader its own timeseries method
Would be nice if we could do everything consistently in base.
There was a problem hiding this comment.
Btw, I think I misunderstood your comment.... you were not referring to MemoryReader at all, were you?
There was a problem hiding this comment.
np.asanyarray() does not have copy=True. np.array(a, copy=True) is equivalent to np.copy(a).
Do you want to do something like
x = ts.positions[atom_numbers]
if is_copy(x):
coordinates[i] = x
else:
coordinates[i] = x.copy()(and where I don't know how to do is_copy(x))?
| natoms=self.n_atoms | ||
| )) | ||
|
|
||
| def timeseries(self, asel=None, start=None, stop=None, step=None, |
There was a problem hiding this comment.
This is cool, but maybe it should be called coordinates_timeseries? unless it's obvious that the only timeseries of interest is the coordinates? I also think maybe the function should be made more general to be a timeseries of all time data, so box info, velocities etc? This would make the Reader -> MemoryReader transformation trivial. So returning something like a numpy structured array? Not sure what a good container for this is though...
There was a problem hiding this comment.
I know, it's not general enough at the moment. However, it is consistent with the MemoryReader
mdanalysis/package/MDAnalysis/coordinates/memory.py
Lines 475 to 478 in f83498e
|
@richardjgowers thanks for the comments. I don't have a ton of time on my hands to work on the PR. I mainly put it up so that some of your old work did not get junked. (I came across the old PR for some other reasons and just noticed your old timeseries code.) It would be nice to have a consistent way to pull trajectory data into arrays. I agree with your comment that it should be possible to not only get coordinates but also velocities, forces, box information – if available. Auxiliaries would be neat, too, but they aren't used that much as far as I can tell, so one could leave them out, until we come up with a killer-app for them (... I am thinking alchemical free energy calculations analysis would benefit tremendously, but that's another thread). |
|
Closing as stale (and I don't even know if the PR/issue is still relevant) |
Changes made in this Pull Request:
Note that there's still some work to be done
MemoryReader.timeseries,DCD.timeseriesand thisProtoReader.timeseriesfully consistentorder(not only "FAC")PR Checklist