[Numpy-discussion] problem with numpy.. sometimes using numarray? and selection question
humufr at yahoo.fr
humufr at yahoo.fr
Thu Jun 15 17:06:14 EDT 2006
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
> _cache_miss2(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._typematch_N(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.
More information about the NumPy-Discussion
mailing list