Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Numpy array: sequence too large

Tags:

python

numpy

I have an array of size 11 called 'wavelength' and a larger array of size n called 'MN'. And 'model' is an m by n array.

I'm doing this:

for i in xrange(10+len(wavelength)-2):   y=np.empty(model[MN][i],float) 

and getting this as an error:

  File "test_prog.py", line 658, in <module>     y=np.empty(model[MN][i],float) ValueError: sequence too large; must be smaller than 32 

I'm not sure what to do about that. I've looked elsewhere online but I can't find anything of obvious substance.

like image 678
Matt Avatar asked Jul 16 '13 22:07

Matt


1 Answers

sequence too large error means that you are creating a multidimension array that has a dimension larger than 32. For example: np.empty([1]*33) will raise this error.

Are you sure you want to create >32 dimension array? If you want to create an empty array the same shape as model[MN][i], you should use: empty_like()

like image 136
HYRY Avatar answered Sep 21 '22 19:09

HYRY