From: <hu...@ya...> - 2006-06-15 21:06:21
|
Just a guess, you're reading some fits file with pyfits but you didn't decl= are=20 the variable NUMERIX for numpy (with the beta version of pyfits) or you=20 script are calling another script who are using numarray. I had both proble= m=20 last week. Pyfits with a mix of numarray/numpy and a script to read some da= ta=20 and return it like an array. N. Le jeudi 15 juin 2006 06:35, Eric Emsellem a =E9crit=A0: > Hi, > > I have written a number of small modules where I now systematically use > numpy. > > I have in principle used the latest versions of the different > array/Science modules (scipy, numpy, ..) but still at some point during > a selection, it crashes on numpy because it seems that the array > correspond to "numarray" arrays. > > e.g.: > ################################## > selection =3D (rell >=3D 1.) * (rell < ES0.maxEFFR[indgal]) > ################################## > ### rell is an array of reals and ES0.maxEFFR[indgal] is a real number. > > gives the error: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > /usr/local/lib/python2.4/site-packages/numarray/numarraycore.py:376: > UserWarning: __array__ returned non-NumArray instance > _warnings.warn("__array__ returned non-NumArray instance") > /usr/local/lib/python2.4/site-packages/numarray/ufunc.py in > _cache_miss2(self, n1, n2, out) > 919 (in1, in2), inform, scalar =3D _inputcheck(n1, n2) > 920 > --> 921 mode, win1, win2, wout, cfunc, ufargs =3D \ > 922 self._setup(in1, in2, inform, out) > 923 > > /usr/local/lib/python2.4/site-packages/numarray/ufunc.py in _setup(self, > in1, in2, inform, out) > 965 if out is None: wout =3D in2.new(outtypes[0]) > 966 if inform =3D=3D "vv": > --> 967 intypes =3D (in1._type, in2._type) > 968 inarr1, inarr2 =3D in1._dualbroadcast(in2) > 969 fform, convtypes, outtypes, cfunc =3D > self._typematch_N(intypes, inform) > > AttributeError: 'numpy.ndarray' object has no attribute '_type' > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > QUESTION 1: Any hint on where numarray could still be appearing? > > QUESTION 2: how would you make a selection using "and" and "or" such as: > selection =3D (condition 1) "and" (condition2 "or" > condition3) so that "selection" contains 0 and 1 according to the right > hand side. > > Thanks, > > Eric > P.S.: > my config is: > > matplotlib version 0.87.3 > verbose.level helpful > interactive is False > platform is linux2 > numerix numpy 0.9.9.2624 > font search path > ['/usr/local/lib/python2.4/site-packages/matplotlib/mpl-data'] > backend GTKAgg version 2.8.2 > Python 2.4.2 (#1, May 2 2006, 08:13:46) > IPython 0.7.2 -- An enhanced Interactive Python. > > I am using numerix =3D numpy in matplotlibrc. I am also using NUMERIX =3D > numpy when building pyfits. |