[Numpy-discussion] discussion about array.resize() -- compare to numarray

Sebastian Haase haase at msg.ucsf.edu
Thu Jan 4 18:15:09 CST 2007


Hi!
I'm continuing my code conversion to numpy.
Trying to track down a segmentation fault I found
1) ndimage  crashed   because I was feeding (nan,nan) as shift value .....
2) but where did I get the nan from  ? I just found that there is code
like this: (*paraphrased*)
size = N.array( [255] )
size.resize( 2 )

... trying this interactively I get an exception:
>>> a = N.array([5])
>>> a
[5]
>>> a.resize(2)
Traceback (most recent call last):
  File "<input>", line 1, in ?
ValueError: cannot resize an array that has been referenced or is referencing
another array in this way.  Use the resize function
>>> N.__version__
'1.0.2.dev3487'

in any case:  inside the script it somehow generated a nan  --- is
there a bug in numpy !?


I remember that there was some discussion about resize  !?
What should I add to the Scipy Wiki   numarray page about this  ?
(   http://www.scipy.org/Converting_from_numarray  )

Thanks,
Sebastian Haase


More information about the Numpy-discussion mailing list