[Numpy-discussion] Problem using polyutils.mapdomain with fromfunction

David Goldsmith d.l.goldsmith@gmail....
Sun Jul 25 03:32:04 CDT 2010


Why am I being told my coefficient array is not 1-d when both coefficient
arrays--old and new--are reported to have shape (2L,):

C:\Users\Fermat>python
Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.version.version
'1.4.1'
>>> from numpy.polynomial import polyutils as pu
>>> nx = 1
>>> ny = 1
>>> def whydoesntthiswork(x, y):
...     old = np.array((0,2)); print old.shape
...     new = np.array((-1,1)); print new.shape
...     X = pu.mapdomain(x, old, new)
...     return X
...
>>> result = np.fromfunction(whydoesntthiswork, (nx, ny))
(2L,)
(2L,)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\lib\site-packages\numpy\core\numeric.py", line 1539, in
from
function
    return function(*args,**kwargs)
  File "<stdin>", line 4, in whydoesntthiswork
  File "C:\Python26\lib\site-packages\numpy\polynomial\polyutils.py", line
280,
in mapdomain
    [x] = as_series([x], trim=False)
  File "C:\Python26\lib\site-packages\numpy\polynomial\polyutils.py", line
139,
in as_series
    raise ValueError("Coefficient array is not 1-d")
ValueError: Coefficient array is not 1-d

Thanks in advance,

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100725/330c887f/attachment.html 


More information about the NumPy-Discussion mailing list