Problem using polyutils.mapdomain with fromfunction
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
On Sun, Jul 25, 2010 at 2:32 AM, David Goldsmith <d.l.goldsmith@gmail.com>wrote:
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,
Because fromfunction passes 2d arrays to whydoesntthiswork and mapdomain doesn't accept 2d arrays as the first argument. That looks like an unnecessary restriction, open a ticket and I'll fix it up. Chuck
On Sun, Jul 25, 2010 at 7:08 AM, Charles R Harris <charlesr.harris@gmail.com
wrote:
On Sun, Jul 25, 2010 at 2:32 AM, David Goldsmith <d.l.goldsmith@gmail.com>wrote:
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,
Because fromfunction passes 2d arrays to whydoesntthiswork and mapdomain doesn't accept 2d arrays as the first argument. That looks like an unnecessary restriction, open a ticket and I'll fix it up.
Thanks, Chuck. DG
Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Charles R Harris
-
David Goldsmith