[SciPy-user] shape problem after flipud

Dominik Szczerba domi@vision.ee.ethz...
Thu Jun 14 15:47:41 CDT 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