-
Notifications
You must be signed in to change notification settings - Fork 823
Description
MemoryReader layout
- Change the MemoryReader default order ("format") to fac (to be compatible with
AnalysisFromFunction()and friends. - Change the keyword argument "format" to "order" (and check other parts of the code (eg ENCORE) as well as the docs to follow this change)
- changed MemoryReader
- changed docs (see Issue 1047 encore docs #1056)
- tests
Background
There are currently two different default layouts for numpy arrays in MDAnalysis. DCDReader.timeseries() uses an 'afc' format by default, which has now also been adopted as the default in MemoryReader, both when constructing a new MemoryReader, and when extracting the raw array using MemoryReader.timeseries().
On the other hand, the natural order when using AnalysisFromFunction is 'fac', which also intuitively (at least to me) is a more natural order.
These different default layouts leads to some unnecessary confusion. Note, for instance, the swapaxes that is necessary when extracting coordinates using AnalysisFromFunction to use to construct a new Universe with MemoryReader:
coordinates = AnalysisFromFunction(lambda ag: ag.positions.copy(),
u.atoms).run().results.swapaxes(0, 1)
u2 = mda.Universe(PDB, coordinates, format=MemoryReader)
Since MemoryReader is introduced in this release, it is still relatively easy to change the default layout of MemoryReader, without having to worry about breaking code. So, the question is: should we change the default layout of MemoryReader so that it upon construction uses 'fac' instead?
And if so, do we then keep the default of MemoryReader.timeseries() to be 'afc', to maintain consistency with DCDReader.timeseries?
Currently version of MDAnalysis:
0.16.0-dev0