[Numpy-discussion] ValueError: object too deep for desired array

Travis Oliphant oliphant at ee.byu.edu
Tue Oct 3 11:14:32 CDT 2006


kortmann at ideaworks.com wrote:

>Microsoft Windows XP [Version 5.1.2600]
>(C) Copyright 1985-2001 Microsoft Corp.
>
>C:\Documents and Settings\kenny>cd c:\lameness
>
>C:\lameness>c:\Python24\python.exe templatewindow.py
>a = [[  1.00013175e+00   2.63483019e-05   1.00006740e+00   5.22246363e-05
>    1.00008735e+00  -2.77694969e-07  -1.30756273e-07   1.03202730e-06]
> [  2.63483019e-05   6.95644927e-05  -7.15426839e-07   1.99534228e-05
>    5.29400631e-05  -3.07638369e-09  -5.52729618e-06  -7.61431767e-06]
> [  1.00006740e+00  -7.15426839e-07   1.00011917e+00   2.50407751e-05
>    1.00006219e+00  -2.77757947e-07  -1.30856101e-07   1.23058301e-07]
> [  5.22246363e-05   1.99534228e-05   2.50407751e-05   8.21505582e-05
>    5.26966037e-05  -6.13563429e-09  -2.76420755e-06  -3.80791858e-06]
> [  1.00008735e+00   5.29400631e-05   1.00006219e+00   5.26966037e-05
>    1.00020132e+00   5.01389982e-05   3.45959412e-05   3.17129503e-05]
> [ -2.77694969e-07  -3.07638369e-09  -2.77757947e-07  -6.13563429e-09
>    5.01389982e-05   3.45959412e-05   3.17129503e-05   3.27035490e-05]
> [ -1.30756273e-07  -5.52729618e-06  -1.30856101e-07  -2.76420755e-06
>    3.45959412e-05   3.17129503e-05   3.27035490e-05   3.59732704e-05]
> [  1.03202730e-06  -7.61431767e-06   1.23058301e-07  -3.80791858e-06
>    3.17129503e-05   3.27035490e-05   3.59732704e-05   4.12184645e-05]]
>F = [[ -1.44231014e+03]
> [ -7.54006917e-02]
> [ -1.44227222e+03]
> [ -7.49199956e-02]
> [ -1.44242446e+03]
> [ -4.24684780e-02]
> [ -2.49566072e-02]
> [ -2.16978637e-02]]
>Traceback (most recent call last):
>  File "C:\lameness\PlotPanel.py", line 476, in OnNo
>    self.parent.peaktime()
>  File "C:\lameness\PlotPanel.py", line 64, in peaktime
>    self._replot()
>  File "C:\lameness\PlotPanel.py", line 159, in _replot
>    self.drawpeak()
>  File "C:\lameness\PlotPanel.py", line 233, in drawpeak
>    COE[:,j1-1] = linalg.solve(A,F)
>ValueError: object too deep for desired array
>
>Anyone know what this error could be coming from?  Is it because the
>floating point numbers are too large, memory wise?
>  
>
No, it's because you are trying to fit a 2-d array into a 1-d position. 

linalg.solve(A,F) produces a 2-d array in this instance (because F is a 
2-d array). 

COE[:,j1-1:] =linalg.solve(A,F)

should work

or squeezing the result of the solution to a 1-d array would also work.

-Travis





More information about the Numpy-discussion mailing list