Re: [Numpy-discussion] Irregular arrays
[EMAIL PROTECTED] wrote: Many problems are best solved with irregular array structures. These are aggregations not having a rectangular shape. To motivate, here's one example, http://lambda-the-ultimate.org/files/HammingNumbersDeclarative.7z - from http://lambda-the-ultimate.org/node/608#comment-5746 Irregularity here changes an O(N^3) solution to O(N). (The file format is a 7zip archive with a MathReader file inside, readable in Windows or Unix with free software.) These cases also arise in simulations where physical geometry determines array shape. Here memory consumption is the minimization goal that makes irregularity desirable. The access function will return NaN or zero for out-of-bounds requests. There is no need to consume memory storing NaNs and zeros Please advise how much support numpy/Scipy has for these structures, if any, including future plans. If support exists, could you kindly supply a Scipy declaration matching the first example. SciPy has sparse matrix support (scipy.sparse) with several storage formats You can also construct irregular arrays using arrays of objects or just lists of lists. -Travis - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] Use of numarray from numpy package
Hello, is it necessary to install numarray separately to use numpy ? Indeed, after numpy installation, when I try to use it in the code, I get the same error as below : .../... Python 2.4.1 (#1, May 13 2005, 13:45:18) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-42)] on linux2 Type help, copyright, credits or license for more information. from numarray import * Traceback (most recent call last): File stdin, line 1, in ? File /usr/local/lib/python2.3/site-packages/numpy/numarray/__init__.py, line 1, in ? from util import * File /usr/local/lib/python2.3/site-packages/numpy/numarray/util.py, line 2, in ? from numpy import geterr ImportError: No module named numpy Thanks for your answer, Cheers, David Landriu David Landriu DAPNIA/SAp CEA SACLAY (France) Phone : (33|0)169088785 Fax: (33|0)169086577 - - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] fftfreq very slow; rfftfreq incorrect?
Hi all, the current implementation of fftfreq (which is meant to return the appropriate frequencies for an FFT) does the following: k = range(0,(n-1)/2+1)+range(-(n/2),0) return array(k,'d')/(n*d) I have tried this with very long (2**24) arrays, and it is ridiculously slow. Should this instead use arange (or linspace?) and concatenate rather than converting the above list? This seems to result in acceptable performance, but we could also perhaps even pre-allocate the space. The numpy.fft.rfftfreq seems just plain incorrect to me. It seems to produce lots of duplicated frequencies, contrary to the actual output of rfft: def rfftfreq(n,d=1.0): rfftfreq(n, d=1.0) - f DFT sample frequencies (for usage with rfft,irfft). The returned float array contains the frequency bins in cycles/unit (with zero at the start) given a window length n and a sample spacing d: f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd None of these should be doubled, right? assert isinstance(n,int) return array(range(1,n+1),dtype=int)/2/float(n*d) Thanks, Andrew - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] fftfreq very slow; rfftfreq incorrect?
[copied to the scipy list since rfftfreq is only in scipy] Andrew Jaffe wrote: Hi all, the current implementation of fftfreq (which is meant to return the appropriate frequencies for an FFT) does the following: k = range(0,(n-1)/2+1)+range(-(n/2),0) return array(k,'d')/(n*d) I have tried this with very long (2**24) arrays, and it is ridiculously slow. Should this instead use arange (or linspace?) and concatenate rather than converting the above list? This seems to result in acceptable performance, but we could also perhaps even pre-allocate the space. The numpy.fft.rfftfreq seems just plain incorrect to me. It seems to produce lots of duplicated frequencies, contrary to the actual output of rfft: def rfftfreq(n,d=1.0): rfftfreq(n, d=1.0) - f DFT sample frequencies (for usage with rfft,irfft). The returned float array contains the frequency bins in cycles/unit (with zero at the start) given a window length n and a sample spacing d: f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd None of these should be doubled, right? assert isinstance(n,int) return array(range(1,n+1),dtype=int)/2/float(n*d) Thanks, Andrew - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] possible bug with numpy.object_
On Tue, Aug 29, 2006 at 10:49:58AM -0600, Travis Oliphant wrote: Matt Knox wrote: is the following behaviour expected? or is this a bug with numpy.object_ ? I'm using numpy 1.0b1 print numpy.array([],numpy.float64).size 0 print numpy.array([],numpy.object_).size 1 Should the size of an array initialized from an empty list not always be 1 ? or am I just crazy? Not in this case. Explictly creating an object array from any object (even the empty-list object) gives you a 0-d array containing that object. When you explicitly create an object array a different section of code handles it and gives this result. This is a recent change, and I don't think this use-case was considered as a backward incompatibility (which I believe it is). Perhaps we should make it so array([],) always returns an empty array. I'm not sure. Comments? The current behaviour makes sense, but is maybe not consistent: N.array([],dtype=object).size == 1 N.array([[],[]],dtype=object).size == 2 Regards Stéfan - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] stumped numpy user seeks help
Mathew Yeates schrieb: My head is about to explode. I have an M by N array of floats. Associated with the columns are character labels ['a','b','b','c','d','e','e','e'] note: already sorted so duplicates are contiguous I want to replace the 2 'b' columns with the sum of the 2 columns. Similarly, replace the 3 'e' columns with the sum of the 3 'e' columns. The resulting array still has M rows but less than N columns. Anyone? Could be any harder than Sudoku. Hi, I don't have time for this ;-) , but I learnt something useful along the way... import numpy as n m = n.ones([2,6]) a = ['b', 'c', 'c', 'd', 'd', 'd'] startindices = set([a.index(x) for x in a]) out = n.empty([m.shape[0], 0]) for i in startindices: temp = n.mat(m[:, i : i + a.count(a[i])]).sum(axis = 1) out = n.hstack([out, temp]) print out Not sure if axis = 1 is needed, but until the defaults have settled a bit it can't hurt. You need python 2.4 for the built-in set, and out will be a numpy matrix, use asarray if you don't like that. But here it's really nice to work with matrices, because otherwise .sum() will give you a 1-d array sometimes, and that will suddenly look like a row to hstack (instead of a nice column vector) and wouldn't work -- that's why matrices are so great and everybody should be using them ;-) hth, sven - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] fromiter shape argument -- was Re: For loop tips
Torgil Svensson wrote: return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) Is it possible for fromiter to take an optional shape (or count) argument in addition to the dtype argument? Yes. fromiter(iterable, dtype, count) works. If both is given it could preallocate memory and we only have to iterate over L once. Regardless, L is only iterated over once. In general you can't rewind iterators, so that's a requirement. This is accomplished by doing successive overallocation similar to the way appending to a list is handled. By specifying the count up front you save a bunch of reallocs, but no iteration. -tim //Torgil On 8/29/06, Keith Goodman [EMAIL PROTECTED] wrote: On 8/29/06, Torgil Svensson [EMAIL PROTECTED] wrote: something like this? def list2index(L): uL=sorted(set(L)) idx=dict((y,x) for x,y in enumerate(uL)) return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) Wow. That's amazing. Thank you. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] fftfreq very slow; rfftfreq incorrect?
On Wed, Aug 30, 2006 at 12:04:22PM +0100, Andrew Jaffe wrote: the current implementation of fftfreq (which is meant to return the appropriate frequencies for an FFT) does the following: k = range(0,(n-1)/2+1)+range(-(n/2),0) return array(k,'d')/(n*d) I have tried this with very long (2**24) arrays, and it is ridiculously slow. Should this instead use arange (or linspace?) and concatenate rather than converting the above list? This seems to result in acceptable performance, but we could also perhaps even pre-allocate the space. Please try the attached benchmark. The numpy.fft.rfftfreq seems just plain incorrect to me. It seems to produce lots of duplicated frequencies, contrary to the actual output of rfft: def rfftfreq(n,d=1.0): rfftfreq(n, d=1.0) - f DFT sample frequencies (for usage with rfft,irfft). The returned float array contains the frequency bins in cycles/unit (with zero at the start) given a window length n and a sample spacing d: f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2]/(d*n) if n is even f = [0,1,1,2,2,...,n/2-1,n/2-1,n/2,n/2]/(d*n) if n is odd None of these should be doubled, right? assert isinstance(n,int) return array(range(1,n+1),dtype=int)/2/float(n*d) Please produce a code snippet to demonstrate the problem. We can then fix the bug and use your code as a unit test. Regards Stéfan import numpy as N from numpy.testing import * import timeit def fftfreq0(n,d=1.0): fftfreq(n, d=1.0) - f DFT sample frequencies The returned float array contains the frequency bins in cycles/unit (with zero at the start) given a window length n and a sample spacing d: f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd assert isinstance(n,int) or isinstance(n,integer) k = range(0,(n-1)/2+1)+range(-(n/2),0) return N.array(k,'d')/(n*d) def fftfreq1(n,d=1.0): fftfreq(n, d=1.0) - f DFT sample frequencies The returned float array contains the frequency bins in cycles/unit (with zero at the start) given a window length n and a sample spacing d: f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd assert isinstance(n,int) or isinstance(n,integer) k = N.hstack((N.arange(0,(n-1)/2 + 1), N.arange(-(n/2),0))) / (n*d) return k def fftfreq2(n,d=1.0): fftfreq(n, d=1.0) - f DFT sample frequencies The returned float array contains the frequency bins in cycles/unit (with zero at the start) given a window length n and a sample spacing d: f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd assert isinstance(n,int) or isinstance(n,integer) k = N.empty(n) midpoint = (n-1)/2+1 k[:midpoint] = N.arange(0,(n-1)/2 + 1) k[midpoint:] = N.arange(-(n/2),0) k *= 1./(n*d) return k for i in [int(x) for x in 1e5,1e5+1,1e6,1e6+1]: print Benchmarking for n=%d % i def bench(fname,out=x): return timeit.Timer(__main__.%s=__main__.%s(%d) % (out,fname,i), import __main__).timeit(number=10) print Old: , bench(fftfreq0,out=a) print New_concat: , bench(fftfreq1,out=b) print New_inplace: , bench(fftfreq2,out=c) print assert_array_almost_equal(a,b) assert_array_almost_equal(b,c) - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]
Andrew Straw wrote: {ccali22}~(0)setenv PYTHONPATH /usr/local/lib/python2.3/site-packages/numpy Here's where you went wrong. You want: setenv PYTHONPATH /usr/local/lib/python2.3/site-packages Which you shouldn't need at all. site-packages should be on sys.path by default. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/ORR/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] Interfacing with PIL?
I'm somewhat new to both libraries...is there any way to create a 2D array of pixel values from an image object from the Python Image Library? I'd like to do some arithmetic on the values. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Interfacing with PIL?
Am Mittwoch, 30. August 2006 19:20 schrieb Ghalib Suleiman: I'm somewhat new to both libraries...is there any way to create a 2D array of pixel values from an image object from the Python Image Library? I'd like to do some arithmetic on the values. Yes. To transport the data: import numpy image = some PIL image arr = numpy.fromstring(image.tostring(), dtype=numpy.uint8) (alternately use dtype=numpy.uint32 if you want RGBA packed in one number). arr will be a 1d array with length (height * width * b(ytes)pp). Use reshape to get it into a reasonable form. HTH, Johannes - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Interfacing with PIL?
Tim Hochberg wrote: Johannes Loehnert wrote: I'm somewhat new to both libraries...is there any way to create a 2D array of pixel values from an image object from the Python Image Library? I'd like to do some arithmetic on the values. the latest version of PIL (maybe not released yet) supports the array interface, so you may be able to do something like: A = numpy.asarray(PIL_image) see the PIL page: http://effbot.org/zone/pil-changes-116.htm where it says: Changes from release 1.1.5 to 1.1.6 Added fromarray function, which takes an object implementing the NumPy array interface and creates a PIL Image from it. (from Travis Oliphant). Added NumPy array interface support (__array_interface__) to the Image class (based on code by Travis Oliphant). This allows you to easily convert between PIL image memories and NumPy arrays: import numpy, Image i = Image.open('lena.jpg') a = numpy.asarray(i) # a is readonly i = Image.fromarray(a) On a related note, does anyone have a good recipe for converting a PIL image to a wxPython image? Does a PIL image support the buffer protocol? There will be a: wx.ImageFromBuffer() soon, and there is now; wx.Image.SetDataBuffer() if not, I think this will work: I = wx.EmptyImage(width, height) DataString = PIL_image.tostring() I.SetDataBuffer(DataString) This will only work if the PIL image is an 24 bit RGB image, of course. Just make sure to keep DataString around, so that the data buffer doesn't get deleted. wx.ImageFromBuffer() will do that foryou, but it's not available until 2.7 comes out. Ideally, both PIL and wx will support the array interface, and we can just do: I = wx.ImageFromArray(PIL_Image) and not get any data copying as well. Also, Robin has just added some methods to directly manipulate wxBitmaps, so you can use a numpy array as the data buffer for a wx.Bitmap. This can help prevent a lot of data copies. see a test here: http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/demo/RawBitmapAccess.py?rev=1.3content-type=text/vnd.viewcvs-markup -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/ORR/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] (no subject)
Hi, currently I´m trying to compile the latest numpy version (1.0b4) under an SGI IRIX 6.5 environment. I´m using the gcc 3.4.6 compiler and python 2.4.3 (self compiled). During the compilation of numpy.core I get a nasty error message: ... copying build/src.irix64-6.5-2.4/numpy/__config__.py - build/lib.irix64-6.5-2.4/numpy copying build/src.irix64-6.5-2.4/numpy/distutils/__config__.py - build/lib.irix64-6.5-2.4/numpy/distutils running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext customize MipsFCompiler customize MipsFCompiler customize MipsFCompiler using build_ext building 'numpy.core.umath' extension compiling C sources C compiler: gcc -fno-strict-aliasing -DNDEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_LARGEFILE_SUPPORT -fmessage-length=0 -Wall -O2 compile options: '-Ibuild/src.irix64-6.5-2.4/numpy/core/src -Inumpy/core/include -Ibuild/src.irix64-6.5-2.4/numpy/core -Inumpy/core/src -Inumpy/core/include -I/usr/local/include/python2.4 -c' gcc: build/src.irix64-6.5-2.4/numpy/core/src/umathmodule.c numpy/core/src/umathmodule.c.src: In function `nc_sqrtf': numpy/core/src/umathmodule.c.src:602: warning: implicit declaration of function `hypotf' numpy/core/src/umathmodule.c.src: In function `nc_sqrtl': numpy/core/src/umathmodule.c.src:602: warning: implicit declaration of function `fabsl' ... ... lots of math functions ... ... numpy/core/src/umathmodule.c.src: In function `LONGDOUBLE_frexp': numpy/core/src/umathmodule.c.src:1940: warning: implicit declaration of function `frexpl' numpy/core/src/umathmodule.c.src: In function `LONGDOUBLE_ldexp': numpy/core/src/umathmodule.c.src:1957: warning: implicit declaration of function `ldexpl' In file included from numpy/core/src/umathmodule.c.src:2011: build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c: At top level: build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:15: error: `acosl' undeclared here (not in a function) build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:15: error: initializer element is not constant build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:15: error: (near initialization for `arccos_data[2]') ... ... lots of math functions ... ... build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:192: error: initializer element is not constant build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:192: error: (near initialization for `tanh_data[2]') numpy/core/include/numpy/ufuncobject.h:328: warning: 'generate_overflow_error' defined but not used numpy/core/src/umathmodule.c.src: In function `nc_sqrtf': numpy/core/src/umathmodule.c.src:602: warning: implicit declaration of function `hypotf' ... ... lots of math functions ... ... numpy/core/src/umathmodule.c.src: In function `FLOAT_frexp': numpy/core/src/umathmodule.c.src:1940: warning: implicit declaration of function `frexpf' numpy/core/src/umathmodule.c.src: In function `FLOAT_ldexp': numpy/core/src/umathmodule.c.src:1957: warning: implicit declaration of function `ldexpf' numpy/core/src/umathmodule.c.src: In function `LONGDOUBLE_frexp': numpy/core/src/umathmodule.c.src:1940: warning: implicit declaration of function `frexpl' numpy/core/src/umathmodule.c.src: In function `LONGDOUBLE_ldexp': numpy/core/src/umathmodule.c.src:1957: warning: implicit declaration of function `ldexpl' In file included from numpy/core/src/umathmodule.c.src:2011: build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c: At top level: build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:15: error: `acosl' undeclared here (not in a function) build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:15: error: initializer element is not constant ... ... lots of math functions ... ... build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:192: error: initializer element is not constant build/src.irix64-6.5-2.4/numpy/core/__umath_generated.c:192: error: (near initialization for `tanh_data[2]') numpy/core/include/numpy/ufuncobject.h:328: warning: 'generate_overflow_error' defined but not used error: Command gcc -fno-strict-aliasing -DNDEBUG -D_FILE_OFFSET_BITS=64 -DHAVE_LARGEFILE_SUPPORT -fmessage-length=0 -Wall -O2 -Ibuild/src.irix64-6.5-2.4/numpy/core/src -Inumpy/core/include -Ibuild/src.irix64-6.5-2.4/numpy/core -Inumpy/core/src -Inumpy/core/include -I/usr/local/include/python2.4 -c build/src.irix64-6.5-2.4/numpy/core/src/umathmodule.c -o build/temp.irix64-6.5-2.4/build/src.irix64-6.5-2.4/numpy/core/src/umathmodule.o failed with exit status 1 Can somebody explain me, what´s going wrong. It seems there is some header files missing. thanks, thilo -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server
[Numpy-discussion] Changing Fatal error into ImportError?
Hi all, this was mentioned in the past, but I think it fell through the cracks: Python 2.3.4 (#1, Mar 10 2006, 06:12:09) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type help, copyright, credits or license for more information. import mwadap Overwriting info=function info at 0xb77198b4 from scipy.misc (was function info at 0xb7704bc4 from numpy.lib.utils) RuntimeError: module compiled against version 90909 of C-API but this version of numpy is 102 Fatal Python error: numpy.core.multiarray failed to import... exiting. I really think that this should raise ImportError, but NOT kill the python interpreter. If this happens in the middle of a long-running interactive session, you'll lose all of your current state/work, where a simple ImportError would have been enough to tell you that this particular module needed recompilation. FatalError should be reserved for situations where the internal state of the Python VM itself can not realistically be expected to be sane (corruption, complete memory exhaustion for even internal allocations, etc.) But killing the user's session for a failed import is a bit much, IMHO. Cheers, f - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Changing Fatal error into ImportError?
On 8/30/06, Robert Kern [EMAIL PROTECTED] wrote: I don't see where we're calling Py_FatalError. The problem might be in Python or mwadap. Indeed, import_array() raises a PyExc_ImportError. Sorry for the noise: it looks like this was already fixed: http://projects.scipy.org/scipy/numpy/changeset/3044 since the code causing problems had been built /before/ 3044, we got the FatalError. But with modules built post-3044, it's all good (I artificially hacked the number to force the error): In [1]: import mwadap Overwriting info=function info at 0x4158402c from scipy.misc (was function info at 0x4067410c from numpy.lib.utils) --- exceptions.RuntimeError Traceback (most recent call last) RuntimeError: module compiled against version 101 of C-API but this version of numpy is 102 --- exceptions.ImportError Traceback (most recent call last) /home/fperez/research/code/mwadap-merge/mwadap/test/ipython console /home/fperez/usr/lib/python2.3/site-packages/mwadap/__init__.py 9 glob,loc = globals(),locals() 10 for name in __all__: --- 11 __import__(name,glob,loc,[]) 12 13 # Namespace cleanup /home/fperez/usr/lib/python2.3/site-packages/mwadap/Operator.py 18 19 # Our own packages --- 20 import mwrep 21 from mwadap import mwqmfl, utils, Function, flinalg 22 ImportError: numpy.core.multiarray failed to import In [2]: Cheers, f - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] upcast
On 8/30/06, Lars Friedrich [EMAIL PROTECTED] wrote: Hello,I would like to discuss the following code:#***start***import numpy as Na = N.array((200), dtype = N.uint8)print (a * 100) / 100b = N.array((200, 200), dtype = N.uint8)print (b * 100) / 100 #***stop***The first print statement will print 200 because the uint8-value iscast upwards, I suppose. The second statement prints [0 0]. Isuppose this is due to overflows during the calculation. How can I tell numpy to do the upcast also in the second case, returning[200 200]? I am interested in the fastest solution regarding executiontime. In my application I would like to store the result in an Numeric.UInt8-array.Thanks for every commentTo answer the original question, you need to use a higher precision array or explicitly cast it to higher precision.In [49]:(a.astype(int)*100)/100 Out[49]:array([200])Chuck - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] Use of numarray from numpy package [# INC NO 24609]
Andrew Straw wrote: LANDRIU David SAp wrote: Hello, I come back to my question : how to use numarray with the numpy installation ? {ccali22}~(0)setenv PYTHONPATH /usr/local/lib/python2.3/site-packages/numpy Here's where you went wrong. You want: setenv PYTHONPATH /usr/local/lib/python2.3/site-packages {ccali22}~(0)python Python 2.3.5 (#2, Oct 17 2005, 17:20:02) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2 Type help, copyright, credits or license for more information. from numarray import * Traceback (most recent call last): File stdin, line 1, in ? File /usr/local/lib/python2.3/site-packages/numpy/numarray/__init__.py, line 1, in ? from util import * File /usr/local/lib/python2.3/site-packages/numpy/numarray/util.py, line 2, in ? from numpy import geterr ImportError: No module named numpy Note that you're actually importing a numarray within numpy's directory structure. That's because of your PYTHONPATH. numpy ships numpy.numarray to provide backwards compatibility. To use it, you must do import numpy.numarray as numarray Just to explain -- there is only a numarray directory inside numpy to provide some special treatment for people that do the transition from numarray to numpy - meaning: they can do somthing like from numpy import numarray and get a numpy(!) version that behaves more like numarray than the straight numpy ... Similar for from numarray import oldnumaric as Numeric (for people coming from Numeric ) Yes - it is actually confusing, but that's the baggage when there are 2 (now 3) numerical python packages is human history. The future will be much brighter - forget all of the above, and just use import numpy (I like import numpy as N for less typing - others prefer even from numpy import * ) Hope that helps, - Sebastian Haase - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion