Skip to content

Stacking results fails with odd number of frames #58

@mimischi

Description

@mimischi

I've got a trajectory (7367 frames) that was split across four CPUs, resulting in partial trajectories with 3x 1842 and 1x 1841 frames. Running np.hstack(self._results) does not work, it should either be np.vstack or np.concatenate.

pmda/pmda/custom.py

Lines 102 to 103 in 723d021

def _conclude(self):
self.results = np.hstack(self._results)

Expected behaviour

Results are concatenated over the frame axis.

Actual behaviour

ValueError is raised.

Code to reproduce the behaviour

import numpy as np
data = np.zeros([7367, 10])
print(data.shape)
# (7367, 10)

data_frames = np.array_split(data, 4)
print([frames.shape[0] for frames in data_frames])
# [1842, 1842, 1842, 1841]

np.hstack(data_frames)
# [...]
# ValueError: all the input array dimensions except for the concatenation axis must match exactly

np.vstack(data_frames)
# array([[0., 0., 0., ..., 0., 0., 0.],
#       [0., 0., 0., ..., 0., 0., 0.],
#       [0., 0., 0., ..., 0., 0., 0.],
#       ...,
#       [0., 0., 0., ..., 0., 0., 0.],
#       [0., 0., 0., ..., 0., 0., 0.],
#       [0., 0., 0., ..., 0., 0., 0.]])

Currently version of MDAnalysis:

(run python -c "import MDAnalysis as mda; print(mda.__version__)")
0.18.0

(run python -c "import pmda; print(pmda.__version__)")
0.1.1

(run python -c "import dask; print(dask.__version__)")
0.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions