[Numpy-discussion] problem with numpy.. sometimes using numarray? and selection question (original) (raw)
humufr at yahoo.fr humufr at yahoo.fr
Thu Jun 15 17:06:14 EDT 2006
- Previous message (by thread): [Numpy-discussion] problem with numpy.. sometimes using numarray? and selection question
- Next message (by thread): [Numpy-discussion] https access to svn.scipy.org
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Just a guess, you're reading some fits file with pyfits but you didn't declare the variable NUMERIX for numpy (with the beta version of pyfits) or you script are calling another script who are using numarray. I had both problem last week. Pyfits with a mix of numarray/numpy and a script to read some data and return it like an array.
N.
Le jeudi 15 juin 2006 06:35, Eric Emsellem a écrit :
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 = (rell >= 1.) * (rell < ES0.maxEFFR[indgal])_ _##################################_ _### rell is an array of reals and ES0.maxEFFR[indgal] is a real number._ _gives the error:_ _==========_ _/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_ _cachemiss2(self, n1, n2, out)_ _919 (in1, in2), inform, scalar = inputcheck(n1, n2)_ _920_ _--> 921 mode, win1, win2, wout, cfunc, ufargs = _ 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 = in2.new(outtypes[0]) 966 if inform == "vv": --> 967 intypes = (in1.type, in2.type) 968 inarr1, inarr2 = in1.dualbroadcast(in2) 969 fform, convtypes, outtypes, cfunc = self.typematchN(intypes, inform) AttributeError: 'numpy.ndarray' object has no attribute 'type' ================================================ 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 = (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 = numpy in matplotlibrc. I am also using NUMERIX = numpy when building pyfits.
- Previous message (by thread): [Numpy-discussion] problem with numpy.. sometimes using numarray? and selection question
- Next message (by thread): [Numpy-discussion] https access to svn.scipy.org
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]