I get the following error while reshaping a numpy ndarray
DeprecationWarning: :func:`reshape` is deprecated, use :func:`numerix.reshape()<numpy.reshape>` instead!
return reshape(newshape, order=order)
Traceback (most recent call last):
File "./render2.py", line 374, in <module>
,u=np.reshape(voltage.grad[0], (ny, nx))
File "/home/jana/Builds/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 172, in reshape
return reshape(newshape, order=order)
File "/home/jana/Builds/lib/python2.6/site-packages/fipy/tools/decorators.py", line 151, in newfunc
return func(*args, **kwds)
TypeError: reshape() got an unexpected keyword argument 'order'
Below is the part of the code that gives this error. Note: plot.py is a user defined module.
plot.streamlinePlot(x = x
,y = y
,u=np.reshape(voltage.grad[0], (ny, nx))
,v=np.reshape(voltage.grad[1], (ny, nx))
,filename='Analysis/electricFieldStreamPlot_%s.png'
,show=False
,clear=True)
The output of
print "Voltage shape =", voltage.shape
print "Voltage.grad[0] shape =", voltage.grad[0].shape
print "ny times nx =", ny*nx
is
Voltage shape = (269700,)
Voltage.grad[0] shape = (269700,)
ny times nx = 269700
I am running FiPy 3.0 and NumPy 1.7.2. Any clues? Thanks!
You should get the desired result by calling
FiPy overrides a number of NumPy routines for working with its own data structures in a self-consistent way. You should always use fipy.numerix instead of numpy when working with FiPy objects.
If you aren't aware, FiPY now includes a MatplotlibStreamViewer that may either serve your needs or at least show you the data manipulations you'll need to perform for your own display.
There's definitely something wrong in the interaction between numpy.reshape(), fipy.numerix.reshape(), and fipy.CellVariable.reshape(). I've filed a ticket to look into this. Thanks for raising the question.