self._results should be reshaped into a sensible new variable with different n_blocks.
Actual behaviour
if using np.hstack, self._results have to be in the same dimensions.
Code to reproduce the behaviour
from pmda.contacts import Contacts
universe = mda.Universe(PSF, DCD)
sel_basic = "(resname ARG LYS) and (name NH* NZ)"
sel_acidic = "(resname ASP GLU) and (name OE* OD*)"
acidic = universe.select_atoms(sel_acidic)
basic = universe.select_atoms(sel_basic)
ana1 = Contacts((acidic, basic), (acidic, basic), radius=6.0)
ana1.run(n_blocks=3)
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 33 and the array at index 2 has size 32
Fix
change np.hstack to np.concatenate
add tests for the case that blocks don't have the same size. (e.g. for DCD file (98 frames), set n_blocks=3)
Sidenote
It seems that this error has been raised multiple times. I guess we should
avoid mentioning np.hstack in the _conclude documents
add thorough tests for these uneven block conditions.
Expected behaviour
self._results should be reshaped into a sensible new variable with different n_blocks.
Actual behaviour
if using
np.hstack
, self._results have to be in the same dimensions.Code to reproduce the behaviour
Fix
np.hstack
tonp.concatenate
Sidenote
It seems that this error has been raised multiple times. I guess we should
np.hstack
in the_conclude
documentsCurrently version of MDAnalysis:
(run
python -c "import MDAnalysis as mda; print(mda.__version__)"
) 2.0.0-dev (runpython -c "import pmda; print(pmda.__version__)"
) '0.3.0+17.g13fa3b5.dirty' (runpython -c "import dask; print(dask.__version__)"
) 2.19.0