[SciPy-user] shape problem after flipud

Dominik Szczerba domi at vision.ee.ethz.ch
Thu Jun 14 16:47:41 EDT 2007


Hi,

The following trivial codelet does not work as expected:

-------------------------------
from scipy import *
import copy

shape = (256,256)
data = zeros(256*256)
data.shape = shape
print 'old shape', data.shape
print data

data=flipud(data)
data.shape=(256*256,)
print 'new shape', data.shape
-------------------------------

exiting with an uncomprehensive error:
     data.shape=(256*256,)
AttributeError: incompatible shape for a non-contiguous array

If 'flipud' is ommited, it works as expected. I tried via a deepcopy, 
the problem persists. Why should flipud invalidate 'reshapeability'?
What am I doing wrong?

Thanks a lot for any hints,
- Dominik

-- 
Dominik Szczerba, Ph.D.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi



More information about the SciPy-User mailing list