From nwagner at mecha.uni-stuttgart.de Tue Jun 1 04:03:21 2004 From: nwagner at mecha.uni-stuttgart.de (Nils Wagner) Date: Tue, 01 Jun 2004 10:03:21 +0200 Subject: [SciPy-user] FAIL: check_basic (scipy.signal.signaltools.test_signaltools.test_wiener Message-ID: <40BC3849.2070908@mecha.uni-stuttgart.de> From latest cvs ====================================================================== FAIL: check_basic (scipy.signal.signaltools.test_signaltools.test_wiener) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/scipy/signal/tests/test_signaltools.py", line 33, in check_basic assert_array_almost_equal(h,correct,decimal=6) File "/usr/lib/python2.3/site-packages/scipy_test/testing.py", line 681, in assert_array_almost_equal assert cond,\ AssertionError: Arrays are not almost equal (mismatch 100.0%): Array 1: [[ 2.1111111 6. 4. 3. ] [ 3. 5. 6. 2. ] [ 2. 3. 5... Array 2: [[ 2.1637427 3.2222222 2.8888889 1.6666667] [ 2.6666667 4.3333333 4.4444444 2.8888889] [ 2.2222222 4.4444444 5... ---------------------------------------------------------------------- Ran 935 tests in 2.952s FAILED (failures=1) From carlo at jsbach.harvard.edu Tue Jun 1 10:34:34 2004 From: carlo at jsbach.harvard.edu (Carlo Mattoni) Date: Tue, 1 Jun 2004 10:34:34 -0400 (EDT) Subject: [SciPy-user] bug in diagsvd Message-ID: I'm not sure if this is the best place to report a bug, but I have found one in the function diagsvd in decomp.py. Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import scipy >>> scipy.linalg.diagsvd( scipy.array( [ 1, 0, 0 ] ), 3, 3 ) Traceback (most recent call last): File "", line 1, in ? File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/scipy/linalg/decomp.py", line 297, in diagsvd part = diag(s) NameError: global name 'diag' is not defined It appears that the problem is that the definition of diagsvd does not properly prepend scipy function calls with scip_base as all of the other functions in decomp.py do. I believe the diagsvd function (starting on line 295) should be changed from: def diagsvd(s,M,N): """Return sigma from singular values and original size M,N.""" part = diag(s) typ = part.typecode() MorN = len(s) if MorN == M: return c_[part,zeros((M,N-M),typ)] elif MorN == N: return r_[part,zeros((M-N,N),typ)] else: raise ValueError, "Length of s must be M or N." to: def diagsvd(s,M,N): """Return sigma from singular values and original size M,N.""" part = scipy_base.diag(s) typ = part.typecode() MorN = len(s) if MorN == M: return c_[part,scipy_base.zeros((M,N-M),typ)] elif MorN == N: return r_[part,scipy_base.zeros((M-N,N),typ)] else: raise ValueError, "Length of s must be M or N." Once this change is made, the original test works as expected: Python 2.3 (#1, Sep 13 2003, 00:49:11) [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import scipy >>> scipy.linalg.diagsvd( scipy.array( [ 1, 0, 0 ] ), 3, 3 ) array([[ 1., 0., 0.], [ 0., 0., 0.], [ 0., 0., 0.]]) From pearu at scipy.org Tue Jun 1 11:46:27 2004 From: pearu at scipy.org (Pearu Peterson) Date: Tue, 1 Jun 2004 10:46:27 -0500 (CDT) Subject: [SciPy-user] bug in diagsvd In-Reply-To: References: Message-ID: On Tue, 1 Jun 2004, Carlo Mattoni wrote: > I'm not sure if this is the best place to report a bug, Maybe scipy-dev would be more appropiate (until scipy roundup will be usable) than scipy-user mailing list but that's ok too, especially when bug reports are constructive. but I have > found one in the function diagsvd in decomp.py. > > Python 2.3 (#1, Sep 13 2003, 00:49:11) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import scipy > >>> scipy.linalg.diagsvd( scipy.array( [ 1, 0, 0 ] ), 3, 3 ) > Traceback (most recent call last): > File "", line 1, in ? > File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/scipy/linalg/decomp.py", > line 297, in diagsvd > part = diag(s) > NameError: global name 'diag' is not defined > > It appears that the problem is that the definition of diagsvd does not > properly prepend scipy function calls with scip_base as all of the other > functions in decomp.py do. Thanks for the patch, this is now fixed in CVS. Pearu From kir at lapshin.net Tue Jun 1 13:00:30 2004 From: kir at lapshin.net (Kirill Lapshin) Date: Tue, 01 Jun 2004 13:00:30 -0400 Subject: [SciPy-user] BLAS optimized matrix multiplication Message-ID: Hello, I am a new user, my apologies if that is a FAQ, but quick googling around did not reveal much info. I tried SciPy 0.3 with Numeric 23.1 on Windows, and dot seems to be very slow, looks like it is not using ATLAS. My quick research shows that there is a dotblas module, which is optional in Numeric, and apparently binaries available from Numeric sourceforge page do not include it (no wonder, they don't distribute ATLAS). However, since SciPy does distribute ATLAS, would it be possible to include dotblas in SciPy? Or maybe something similar already available in SciPy but I don't see it? On absolutely unrelated note, is there any plans on next release? I've seen somewhere on scipy.org statement that you guys want to release 0.3.1 soon after 0.3. Just checking. Thanks! And thanks for a nice product and all your hard work. --Kirill From kir at lapshin.net Tue Jun 1 13:14:17 2004 From: kir at lapshin.net (Kirill Lapshin) Date: Tue, 01 Jun 2004 13:14:17 -0400 Subject: [SciPy-user] Re: bug in diagsvd In-Reply-To: References: Message-ID: > Thanks for the patch, this is now fixed in CVS. Wow. You rock. Less then an hour from bugreport to fix. One nitpick though: the reason why this bug crept in on first place is missing unit test on diagsvd. If you would add even a simple two line test, like one Carlo posted, I would feel much much safer. If you want I can propose a patch. --Kirill From pearu at scipy.org Tue Jun 1 13:44:17 2004 From: pearu at scipy.org (Pearu Peterson) Date: Tue, 1 Jun 2004 12:44:17 -0500 (CDT) Subject: [SciPy-user] BLAS optimized matrix multiplication In-Reply-To: References: Message-ID: On Tue, 1 Jun 2004, Kirill Lapshin wrote: > Hello, > > I am a new user, my apologies if that is a FAQ, but quick googling > around did not reveal much info. > > I tried SciPy 0.3 with Numeric 23.1 on Windows, and dot seems to be very > slow, looks like it is not using ATLAS. Scipy 0.3 win32 installer should use ATLAS 3.6.0 that is optimized for PIII. Note that scipy.dot refers to Numeric/dotblas.dot function: In [1]: import scipy In [2]: scipy.dot.__module__ Out[2]: 'dotblas' (at least on my debian box). > My quick research shows that there is a dotblas module, which is > optional in Numeric, and apparently binaries available from Numeric > sourceforge page do not include it (no wonder, they don't distribute ATLAS). > > However, since SciPy does distribute ATLAS, would it be possible to > include dotblas in SciPy? Or maybe something similar already available > in SciPy but I don't see it? Scipy has linalg that contains wrappers to blas/lapack libraries and use ATLAS when available. See dir(scipy.linalg.cblas) dir(scipy.linalg.fblas) dir(scipy.linalg.clapack) dir(scipy.linalg.flapack) to learn which routines are wrapped. It is easy to add missing wrappers when required. > On absolutely unrelated note, is there any plans on next release? I've > seen somewhere on scipy.org statement that you guys want to release > 0.3.1 soon after 0.3. Just checking. Yes, I think we should release 0.3.1 before summer. Regards, Pearu From pearu at scipy.org Tue Jun 1 13:55:46 2004 From: pearu at scipy.org (Pearu Peterson) Date: Tue, 1 Jun 2004 12:55:46 -0500 (CDT) Subject: [SciPy-user] Re: bug in diagsvd In-Reply-To: References: Message-ID: On Tue, 1 Jun 2004, Kirill Lapshin wrote: > > Thanks for the patch, this is now fixed in CVS. > > Wow. You rock. Less then an hour from bugreport to fix. > > One nitpick though: the reason why this bug crept in on first place is > missing unit test on diagsvd. If you would add even a simple two line > test, like one Carlo posted, I would feel much much safer. If you want I > can propose a patch. A very simple unittest for diagsvd is in CVS now. There are always missing unittests in various scipy modules. For instance, when you execute scipy.test() then it will show which modules completely lack unittests. So, any addition to scipy unittest site will be greately appreciated. Thanks, Pearu From kir at lapshin.net Tue Jun 1 14:03:44 2004 From: kir at lapshin.net (Kirill Lapshin) Date: Tue, 01 Jun 2004 14:03:44 -0400 Subject: [SciPy-user] Re: BLAS optimized matrix multiplication In-Reply-To: References: Message-ID: <40BCC500.2010700@lapshin.net> Pearu Peterson wrote: > > Scipy 0.3 win32 installer should use ATLAS 3.6.0 that is optimized for > PIII. Note that scipy.dot refers to Numeric/dotblas.dot function: > > In [1]: import scipy > > In [2]: scipy.dot.__module__ > Out[2]: 'dotblas' > > (at least on my debian box). Well not on my Windows box. It says 'Numeric' here. I am using binary install from scipy.org, the one which claims that it comes with ATLAS 3.6.0. I guess the problem is that Numeric binary package distributed by Numeric guys does not have dotblas compiled. That's what I was trying to say -- Numeric comes without ATLAS so they did not include dotblas, but you do distribute ATLAS on windows, so it would be natural for you to add dotblas in SciPy. I know that I can recompile Numeric and SciPy, but it would be nice if default install would do the right thing. BTW, since you are using Debian, is there Debian package for SciPy? Looks like there is no official one yet, but maybe someone maintains unofficial? Any plans on official package? > Scipy has linalg that contains wrappers to blas/lapack libraries and use > ATLAS when available. See > > dir(scipy.linalg.cblas) > dir(scipy.linalg.fblas) > dir(scipy.linalg.clapack) > dir(scipy.linalg.flapack) Cool, thanks. x = scipy.linalg.fblas.dgemm(1,a,b) is much much faster than x = dot(a,b). BTW, why cblas module is almost empty and fblas has all the wrappers? Is it safe to assume that fblas has the same set of routines on all platforms, or is it configuration specific? > Yes, I think we should release 0.3.1 before summer. It is summer already :) Oh, wait, did you mean summer 2005? Just kidding. --Kirill From pearu at scipy.org Tue Jun 1 14:57:21 2004 From: pearu at scipy.org (Pearu Peterson) Date: Tue, 1 Jun 2004 13:57:21 -0500 (CDT) Subject: [SciPy-user] Re: BLAS optimized matrix multiplication In-Reply-To: <40BCC500.2010700@lapshin.net> References: <40BCC500.2010700@lapshin.net> Message-ID: On Tue, 1 Jun 2004, Kirill Lapshin wrote: > Pearu Peterson wrote: > > > > Scipy 0.3 win32 installer should use ATLAS 3.6.0 that is optimized for > > PIII. Note that scipy.dot refers to Numeric/dotblas.dot function: > > > > In [1]: import scipy > > > > In [2]: scipy.dot.__module__ > > Out[2]: 'dotblas' > > > > (at least on my debian box). > > Well not on my Windows box. It says 'Numeric' here. I am using binary > install from scipy.org, the one which claims that it comes with ATLAS > 3.6.0. I guess the problem is that Numeric binary package distributed by > Numeric guys does not have dotblas compiled. That's what I was trying to > say -- Numeric comes without ATLAS so they did not include dotblas, but > you do distribute ATLAS on windows, so it would be natural for you to > add dotblas in SciPy. I know that I can recompile Numeric and SciPy, but > it would be nice if default install would do the right thing. I agree. We need then dotblas implementation that uses linalg, testing site as well as some benchmarks. Any takers? > BTW, since you are using Debian, is there Debian package for SciPy? > Looks like there is no official one yet, but maybe someone maintains > unofficial? Any plans on official package? Yes, Jose Fonseca has packaged Scipy for debian. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=126037 Basically, a debian sponsor is needed for getting Scipy to official Debian but no one has responed since March according to the above debian bug issue. > > Scipy has linalg that contains wrappers to blas/lapack libraries and use > > ATLAS when available. See > > > > dir(scipy.linalg.cblas) > > dir(scipy.linalg.fblas) > > dir(scipy.linalg.clapack) > > dir(scipy.linalg.flapack) > > Cool, thanks. x = scipy.linalg.fblas.dgemm(1,a,b) is much much faster > than x = dot(a,b). > > BTW, why cblas module is almost empty and fblas has all the wrappers? Is > it safe to assume that fblas has the same set of routines on all > platforms, or is it configuration specific? Ideally, one should use blas/lapack functions returned by scipy.linalg.blas.get_blas_funcs scipy.linalg.lapack.get_lapack_funcs These hooks take into account the type and data-ordering of input arrays and return optimal routine for a particular task, see linalg functions for example usages. For example, In [25]: gemm, = scipy.linalg.blas.get_blas_funcs(['gemm'],(array([1,2],'f'),)) In [26]: gemm.typecode Out[26]: 'f' In [27]: gemm, = scipy.linalg.blas.get_blas_funcs(['gemm'],(array([1,2],'d'),)) In [28]: gemm.typecode cblas and fblas differ for several reasons (for 1-d arrays it doesn't matter whether you use cblas or fblas, cblas requires additional wrappers, etc) and at the moment it is not safe to assume that they will contain the same set of functions. > > Yes, I think we should release 0.3.1 before summer. > > It is summer already :) > Oh, wait, did you mean summer 2005? Just kidding. Well, in Estonia we still have spring;-) Summer starts in June 23. Pearu From scottbray83 at hotmail.com Wed Jun 2 00:55:03 2004 From: scottbray83 at hotmail.com (Scott Bray) Date: Wed, 02 Jun 2004 14:55:03 +1000 Subject: [SciPy-user] multivariate distributions Message-ID: An HTML attachment was scrubbed... URL: From rkern at ucsd.edu Wed Jun 2 01:28:44 2004 From: rkern at ucsd.edu (Robert Kern) Date: Tue, 01 Jun 2004 22:28:44 -0700 Subject: [SciPy-user] multivariate distributions In-Reply-To: References: Message-ID: <40BD658C.4030302@ucsd.edu> Scott Bray wrote: > Hey, > > I'm looking to build the joint pdf for a multivariate distribution. is > there any way of doing this in scipy? i have N observations for 5 > variables. i have done this for 2 variables and 1 using the cauchy > distribution and am looking to extend to 5 variables. can scipy help me > here? (or anyone out there?) You're going to have to derive the formulae on paper first. Then you can write a function that takes a 5-vector (x) and an array of the observations (data) as input and returns the (scalar) pdf value for the posterior distribution P(x|data). There's nothing specific to SciPy here. > Thanks > Scott -- Robert Kern rkern at ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter From scottbray83 at hotmail.com Wed Jun 2 01:57:26 2004 From: scottbray83 at hotmail.com (Scott Bray) Date: Wed, 02 Jun 2004 15:57:26 +1000 Subject: [SciPy-user] multivariate distributions Message-ID: An HTML attachment was scrubbed... URL: From fonnesbeck at mac.com Wed Jun 2 09:01:48 2004 From: fonnesbeck at mac.com (Christopher Fonnesbeck) Date: Wed, 2 Jun 2004 09:01:48 -0400 Subject: [SciPy-user] multivariate distributions In-Reply-To: References: Message-ID: <024274A4-B495-11D8-A1E3-000A956FDAC0@mac.com> On Jun 2, 2004, at 1:57 AM, Scott Bray wrote: > G'day Robert, > > i was kinda hoping you'd reply - you helped me out a little while ago. > well my project's sinced progressed and i've hit another problem. hope > you dont mind if i pick your brain again... > > i've done some wide reading and have found lots of info on multivarite > normal dists and some equations for the joint density of a > multivariate normal, but it doesn't seem useable to me. i have 5 lots > of N observations but the multinormal needs means and covariances > which i have been calculating FROM the functions (i did this using the > cauchy). i have heard about multivariate cauchy's but haven't been > able to find any concrete info. > > so my question is - how do i 'derive the formula on paper first'? I'm not sure how a cauchy is going to help you get at a multivariate normal distribution. Are your data overdispersed, or something? Most statistics texts will give you the pdf of a multivariate normal; you just have to code that into python. I have a multivariate normal and wishart (i.e. multivariate gamma) programmed in FORTRAN and compiled as a python module using f2py, if you want it. The rv module in scipy.stats has a multivariate_normal function, but this simply generates random variables. C. -- Christopher J. Fonnesbeck ( c h r i s @ f o n n e s b e c k . o r g ) Georgia Cooperative Fish & Wildlife Research Unit, University of Georgia "The primary objective of copyright is not to reward the labor of authors, but [t]o promote the Progress of Science and useful Arts. To this end, copyright assures authors the right to their original expression, but encourages others to build freely upon the ideas and information conveyed by a work. This result is neither unfair nor unfortunate. It is the means by which copyright advances the progress of science and art." -- US Supreme Court Justice Sandra Day O'Connor From karthik at james.hut.fi Wed Jun 2 14:14:30 2004 From: karthik at james.hut.fi (Karthikesh Raju) Date: Wed, 2 Jun 2004 21:14:30 +0300 Subject: [SciPy-user] Numarray - Numeric again Message-ID: Hi All, Can i work with Scipy with Numarray only. Most of my code is with numarray. Can both numarray and numeric co-exist? Ok, to scipy, is the filter (or is it lfilter) similar to matlab's filter command for implementing IIR and FIR filter. Thankx in advance Warm regards karthik ----------------------------------------------------------------------- Karthikesh Raju, email: karthik at james.hut.fi Researcher, http://www.cis.hut.fi/karthik Helsinki University of Technology, Tel: +358-9-451 5389 Laboratory of Comp. & Info. Sc., Fax: +358-9-451 3277 Department of Computer Sc., P.O Box 5400, FIN 02015 HUT, Espoo, FINLAND ----------------------------------------------------------------------- From oliphant at ee.byu.edu Wed Jun 2 18:17:00 2004 From: oliphant at ee.byu.edu (Travis Oliphant) Date: Wed, 02 Jun 2004 16:17:00 -0600 Subject: [SciPy-user] Numarray - Numeric again In-Reply-To: References: Message-ID: <40BE51DC.60901@ee.byu.edu> Karthikesh Raju wrote: >Hi All, > >Can i work with Scipy with Numarray only. Most of my code is with >numarray. Can both numarray and numeric co-exist? > > No (Numeric is the core array for SciPy for the near future) Yes (As far as I know numarray and Numeric can coexist). >Ok, to scipy, is the filter (or is it lfilter) similar to matlab's filter >command for implementing IIR and FIR filter. > > > Yes. signal.lfilter is similar to matlab's filter (Python already has a filter which applies a command to objects in a sequence). From ebpeele2 at pams.ncsu.edu Thu Jun 3 01:49:43 2004 From: ebpeele2 at pams.ncsu.edu (Elliot Peele) Date: Thu, 03 Jun 2004 01:49:43 -0400 Subject: [SciPy-user] tracebacks when running tests Message-ID: <1086241783.30681.14.camel@localhost.localdomain> When I run the tests I get tracebacks which reference scipy.linalg.eig. I wrote a simple test case to test this, but I get the following traceback. >>> import scipy.linalg >>> eig = scipy.linalg.eig Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.2/site-packages/scipy_base/ppimport.py", line 303, in __getattr__ module = self._ppimport_importer() File "/usr/lib/python2.2/site-packages/scipy_base/ppimport.py", line 273, in _ppimport_importer module = __import__(name,None,None,['*']) File "/usr/lib/python2.2/site-packages/scipy/linalg/__init__.py", line 8, in ? from basic import * File "/usr/lib/python2.2/site-packages/scipy/linalg/basic.py", line 11, in ? from lapack import get_lapack_funcs File "/usr/lib/python2.2/site-packages/scipy/linalg/lapack.py", line 16, in ? import clapack ImportError: /usr/lib/python2.2/site-packages/scipy/linalg/clapack.so: undefined symbol: clapack_sgesv Looking at the ldd output for clapack.so: [elliot at rkbuild linalg]$ ldd clapack.so liblapack.so.3 => /usr/lib/liblapack.so.3 (0xb6eb4000) libg2c.so.0 => /usr/lib/libg2c.so.0 (0xb6e96000) libm.so.6 => /lib/tls/libm.so.6 (0xb6e74000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6e6a000) libc.so.6 => /lib/tls/libc.so.6 (0xb6d32000) libblas.so.3 => /usr/lib/libblas.so.3 (0xb6ce2000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) It links against liblapack.so.3 which doesn't include the symbols that were added from atlas since they are in liblapack.a. Is there anyway to fix this? Elliot -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From pearu at scipy.org Thu Jun 3 04:42:08 2004 From: pearu at scipy.org (Pearu Peterson) Date: Thu, 3 Jun 2004 03:42:08 -0500 (CDT) Subject: [SciPy-user] tracebacks when running tests In-Reply-To: <1086241783.30681.14.camel@localhost.localdomain> References: <1086241783.30681.14.camel@localhost.localdomain> Message-ID: On Thu, 3 Jun 2004, Elliot Peele wrote: > When I run the tests I get tracebacks which reference scipy.linalg.eig. > I wrote a simple test case to test this, but I get the following > traceback. > > >>> import scipy.linalg > >>> eig = scipy.linalg.eig > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/python2.2/site-packages/scipy_base/ppimport.py", line > 303, in __getattr__ > module = self._ppimport_importer() > File "/usr/lib/python2.2/site-packages/scipy_base/ppimport.py", line > 273, in _ppimport_importer > module = __import__(name,None,None,['*']) > File "/usr/lib/python2.2/site-packages/scipy/linalg/__init__.py", line > 8, in ? from basic import * > File "/usr/lib/python2.2/site-packages/scipy/linalg/basic.py", line > 11, in ? > from lapack import get_lapack_funcs > File "/usr/lib/python2.2/site-packages/scipy/linalg/lapack.py", line > 16, in ? > import clapack > ImportError: /usr/lib/python2.2/site-packages/scipy/linalg/clapack.so: > undefined symbol: clapack_sgesv > > Looking at the ldd output for clapack.so: > > [elliot at rkbuild linalg]$ ldd clapack.so > liblapack.so.3 => /usr/lib/liblapack.so.3 (0xb6eb4000) > libg2c.so.0 => /usr/lib/libg2c.so.0 (0xb6e96000) > libm.so.6 => /lib/tls/libm.so.6 (0xb6e74000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6e6a000) > libc.so.6 => /lib/tls/libc.so.6 (0xb6d32000) > libblas.so.3 => /usr/lib/libblas.so.3 (0xb6ce2000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > It links against liblapack.so.3 which doesn't include the symbols that > were added from atlas since they are in liblapack.a. Is there anyway to > fix this? On what system you are running on? How did you install liblapack.a and ATLAS libraries? In principle, scipy can be built also against static libraries even when there exists a shared library with the same name but different contents. Btw, that does not make any sense for me, I would call it a bug in the linux distribution. Anyways, see system_info.py and set search_static_first=1 there. A better fix: install atlas libraries to a different directory than /usr/lib, preferably by following instructions in http://www.scipy.org/documentation/buildatlas4scipy.txt and then use ATLAS environment variable to point to the location of atlas libraries. As Fernando already (almost) discovered, you don't need to specify ATLAS environment variable when the location of ATLAS libraries matches one of the following locations: /usr/local/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ /opt/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ /usr/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ /sw/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ /lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ Regards, Pearu From fperez at colorado.edu Thu Jun 3 11:15:40 2004 From: fperez at colorado.edu (Fernando Perez) Date: Thu, 03 Jun 2004 09:15:40 -0600 Subject: [SciPy-user] tracebacks when running tests In-Reply-To: <1086241783.30681.14.camel@localhost.localdomain> References: <1086241783.30681.14.camel@localhost.localdomain> Message-ID: <40BF409C.4090501@colorado.edu> Elliot Peele wrote: > Looking at the ldd output for clapack.so: > > [elliot at rkbuild linalg]$ ldd clapack.so > liblapack.so.3 => /usr/lib/liblapack.so.3 (0xb6eb4000) > libg2c.so.0 => /usr/lib/libg2c.so.0 (0xb6e96000) > libm.so.6 => /lib/tls/libm.so.6 (0xb6e74000) > libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6e6a000) > libc.so.6 => /lib/tls/libc.so.6 (0xb6d32000) > libblas.so.3 => /usr/lib/libblas.so.3 (0xb6ce2000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > It links against liblapack.so.3 which doesn't include the symbols that > were added from atlas since they are in liblapack.a. Is there anyway to > fix this? Pearu already gave you the solution, so here I'm just providing you the link to my very same question from yesterday, but on scipy-dev. This is the thread where Pearu mentioned my almost finding that /usr/lib/atlas is the best location for the atlas-enabled static libs to live, so that conflicts with the dynamic ones are avoided: http://www.scipy.org/mailinglists/mailman?fn=scipy-dev/2004-June/002149.html Regards, f From ebpeele2 at pams.ncsu.edu Thu Jun 3 16:58:46 2004 From: ebpeele2 at pams.ncsu.edu (Elliot Peele) Date: Thu, 03 Jun 2004 16:58:46 -0400 Subject: [SciPy-user] tracebacks when running tests In-Reply-To: References: <1086241783.30681.14.camel@localhost.localdomain> Message-ID: <1086296326.21334.18.camel@babylon.physics.ncsu.edu> On Thu, 2004-06-03 at 04:42, Pearu Peterson wrote: > On what system you are running on? How did you install liblapack.a and > ATLAS libraries? Red Hat Enterprise Linux 3 > In principle, scipy can be built also against static libraries even > when there exists a shared library with the same name but different > contents. Btw, that does not make any sense for me, I would call it a bug > in the linux distribution. Anyways, see system_info.py and set > search_static_first=1 there. > > A better fix: install atlas libraries to a different directory than > /usr/lib, preferably by following instructions in > > http://www.scipy.org/documentation/buildatlas4scipy.txt > > and then use ATLAS environment variable to point to the location of atlas > libraries. As Fernando already (almost) discovered, you don't need to > specify ATLAS environment variable when the location of ATLAS libraries > matches one of the following locations: > > /usr/local/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ > /opt/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ > /usr/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ > /sw/lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ > /lib/{atlas*,ATLAS*,sse,3dnow,sse2,}/ I tried compiling atlas and installing it in /usr/lib/atlas/* and now I get different problems. I get an undefined symbol for s_wsfe in flapack.so. The ldd output for flapack.so is: [elliot at rkbuild linalg]$ ldd flapack.so libc.so.6 => /lib/tls/libc.so.6 (0xb7166000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) I have also tried changing the system_info.py to use static libs and that doesn't seem to change anything. Before I was following the published documentation that comes with scipy to combine the liblapack.a from lapack and the liblapack.a from atlas and the atlas symbols just wheren't in liblapack.so.3. I also tried setting the variable in system_info.py to use static libs and that didn't seem to change anything. Also I've noticed a bug in building rpms with setup.py. Since Red Hat's rpm generates debug packages there are two package to copy into the dist directory and python's distutils seems to traceback when thats the case. Elliot > Regards, > Pearu > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From pearu at scipy.org Thu Jun 3 18:07:56 2004 From: pearu at scipy.org (Pearu Peterson) Date: Thu, 3 Jun 2004 17:07:56 -0500 (CDT) Subject: [SciPy-user] tracebacks when running tests In-Reply-To: <1086296326.21334.18.camel@babylon.physics.ncsu.edu> References: <1086241783.30681.14.camel@localhost.localdomain> <1086296326.21334.18.camel@babylon.physics.ncsu.edu> Message-ID: On Thu, 3 Jun 2004, Elliot Peele wrote: > I tried compiling atlas and installing it in /usr/lib/atlas/* and now I > get different problems. I get an undefined symbol for s_wsfe in > flapack.so. The ldd output for flapack.so is: > > [elliot at rkbuild linalg]$ ldd flapack.so > libc.so.6 => /lib/tls/libc.so.6 (0xb7166000) > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) s_wsfe should be defined in the g2c library. What compiler are you using? You should use the same Fortran compiler for all Fortran libraries but the above undefined symbol message indicates that either you are not using gnu compiler or -lg2c is required for some reason. See the relevant section in INSTALL.txt. Btw, sometimes starting over from fresh and following closely provided instructions will fix curious bugs ;-) Pearu From ebpeele2 at pams.ncsu.edu Thu Jun 3 18:26:59 2004 From: ebpeele2 at pams.ncsu.edu (Elliot Peele) Date: Thu, 03 Jun 2004 18:26:59 -0400 Subject: [SciPy-user] tracebacks when running tests In-Reply-To: References: <1086241783.30681.14.camel@localhost.localdomain> <1086296326.21334.18.camel@babylon.physics.ncsu.edu> Message-ID: <1086301619.21334.21.camel@babylon.physics.ncsu.edu> On Thu, 2004-06-03 at 18:07, Pearu Peterson wrote: > On Thu, 3 Jun 2004, Elliot Peele wrote: > > > I tried compiling atlas and installing it in /usr/lib/atlas/* and now I > > get different problems. I get an undefined symbol for s_wsfe in > > flapack.so. The ldd output for flapack.so is: > > > > [elliot at rkbuild linalg]$ ldd flapack.so > > libc.so.6 => /lib/tls/libc.so.6 (0xb7166000) > > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) > > s_wsfe should be defined in the g2c library. > What compiler are you using? You should use the same Fortran compiler for > all Fortran libraries but the above undefined symbol message indicates > that either you are not using gnu compiler or -lg2c is required for some > reason. See the relevant section in INSTALL.txt. > > Btw, sometimes starting over from fresh and following closely provided > instructions will fix curious bugs ;-) > > Pearu I'm using g77 3.2.3 and I have gone back and followed to INSTALL.txt closely. Elliot -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From Fernando.Perez at colorado.edu Thu Jun 3 19:41:06 2004 From: Fernando.Perez at colorado.edu (Fernando Perez) Date: Thu, 03 Jun 2004 17:41:06 -0600 Subject: [SciPy-user] tracebacks when running tests In-Reply-To: <1086296326.21334.18.camel@babylon.physics.ncsu.edu> References: <1086241783.30681.14.camel@localhost.localdomain> <1086296326.21334.18.camel@babylon.physics.ncsu.edu> Message-ID: <40BFB712.1060101@colorado.edu> Elliot Peele wrote: > Also I've noticed a bug in building rpms with setup.py. Since Red Hat's > rpm generates debug packages there are two package to copy into the dist > directory and python's distutils seems to traceback when thats the case. You and I seem to be tracking each other fairly closely in terms of the bugs we run into :) Just yesterday I posted this exact same message to the numpy list. The end of the traceback there was: "/usr/src/build/394694-i386/install/usr/lib/python2.3/distutils/command/bdist_rpm.py", line 316, in run AssertionError: unexpected number of RPM files found: ['build/bdist.linux-i686/rpm/RPMS/i386/Numeric-23.1-1.i386.rpm', 'build/bdist.linux-i686/rpm/RPMS/i386/Numeric-debuginfo-23.1-1.i386.rpm'] The good thing is that the rpms DO get built, so you can just fish them out by hand from this path and use them. It might be worth filing a distutils bug on SF about this one. Cheers, f From pearu at scipy.org Fri Jun 4 01:32:17 2004 From: pearu at scipy.org (Pearu Peterson) Date: Fri, 4 Jun 2004 00:32:17 -0500 (CDT) Subject: [SciPy-user] tracebacks when running tests In-Reply-To: <1086301619.21334.21.camel@babylon.physics.ncsu.edu> References: <1086241783.30681.14.camel@localhost.localdomain> <1086296326.21334.18.camel@babylon.physics.ncsu.edu> <1086301619.21334.21.camel@babylon.physics.ncsu.edu> Message-ID: On Thu, 3 Jun 2004, Elliot Peele wrote: > > Btw, sometimes starting over from fresh and following closely provided > > instructions will fix curious bugs ;-) > > I'm using g77 3.2.3 and I have gone back and followed to INSTALL.txt > closely. So, was there any success? Btw, up-to-date instructions for building scipy can be found in http://www.scipy.org/documentation/buildscipy.txt In my previous mail I was refering to INSTALL.txt `Known problems` section where there is a hint what do to when getting 'undefined symbol: s_wsfe' import errors. To be explicit, try this: rm -rf build python setup.py build build_ext -lg2c install HTH, Pearu From h.jansen at fel.tno.nl Fri Jun 4 12:06:45 2004 From: h.jansen at fel.tno.nl (H Jansen) Date: Fri, 04 Jun 2004 18:06:45 +0200 Subject: [SciPy-user] distributed computing Message-ID: <1086365205.6555.190.camel@pc50002760.fel.tno.nl> I want to develop a complex, real-time scientific computing application on a 4-node (4x2) multiprocessor (4 dual-processor boards). What is the best distributed computation model that I should use: message-passing (MPI), client-server computation agents, threads, ... ? Has anyone some suggestion? Thanks. -- Henk Jansen TNO Physics and Electronics Laboratory -- ------------------------------------------------------------------------------ The disclaimer that applies to e-mail from TNO Physics and Electronics Laboratory can be found on: http://www.tno.nl/disclaimer/email.html ------------------------------------------------------------------------------ From Fernando.Perez at colorado.edu Fri Jun 4 13:23:54 2004 From: Fernando.Perez at colorado.edu (Fernando Perez) Date: Fri, 04 Jun 2004 11:23:54 -0600 Subject: [SciPy-user] distributed computing In-Reply-To: <1086365205.6555.190.camel@pc50002760.fel.tno.nl> References: <1086365205.6555.190.camel@pc50002760.fel.tno.nl> Message-ID: <40C0B02A.90606@colorado.edu> H Jansen wrote: > I want to develop a complex, real-time scientific computing application > on a 4-node (4x2) multiprocessor (4 dual-processor boards). What is the > best distributed computation model that I should use: message-passing > (MPI), client-server computation agents, threads, ... ? Has anyone some > suggestion? Thanks. Keep in mind that if you use a threading model, you'll be bitten by the Python GIL (Global Interpreter Lock). Basically it means that as long as you are running inside pure python code, only one thread runs at a time. Your C extensions can release the GIL, so with a bit of planning the problem is manageable. MPI has python wrappers, so that's an option as well. Best, f From prabhu at aero.iitm.ernet.in Fri Jun 4 13:42:29 2004 From: prabhu at aero.iitm.ernet.in (Prabhu Ramachandran) Date: Fri, 4 Jun 2004 23:12:29 +0530 Subject: [SciPy-user] distributed computing In-Reply-To: <40C0B02A.90606@colorado.edu> References: <1086365205.6555.190.camel@pc50002760.fel.tno.nl> <40C0B02A.90606@colorado.edu> Message-ID: <16576.46213.775675.240656@monster.linux.in> >>>>> "FP" == Fernando Perez writes: FP> H Jansen wrote: >> I want to develop a complex, real-time scientific computing >> application on a 4-node (4x2) multiprocessor (4 dual-processor >> boards). What is the best distributed computation model that I >> should use: message-passing (MPI), client-server computation >> agents, threads, ... ? Has anyone some suggestion? Thanks. FP> Keep in mind that if you use a threading model, you'll be FP> bitten by the Python GIL (Global Interpreter Lock). Basically FP> it means that as long as you are running inside pure python FP> code, only one thread runs at a time. Your C extensions can FP> release the GIL, so with a bit of planning the problem is FP> manageable. MPI has python wrappers, so that's an option as FP> well. The answer really depends on what kind of distributed computing he wants to do. If the problem is not embarrassingly parallel and there is a lot of communication necessary MPI sounds like a good option. Konrad Hinsen presented a talk on BSP (Bulk Synchronous Parallelism) last year at SciPy'03. I am not sure if your problem is suited to it. If non-blocking calls are all you need you might want to try PyPar http://datamining.anu.edu.au/~ole/pypar/ Its easy to install, works on Numeric arrays, Pythonic and easy to use. It does not require a specially compiled Python interpreter either. cheers, prabhu From horstess2001 at yahoo.de Fri Jun 4 16:37:18 2004 From: horstess2001 at yahoo.de (Horst Horstsen) Date: Fri, 04 Jun 2004 22:37:18 +0200 Subject: [SciPy-user] active window Message-ID: <5.1.0.14.0.20040604222601.00ba2238@rcs.urz.tu-dresden.de> Hello, I've got a question concerning the scipy.xlpt - package: If I have two plot-windows how to find out which one is selected by the user? The user can click one or the other window with the mouse. I already know about the command window() but this only gives back the window I lastly selected in my programm (maybe a feature for oblivious programmers...). Thank you for help! Greetings by PHIL From nwagner at mecha.uni-stuttgart.de Mon Jun 7 10:14:35 2004 From: nwagner at mecha.uni-stuttgart.de (Nils Wagner) Date: Mon, 07 Jun 2004 16:14:35 +0200 Subject: [SciPy-user] Contour plots Message-ID: <40C4784B.4050801@mecha.uni-stuttgart.de> Dear experts, I want to compute f(x,y) = log(abs(det(A(x+1j*y)))) over a grid of x,y. How can I contour the result within scipy or matplotlib ? A small example will be appreciated. Thanks in advance. Nils From jose.martin at wanadoo.es Mon Jun 7 14:14:42 2004 From: jose.martin at wanadoo.es (=?iso-8859-1?Q?Jos=E9_A_Mart=EDn_H?=) Date: Mon, 7 Jun 2004 20:14:42 +0200 Subject: [SciPy-user] Help !!!! Message-ID: <000a01c44cbb$4f495da0$98056750@CASA> Why Mr Anderson Why ?????????. Please need help Can some one explain me what is going on in this two functions ? why they are not equal ? ----------------------------------------------------------------------- def Resta(B,N): X=3**(N-1) result=0 for i in range(10): result+= (2**i) * X /(3**i) return (3**N)-result -------------------------------------------------------------------- def RestaX(B,N): X=3**(N-1) result=0 for i in range(10): result+= X * ((2**i)/(3**i)) return (3**N)-result ---------------------------------------------------------------------------- This is math. Then sum( X * a) = X * sum(a) being X a constant , is it true ???? Why in python is it not true ? Thanks.... J.A. Martin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pearu at scipy.org Mon Jun 7 14:38:35 2004 From: pearu at scipy.org (Pearu Peterson) Date: Mon, 7 Jun 2004 13:38:35 -0500 (CDT) Subject: [SciPy-user] Help !!!! In-Reply-To: <000a01c44cbb$4f495da0$98056750@CASA> References: <000a01c44cbb$4f495da0$98056750@CASA> Message-ID: On Mon, 7 Jun 2004, Jos? A Mart?n H wrote: > Why Mr Anderson Why ?????????. > > Please need help > Can some one explain me what is going on in this two functions ? > why they are not equal ? > ----------------------------------------------------------------------- > def Resta(B,N): > X=3**(N-1) > result=0 > > for i in range(10): > result+= (2**i) * X /(3**i) > > return (3**N)-result > -------------------------------------------------------------------- > def RestaX(B,N): > X=3**(N-1) > result=0 > > for i in range(10): > result+= X * ((2**i)/(3**i)) > > > return (3**N)-result > ---------------------------------------------------------------------------- > > This is math. > > Then sum( X * a) = X * sum(a) being X a constant , is it true ???? > > Why in python is it not true ? The above functions do *integer* math and then a*(b/c)==(a*b)/c holds only in special cases (when c divides b). If you would write result+= float(2**i) * X /(3**i) or result+= X * (float(2**i)/(3**i)) then the two functions should be (approximately) equal. Pearu From daishi at egcrc.net Mon Jun 7 19:28:05 2004 From: daishi at egcrc.net (Daishi Harada) Date: Mon, 7 Jun 2004 16:28:05 -0700 Subject: [SciPy-user] Finding min/max indices satisfying a predicate Message-ID: <538A940C-B8DA-11D8-91C4-000A956CCEE8@egcrc.net> Hi, I am wondering if there is a canonical recipe for doing the following efficiently/without using list comprehensions: min_index = min([i for i in xrange(len(x)) if predicate(x[i])]) where x is some numarray. In particular I would be interested in some mechanism which is O(min_index) instead of O(len(x)). (I am currently using the naive basic python version of the O(min_index) search, but was curious if there was something built in to scipy). FWIW, the predicates that I am interested in are as simple as x[i] > SOME_CONSTANT. Thanks, d From novak at ucolick.org Tue Jun 8 01:20:51 2004 From: novak at ucolick.org (Greg Novak) Date: Mon, 7 Jun 2004 22:20:51 -0700 (PDT) Subject: [SciPy-user] Weave Documentation: Message-ID: It seems that the Weave documentation is in serious need of attention. In particular, the "Binary Search" example on the web page: http://www.scipy.org/documentation/weave/weaveusersguide.html#Binary%20search simply fails for me, with error messages given below. If I change the example code to: # now the C code code = """ #line 42 "binary_search.py" int val, m, min = 0; int max = seq.length() - 1; PyObject *py_val; for(;;) { if (max < min ) { return_val = PyInt_FromLong(-1); break; } m = (min + max) /2; val = py_to_int(PyList_GetItem(py_seq,m),"val"); ; if (val < t) min = m + 1; else if (val > t) max = m - 1; else { return_val = PyInt_FromLong(m); break; } } """ then it works. I'm using gcc 3.2.2. So... what's going on? Thanks a bunch, Greg Error messages from online example: ----------------------------------- >>> c_int_binary_search([1,2,3],3) file changed None running build_ext binary_search.py: In function `PyObject* compiled_func(PyObject*, PyObject*)': binary_search.py:36: `Py' undeclared (first use this function) binary_search.py:36: (Each undeclared identifier is reported only once for each function it appears in.) binary_search.py:36: parse error before `::' token binary_search.py:40: no matching function for call to `py::list::ptr()' binary_search.py:47: parse error before `::' token binary_search.py: In function `PyObject* compiled_func(PyObject*, PyObject*)': binary_search.py:36: `Py' undeclared (first use this function) binary_search.py:36: (Each undeclared identifier is reported only once for each function it appears in.) binary_search.py:36: parse error before `::' token binary_search.py:40: no matching function for call to `py::list::ptr()' binary_search.py:47: parse error before `::' token Traceback (most recent call last): File "", line 1, in ? File "tst.py", line 99, in c_int_binary_search return weave.inline(code,['seq','t'],verbose=2) File "/usr/lib/python2.2/site-packages/weave/inline_tools.py", line 335, in inline auto_downcast = auto_downcast, File "/usr/lib/python2.2/site-packages/weave/inline_tools.py", line 439, in compile_function verbose=verbose, **kw) File "/usr/lib/python2.2/site-packages/weave/ext_tools.py", line 340, in compile verbose = verbose, **kw) File "/usr/lib/python2.2/site-packages/weave/build_tools.py", line 274, in build_extension setup(name = module_name, ext_modules = [ext],verbose=verb) File "/usr/lib/python2.2/site-packages/scipy_distutils/core.py", line 72, in setup return old_setup(**new_attr) File "/usr/lib/python2.2/distutils/core.py", line 157, in setup raise SystemExit, "error: " + str(msg) weave.build_tools.CompileError: error: Command "g++ -DNDEBUG -O2 -g -pipe -march=i386 -mcpu=i686 -D_GNU_SOURCE -fPIC -fPIC -I/usr/lib/python2.2/site-packages/weave -I/usr/lib/python2.2/site-packages/weave/scxx -I/usr/include/python2.2 -c /home/novak/.python22_compiled/sc_8599780ae275511179a480c1a126feda1.cpp -o /tmp/novak/python22_intermediate/compiler_c0261050efb392e52f3c1d0d86c2137d/sc_8599780ae275511179a480c1a126feda1.o" failed with exit status 1 From arnd.baecker at web.de Tue Jun 8 05:59:08 2004 From: arnd.baecker at web.de (Arnd Baecker) Date: Tue, 8 Jun 2004 11:59:08 +0200 (CEST) Subject: [SciPy-user] active window - scipy.xplt In-Reply-To: <5.1.0.14.0.20040604222601.00ba2238@rcs.urz.tu-dresden.de> References: <5.1.0.14.0.20040604222601.00ba2238@rcs.urz.tu-dresden.de> Message-ID: On Fri, 4 Jun 2004, Horst Horstsen wrote: > Hello, > > I've got a question concerning the scipy.xlpt - package: > > If I have two plot-windows how to find out which one is selected by the > user? The user can click one or the other window with the mouse. > I already know about the command window() but this only gives back the > window I lastly selected in my programm (maybe a feature for oblivious > programmers...). > > Thank you for help! > > Greetings by PHIL As far as I know (please correct me!) this is not possible. This is actually something which annoys me for quite a while as well, so here is a simple example: #################### from scipy.xplt import * x=arange(0.0,1.0,0.1) window(0) plg(x,x) window(1) plg(x*x,x) while 1: m=mouse(1,1,"Click with the mouse, finish with right-click") if m[9]==3: break ######################## Clicking in window 1 (the "active" one) the output of mouse is as expected. However, clicking in window 0 one gets the last coordinates clicked in window 1, but no meaningful answer. Dear scipy.xplt gurus: Would it be possible to - return the right click-coordinates regardless of the "active" window - add mouse[11] as return parameter which contains the window number in which the user clicked ? I think that this would be a very usefull feature! Best, Arnd From bryan.cole at teraview.com Tue Jun 8 06:43:21 2004 From: bryan.cole at teraview.com (Bryan Cole) Date: Tue, 08 Jun 2004 11:43:21 +0100 Subject: [SciPy-user] Re: Contour plots References: <40C4784B.4050801@mecha.uni-stuttgart.de> Message-ID: On Mon, 07 Jun 2004 16:14:35 +0200, Nils Wagner wrote: > Dear experts, ... doesn't apply to me. > I want to compute > > f(x,y) = log(abs(det(A(x+1j*y)))) > > over a grid of x,y. > > How can I contour the result within scipy or matplotlib ? > I struggled with this a while back. You can plot pixmaps from 2D array data using either scipy.plt or matplotlib, but I don't think you can get contours. gplt (Gnuplot) can generate contours in 3D plots but I can't see a way to get a contour plot on 2D axes. Gist can do contours but scipy.xplt is unix-only and anyway, I couldn't get scipy.xplt to compile on my FC2-linux machine, so havn't tried it myself. There is a separate python interface to gist, PyGist (http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist-1.5.18a.tar.gz) which works well. I've just been experimenting with it and it looks the best out-the-box plotting solution for contours so far. PyGist is also available for win32. The Gist command set is rather cryptic, however; matplotlib is much easier for normal 2D graphs IMHO. There's a PyGist example below. Bryan ------------------------- from gist import * winkill(0) window(0, wait=1, style='boxed2.gs') ij = indices((20,20))/20.0 #make a grid x = ij[0] y = ij[1] def f(x,y): #or the function of your choice... return sin(x**2) + cos(y**2) z = f(x,y) plc(z, y, x) #makes contour plot raw_input() #to stop python exiting From arnd.baecker at web.de Tue Jun 8 08:35:34 2004 From: arnd.baecker at web.de (Arnd Baecker) Date: Tue, 8 Jun 2004 14:35:34 +0200 (CEST) Subject: [SciPy-user] Re: Contour plots In-Reply-To: References: <40C4784B.4050801@mecha.uni-stuttgart.de> Message-ID: On Tue, 8 Jun 2004, Bryan Cole wrote: > On Mon, 07 Jun 2004 16:14:35 +0200, Nils Wagner wrote: > > > Dear experts, > > ... doesn't apply to me. me neither, but still ...: > > I want to compute > > > > f(x,y) = log(abs(det(A(x+1j*y)))) > > > > over a grid of x,y. > > > > How can I contour the result within scipy or matplotlib ? > > > > I struggled with this a while back. You can plot pixmaps from 2D array > data using either scipy.plt or matplotlib, but I don't think you can get > contours. gplt (Gnuplot) can generate contours in 3D plots but I can't see > a way to get a contour plot on 2D axes. I think one trick was to use "set term table; set out "cont.dat" ; replot ; set out" to write the contour data into the file cont.dat (untested^TM). > Gist can do contours but > scipy.xplt is unix-only and anyway, scipy.xplt does work under Windows (and apparently Mac support is on it's way) (In our class we have many students using scipy.xplt on Windows more or less happily) If you need the actual contour data: _maybe_ it is possible to use the (internal?) contour command as done in gist.py in the routine `plfc` for i in range (n + 1) : [nc, yc, xc] = contour (array ( [vc [i], vc [i + 1]]), z) > I couldn't get scipy.xplt to compile > on my FC2-linux machine, Maybe it is worth describing your problems with compiling in more detail so that the experts could fix any issues ... > so havn't tried it myself. > > There is a separate python interface to gist, PyGist > (http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist-1.5.18a.tar.gz) > which works well. I've just been experimenting with it and it looks the > best out-the-box plotting solution for contours so far. PyGist is also > available for win32. The Gist command set is rather cryptic, however; This one might help a bit: http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist_html/pygist.html > matplotlib is much easier for normal 2D graphs IMHO. > > There's a PyGist example below. If you replace "from gist import *" by "from scipy.xplt import *" it also works fine from scipy.xplt. Best, Arnd > ------------------------- > > from gist import * > winkill(0) > window(0, wait=1, style='boxed2.gs') > > ij = indices((20,20))/20.0 #make a grid > > x = ij[0] > y = ij[1] > > def f(x,y): #or the function of your choice... > return sin(x**2) + cos(y**2) > > z = f(x,y) > > plc(z, y, x) #makes contour plot > > raw_input() #to stop python exiting > From arnd.baecker at web.de Tue Jun 8 08:35:34 2004 From: arnd.baecker at web.de (Arnd Baecker) Date: Tue, 8 Jun 2004 14:35:34 +0200 (CEST) Subject: [SciPy-user] Re: Contour plots In-Reply-To: References: <40C4784B.4050801@mecha.uni-stuttgart.de> Message-ID: On Tue, 8 Jun 2004, Bryan Cole wrote: > On Mon, 07 Jun 2004 16:14:35 +0200, Nils Wagner wrote: > > > Dear experts, > > ... doesn't apply to me. me neither, but still ...: > > I want to compute > > > > f(x,y) = log(abs(det(A(x+1j*y)))) > > > > over a grid of x,y. > > > > How can I contour the result within scipy or matplotlib ? > > > > I struggled with this a while back. You can plot pixmaps from 2D array > data using either scipy.plt or matplotlib, but I don't think you can get > contours. gplt (Gnuplot) can generate contours in 3D plots but I can't see > a way to get a contour plot on 2D axes. I think one trick was to use "set term table; set out "cont.dat" ; replot ; set out" to write the contour data into the file cont.dat (untested^TM). > Gist can do contours but > scipy.xplt is unix-only and anyway, scipy.xplt does work under Windows (and apparently Mac support is on it's way) (In our class we have many students using scipy.xplt on Windows more or less happily) If you need the actual contour data: _maybe_ it is possible to use the (internal?) contour command as done in gist.py in the routine `plfc` for i in range (n + 1) : [nc, yc, xc] = contour (array ( [vc [i], vc [i + 1]]), z) > I couldn't get scipy.xplt to compile > on my FC2-linux machine, Maybe it is worth describing your problems with compiling in more detail so that the experts could fix any issues ... > so havn't tried it myself. > > There is a separate python interface to gist, PyGist > (http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist-1.5.18a.tar.gz) > which works well. I've just been experimenting with it and it looks the > best out-the-box plotting solution for contours so far. PyGist is also > available for win32. The Gist command set is rather cryptic, however; This one might help a bit: http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist_html/pygist.html > matplotlib is much easier for normal 2D graphs IMHO. > > There's a PyGist example below. If you replace "from gist import *" by "from scipy.xplt import *" it also works fine from scipy.xplt. Best, Arnd > ------------------------- > > from gist import * > winkill(0) > window(0, wait=1, style='boxed2.gs') > > ij = indices((20,20))/20.0 #make a grid > > x = ij[0] > y = ij[1] > > def f(x,y): #or the function of your choice... > return sin(x**2) + cos(y**2) > > z = f(x,y) > > plc(z, y, x) #makes contour plot > > raw_input() #to stop python exiting > From nwagner at mecha.uni-stuttgart.de Tue Jun 8 08:54:28 2004 From: nwagner at mecha.uni-stuttgart.de (Nils Wagner) Date: Tue, 08 Jun 2004 14:54:28 +0200 Subject: [SciPy-user] Re: Contour plots In-Reply-To: References: <40C4784B.4050801@mecha.uni-stuttgart.de> Message-ID: <40C5B704.8000400@mecha.uni-stuttgart.de> Arnd Baecker wrote: > On Tue, 8 Jun 2004, Bryan Cole wrote: > > >>On Mon, 07 Jun 2004 16:14:35 +0200, Nils Wagner wrote: >> >> >>>Dear experts, >> >>... doesn't apply to me. > > > me neither, but still ...: > > >>>I want to compute >>> >>> f(x,y) = log(abs(det(A(x+1j*y)))) >>> >>>over a grid of x,y. >>> >>>How can I contour the result within scipy or matplotlib ? >>> >> >>I struggled with this a while back. You can plot pixmaps from 2D array >>data using either scipy.plt or matplotlib, but I don't think you can get >>contours. gplt (Gnuplot) can generate contours in 3D plots but I can't see >>a way to get a contour plot on 2D axes. > > > I think one trick was to use > "set term table; set out "cont.dat" ; replot ; set out" > to write the contour data into the file cont.dat > (untested^TM). > > >>Gist can do contours but >>scipy.xplt is unix-only and anyway, > > > scipy.xplt does work under Windows (and apparently Mac support > is on it's way) > (In our class we have many students using scipy.xplt on Windows > more or less happily) > > > If you need the actual contour data: _maybe_ > it is possible to use the (internal?) contour command as > done in gist.py in the routine `plfc` > > for i in range (n + 1) : > [nc, yc, xc] = contour (array ( [vc [i], vc [i + 1]]), z) > > > >>I couldn't get scipy.xplt to compile >>on my FC2-linux machine, > > > Maybe it is worth describing your problems with compiling > in more detail so that the experts could fix any issues ... > > >>so havn't tried it myself. >> >>There is a separate python interface to gist, PyGist >>(http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist-1.5.18a.tar.gz) >>which works well. I've just been experimenting with it and it looks the >>best out-the-box plotting solution for contours so far. PyGist is also >>available for win32. The Gist command set is rather cryptic, however; > > > This one might help a bit: > http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist_html/pygist.html > > > >>matplotlib is much easier for normal 2D graphs IMHO. >> >>There's a PyGist example below. > > > If you replace "from gist import *" > by "from scipy.xplt import *" > it also works fine from scipy.xplt. > > > Best, > > Arnd > > >>------------------------- >> >>from gist import * >>winkill(0) >>window(0, wait=1, style='boxed2.gs') >> >>ij = indices((20,20))/20.0 #make a grid >> >>x = ij[0] >>y = ij[1] >> >>def f(x,y): #or the function of your choice... >> return sin(x**2) + cos(y**2) >> >>z = f(x,y) >> >>plc(z, y, x) #makes contour plot >> >>raw_input() #to stop python exiting >> > > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user > And how about filled contours ? How can I obtain a legend illustrating the different levels. Nils From JADDISON at SYSTEMS.TEXTRON.com Wed Jun 9 21:27:32 2004 From: JADDISON at SYSTEMS.TEXTRON.com (Addison, Jason) Date: Wed, 9 Jun 2004 15:27:32 -1000 Subject: [SciPy-user] "dynamic" indexing Message-ID: <200406091527.32432.jaddison@systems.textron.com> How can I take a slice from an array when I do not know before hand the dimension of the source array? For example: # slice is genereated dynamically, its length is not known before hand slice = [(2,4),(1,4),(0,15)] # then I'd like to somehow use slice to slice an array a[slice] -> a[2:4,1:4,0:15] Thank you From zunbeltz at lcdx00.wm.lc.ehu.es Thu Jun 10 02:18:19 2004 From: zunbeltz at lcdx00.wm.lc.ehu.es (Zunbeltz) Date: Thu, 10 Jun 2004 08:18:19 +0200 (CEST) Subject: [SciPy-user] "dynamic" indexing In-Reply-To: <200406091527.32432.jaddison@systems.textron.com> References: <200406091527.32432.jaddison@systems.textron.com> Message-ID: <20040610081031.N94417@lcdx00.wm.lc.ehu.es> On Wed, 9 Jun 2004, Addison, Jason wrote: > How can I take a slice from an array when I do not know before hand the > dimension of the source array? For example: > len(slice) gives you the length of the array, so you don't need to know the length before hand. You also can slice with negative indexes, for example to get the last element a[-1] and so on. see http://docs.python.org/lib/typesseq.html on the python library reference. Arrays all call list in python and the are mutable sequences. > # slice is genereated dynamically, its length is not known before hand > slice = [(2,4),(1,4),(0,15)] > # then I'd like to somehow use slice to slice an array > a[slice] -> a[2:4,1:4,0:15] > You can't use a construct like a[2:4,1:4,0:15]. Zunbeltz > Thank you > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user > -- Zunbeltz Izaola Azkona (zunbeltz at wm dot lc dot ehu dot es) Materia Kondentsatuaren Fisika Saila | Zientzia eta Teknologia Fakultatea | Telf: 34 946015326 Euskal Herriko Unibertsitatea | PK 644 | Fax: 34 944648500 48080 Bilbo (SPAIN) | -- From gerard.vermeulen at grenoble.cnrs.fr Thu Jun 10 03:48:58 2004 From: gerard.vermeulen at grenoble.cnrs.fr (Gerard Vermeulen) Date: Thu, 10 Jun 2004 09:48:58 +0200 Subject: [SciPy-user] "dynamic" indexing In-Reply-To: <200406091527.32432.jaddison@systems.textron.com> References: <200406091527.32432.jaddison@systems.textron.com> Message-ID: <20040610094858.3e1877ba.gerard.vermeulen@grenoble.cnrs.fr> On Wed, 9 Jun 2004 15:27:32 -1000 "Addison, Jason" wrote: > How can I take a slice from an array when I do not know before hand the > dimension of the source array? For example: > > # slice is genereated dynamically, its length is not known before hand > slice = [(2,4),(1,4),(0,15)] > # then I'd like to somehow use slice to slice an array > a[slice] -> a[2:4,1:4,0:15] > Python-2.3 allows you to do packer at zombie:~> python Python 2.3+ (#1, Jan 7 2004, 09:17:35) [GCC 3.3.1 (SuSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from scipy import * >>> a = arange(35) >>> a.shape = (7, 5) >>> a array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24], [25, 26, 27, 28, 29], [30, 31, 32, 33, 34]]) >>> s0 = slice(0, 8, 2) >>> s1 = slice(0, 6, 2) >>> a[s0, s1] array([[ 0, 2, 4], [10, 12, 14], [20, 22, 24], [30, 32, 34]]) >>> See http://docs.python.org/whatsnew/section-slices.html Gerard From jcollins_boulder at earthlink.net Fri Jun 11 10:22:50 2004 From: jcollins_boulder at earthlink.net (Jeffery D. Collins) Date: Fri, 11 Jun 2004 08:22:50 -0600 Subject: [SciPy-user] byteswapping IO problem Message-ID: <40C9C03A.8010902@earthlink.net> Hello, I am having a problem getting scipy.io.fopen to properly read a big endian complex array (typecode='F') on a little endian machine. When the bs=1 switch is enabled in the fread method, the entire complex number is swapped (real and imaginary parts reversed). Here is an example: On the Sun (big endian), create and store: [ 0. +5.j, 1. +6.j, 2. +7.j, 3. +8.j, 4. +9.j, 5.+10.j, 6.+11.j, 7.+12.j, 8.+13.j, 9.+14.j,] On Linux (little endian), perform a byteswapped read: fh = io.fopen('jnk.iq','rb') fh.read(10,'F', bs=1) [ 5.+0.j, 6.+1.j, 7.+2.j, 8.+3.j, 9.+4.j, 10.+5.j, 11.+6.j, 12.+7.j, 13.+8.j, 14.+9.j,] The entire complex number gets swapped, not just the individual floating point components. Read again using fromstring: fh = file('jnk.iq','rb') s = fh.read() fromstring(s, typecode='F', count=10).byteswapped() [ 0. +5.j, 1. +6.j, 2. +7.j, 3. +8.j, 4. +9.j, 5.+10.j, 6.+11.j, 7.+12.j, 8.+13.j, 9.+14.j,] After a quick look at the code, it would seem that changes would be needed in numpyio_fromfile with respect to its call to rbo(), the byteswapping routine, to treat complex numbers differently. Something like this seems to work: if (dobyteswap) { if (read_type == 68 || read_type == 70) /* complex typecodes: F or D */ rbo(ibuff,myelsize/2,nread*2); else rbo(ibuff,myelsize,nread); } A similar treatment is necessary for writing byteswapped files. If this approach seems reasonable, let me know and I'll submit a patch. Thanks! -- Jeff From elcortostrash at gmx.net Sun Jun 13 15:17:29 2004 From: elcortostrash at gmx.net (el corto) Date: Sun, 13 Jun 2004 21:17:29 +0200 (MEST) Subject: [SciPy-user] bug in optimize.lbfgsb Message-ID: <19006.1087154249@www11.gmx.net> Hi I'm running scipy 0.3.0_266.4242 on Win32, Python 2.3.4. I think I found a bug in scipy.optimize.lbfgsb (in fmin_l_bfgs_b()). I hope this is the right place to post this. With the call fit = fmin_l_bfgs_b(n,initial_guess,args=(t,y),...) I get this error ============================================================================ Traceback (most recent call last): File "", line 1, in ? File "findMin.py", line 66, in findMin fit = fmin_l_bfgs_b(n,initial_guess,args=(t,y),approx_grad=True, bounds=rewriteLimits(limits),m=20,maxfun=15000) File "C:\Programme\Python23\lib\site-packages\scipy\optimize\lbfgsb.py", line 179, in fmin_l_bfgs_b f[0], g = func_and_grad(x, *args) TypeError: func_and_grad() takes exactly 1 argument (3 given) ============================================================================ In lbfgsb.py 'func_and_grad()' is defined as follows. if approx_grad: def func_and_grad(x): f = func(x, *args) g = approx_fprime(x, func, epsilon, *args) return f, g elif fprime is None: def func_and_grad(x): f, g = func(x, *args) return f, g else: def func_and_grad(x): f = func(x, *args) g = fprime(x, *args) return f, g 'func_and_grad()' is defined to take exactly one argument but the definition should read ... def func_and_grad(x, *args): ... I changed it and it works :) bye. -- "People will accept your ideas much more readily if you tell them that Benjamin Franklin said it first." "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! Jetzt aktivieren unter http://www.gmx.net/info From olivier.ravard at novagrid.com Tue Jun 15 10:57:49 2004 From: olivier.ravard at novagrid.com (Olivier Ravard) Date: Tue, 15 Jun 2004 16:57:49 +0200 Subject: [SciPy-user] bug crash Message-ID: <003301c452e9$20056aa0$3d521481@ravard> Hi, I used scipy under windows, and this simple code crashes python with no error message : from scipy import * b=arange(1000000).astype('f') b=b*1j but this one works : from scipy import * b=arange(100000).astype('f') b=b*1j Looks like a memory problem... Anyone have an idea ? Thanks. O.R. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pearu at scipy.org Tue Jun 15 12:46:25 2004 From: pearu at scipy.org (Pearu Peterson) Date: Tue, 15 Jun 2004 11:46:25 -0500 (CDT) Subject: [SciPy-user] bug crash In-Reply-To: <003301c452e9$20056aa0$3d521481@ravard> References: <003301c452e9$20056aa0$3d521481@ravard> Message-ID: On Tue, 15 Jun 2004, Olivier Ravard wrote: > Hi, > > I used scipy under windows, and this simple code crashes python > with no error message : > > from scipy import * > b=arange(1000000).astype('f') > b=b*1j > > but this one works : > > from scipy import * > b=arange(100000).astype('f') > b=b*1j > > Looks like a memory problem... Indeed.. > Anyone have an idea ? Try installing more memory to your machine. On a machine with 1GB physical RAM I have: In [1]: from scipy import * In [2]: b=arange(1000000).astype('f') In [3]: b=b*1j In [4]: b=arange(10000000).astype('f') In [5]: b=b*1j In [6]: b=arange(100000000).astype('f') In [7]: b=b*1j Segmentation fault Regards, Pearu From bhoel at web.de Tue Jun 15 13:22:03 2004 From: bhoel at web.de (Berthold Höllmann) Date: Tue, 15 Jun 2004 19:22:03 +0200 Subject: [SciPy-user] Re: bug crash References: <003301c452e9$20056aa0$3d521481@ravard> Message-ID: Pearu Peterson writes: > On Tue, 15 Jun 2004, Olivier Ravard wrote: > >> Hi, >> >> I used scipy under windows, and this simple code crashes python >> with no error message : >> >> from scipy import * >> b=arange(1000000).astype('f') >> b=b*1j >> >> but this one works : >> >> from scipy import * >> b=arange(100000).astype('f') >> b=b*1j >> >> Looks like a memory problem... > > Indeed.. > >> Anyone have an idea ? > > Try installing more memory to your machine. On a machine with 1GB physical > RAM I have: > > In [1]: from scipy import * > > In [2]: b=arange(1000000).astype('f') > > In [3]: b=b*1j > > In [4]: b=arange(10000000).astype('f') > > In [5]: b=b*1j > > In [6]: b=arange(100000000).astype('f') > > In [7]: b=b*1j > Segmentation fault Hello, My machine has only 512MB RAM, but I get: >python Python 2.3.4 (#2, May 28 2004, 22:06:09) [GCC 3.3.1 (SuSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from scipy import * >>> b=arange(1000000).astype('f') >>> b=b*1j >>> b=arange(10000000).astype('f') >>> b=b*1j >>> >free -m total used free shared buffers cached Mem: 502 177 325 0 16 34 -/+ buffers/cache: 126 375 Swap: 2445 223 2222 OK, it's Linux Kind Regards Berthold -- bhoel at web.de / http://starship.python.net/crew/bhoel/ From olivier.ravard at novagrid.com Wed Jun 16 04:04:19 2004 From: olivier.ravard at novagrid.com (Olivier Ravard) Date: Wed, 16 Jun 2004 10:04:19 +0200 Subject: [SciPy-user] Re: bug crash References: <003301c452e9$20056aa0$3d521481@ravard> Message-ID: <008301c45378$e9fd77a0$3d521481@ravard> ----- Original Message ----- From: "Berthold H?llmann" To: Sent: Tuesday, June 15, 2004 7:22 PM Subject: [SciPy-user] Re: bug crash > Pearu Peterson writes: > > > On Tue, 15 Jun 2004, Olivier Ravard wrote: > > > >> Hi, > >> > >> I used scipy under windows, and this simple code crashes python > >> with no error message : > >> > >> from scipy import * > >> b=arange(1000000).astype('f') > >> b=b*1j > >> > >> but this one works : > >> > >> from scipy import * > >> b=arange(100000).astype('f') > >> b=b*1j > >> > >> Looks like a memory problem... > > > > Indeed.. > > > >> Anyone have an idea ? > > > > Try installing more memory to your machine. On a machine with 1GB physical > > RAM I have: > > I have 512Mo RAM and I think that this is enough to reach an 1 million elements vector... > > In [1]: from scipy import * > > > > In [2]: b=arange(1000000).astype('f') > > > > In [3]: b=b*1j > > > > In [4]: b=arange(10000000).astype('f') > > > > In [5]: b=b*1j > > > > In [6]: b=arange(100000000).astype('f') > > > > In [7]: b=b*1j > > Segmentation fault > > Hello, > > My machine has only 512MB RAM, but I get: > > >python > Python 2.3.4 (#2, May 28 2004, 22:06:09) > [GCC 3.3.1 (SuSE Linux)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from scipy import * > >>> b=arange(1000000).astype('f') > >>> b=b*1j > >>> b=arange(10000000).astype('f') > >>> b=b*1j > >>> > >free -m > total used free shared buffers cached > Mem: 502 177 325 0 16 34 > -/+ buffers/cache: 126 375 > Swap: 2445 223 2222 > > OK, it's Linux Yes, I work a lot with linux and very big vectors do not make any crash !!! I think this problem is really a scipy problem because if we use Numeric, then it works... even with ten millions element vector... from Numeric import * b=arange(10000000).astype('f') b=b*1j works. > > Kind Regards > Berthold > -- > bhoel at web.de / http://starship.python.net/crew/bhoel/ > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user From olivier.ravard at novagrid.com Wed Jun 16 04:04:19 2004 From: olivier.ravard at novagrid.com (Olivier Ravard) Date: Wed, 16 Jun 2004 10:04:19 +0200 Subject: [SciPy-user] Re: bug crash References: <003301c452e9$20056aa0$3d521481@ravard> Message-ID: <008301c45378$e9fd77a0$3d521481@ravard> ----- Original Message ----- From: "Berthold H?llmann" To: Sent: Tuesday, June 15, 2004 7:22 PM Subject: [SciPy-user] Re: bug crash > Pearu Peterson writes: > > > On Tue, 15 Jun 2004, Olivier Ravard wrote: > > > >> Hi, > >> > >> I used scipy under windows, and this simple code crashes python > >> with no error message : > >> > >> from scipy import * > >> b=arange(1000000).astype('f') > >> b=b*1j > >> > >> but this one works : > >> > >> from scipy import * > >> b=arange(100000).astype('f') > >> b=b*1j > >> > >> Looks like a memory problem... > > > > Indeed.. > > > >> Anyone have an idea ? > > > > Try installing more memory to your machine. On a machine with 1GB physical > > RAM I have: > > I have 512Mo RAM and I think that this is enough to reach an 1 million elements vector... > > In [1]: from scipy import * > > > > In [2]: b=arange(1000000).astype('f') > > > > In [3]: b=b*1j > > > > In [4]: b=arange(10000000).astype('f') > > > > In [5]: b=b*1j > > > > In [6]: b=arange(100000000).astype('f') > > > > In [7]: b=b*1j > > Segmentation fault > > Hello, > > My machine has only 512MB RAM, but I get: > > >python > Python 2.3.4 (#2, May 28 2004, 22:06:09) > [GCC 3.3.1 (SuSE Linux)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> from scipy import * > >>> b=arange(1000000).astype('f') > >>> b=b*1j > >>> b=arange(10000000).astype('f') > >>> b=b*1j > >>> > >free -m > total used free shared buffers cached > Mem: 502 177 325 0 16 34 > -/+ buffers/cache: 126 375 > Swap: 2445 223 2222 > > OK, it's Linux Yes, I work a lot with linux and very big vectors do not make any crash !!! I think this problem is really a scipy problem because if we use Numeric, then it works... even with ten millions element vector... from Numeric import * b=arange(10000000).astype('f') b=b*1j works. > > Kind Regards > Berthold > -- > bhoel at web.de / http://starship.python.net/crew/bhoel/ > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user From eric at enthought.com Wed Jun 16 14:57:03 2004 From: eric at enthought.com (eric jones) Date: Wed, 16 Jun 2004 13:57:03 -0500 Subject: [SciPy-user] bug crash In-Reply-To: References: <003301c452e9$20056aa0$3d521481@ravard> Message-ID: <40D097FF.1030207@enthought.com> Pearu Peterson wrote: >On Tue, 15 Jun 2004, Olivier Ravard wrote: > > > >>Hi, >> >>I used scipy under windows, and this simple code crashes python >>with no error message : >> >>from scipy import * >>b=arange(1000000).astype('f') >>b=b*1j >> >>but this one works : >> >>from scipy import * >>b=arange(100000).astype('f') >>b=b*1j >> >>Looks like a memory problem... >> >> > >Indeed.. > > > >>Anyone have an idea ? >> >> > >Try installing more memory to your machine. On a machine with 1GB physical >RAM I have: > >In [1]: from scipy import * > >In [2]: b=arange(1000000).astype('f') > >In [3]: b=b*1j > >In [4]: b=arange(10000000).astype('f') > >In [5]: b=b*1j > >In [6]: b=arange(100000000).astype('f') > >In [7]: b=b*1j >Segmentation fault > > > It would be nice if the failure wasn't so violent... eric >Regards, >Pearu > >_______________________________________________ >SciPy-user mailing list >SciPy-user at scipy.net >http://www.scipy.net/mailman/listinfo/scipy-user > > From cookedm at physics.mcmaster.ca Wed Jun 16 15:25:56 2004 From: cookedm at physics.mcmaster.ca (David M. Cooke) Date: Wed, 16 Jun 2004 15:25:56 -0400 Subject: [SciPy-user] bug crash In-Reply-To: <40D097FF.1030207@enthought.com> References: <003301c452e9$20056aa0$3d521481@ravard> <40D097FF.1030207@enthought.com> Message-ID: <200406161525.57319.cookedm@physics.mcmaster.ca> On June 16, 2004 02:57 pm, eric jones wrote: > Pearu Peterson wrote: > >In [1]: from scipy import * > >In [6]: b=arange(100000000).astype('f') > > > >In [7]: b=b*1j > >Segmentation fault > > It would be nice if the failure wasn't so violent... > > eric Yet another reason to switch to numarray... >>> import numarray >>> b = numarray.arange(100000000, type=numarray.Float64) >>> b = b*1j Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py", line 723, in __mul__ return ufunc.multiply(self, operand) File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 877, in _cache_miss2 mode, win1, win2, wout, cfunc, ufargs = \ File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 913, in _setup if out is None: wout = in1.new(outtype[0]) File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py", line 643, in new return self.__class__(shape=self._shape, type=type) MemoryError >>> And by the way, arange(1000000).astype('f') is a bad idea: it allocates an array of integers, then makes a new array of floats. You should use arange(1000000, typecode=Float), which allocates one array of Floats. -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm at physics.mcmaster.ca From pearu at scipy.org Thu Jun 17 06:40:57 2004 From: pearu at scipy.org (Pearu Peterson) Date: Thu, 17 Jun 2004 05:40:57 -0500 (CDT) Subject: [SciPy-user] bug crash In-Reply-To: <200406161525.57319.cookedm@physics.mcmaster.ca> References: <003301c452e9$20056aa0$3d521481@ravard> <200406161525.57319.cookedm@physics.mcmaster.ca> Message-ID: > On June 16, 2004 02:57 pm, eric jones wrote: > > Pearu Peterson wrote: > > >In [1]: from scipy import * > > >In [6]: b=arange(100000000).astype('f') > > > > > >In [7]: b=b*1j > > >Segmentation fault > > > > It would be nice if the failure wasn't so violent... That seems to be Numeric issue rather than of scipy: In [2]: from Numeric import * In [3]: b=arange(100000000).astype('f') In [4]: b=b*1j Segmentation fault libwadpy gives the following traceback: SegFault: [ C stack trace ] #8 0x0805a2ba in PyNumber_Multiply() #7 0x0805bbbe in ?() #6 0x4049d9a0 in ?() #5 0x404a25ff in PyUFunc_GenericFunction() #4 0x404a223e in setup_loop() #3 0x404a1fa8 in setup_matrices() #2 0x4049804a in PyArray_FromObject() #1 0x40497f0f in array_fromobject() #0 0x40497c3c in PyArray_Cast() However the following works ok: In [1]: from Numeric import * In [2]: b=arange(100000000).astype('D') In [3]: b=b*1j --------------------------------------------------------------------------- MemoryError Traceback (most recent call last) /home/pearu/ MemoryError: can't allocate memory for array On Wed, 16 Jun 2004, David M. Cooke wrote: > Yet another reason to switch to numarray... > > >>> import numarray > >>> b = numarray.arange(100000000, type=numarray.Float64) > >>> b = b*1j .. > MemoryError > >>> That's not completely fair, also Numeric handles the above example well: In [1]: from scipy import * In [2]: b=arange(100000000,typecode='f') In [3]: b=b*1j --------------------------------------------------------------------------- MemoryError Traceback (most recent call last) /home/pearu/ MemoryError: can't allocate memory for array though I like numarray in respect that MemoryError is raised immidiately while with Numeric `b=b*1j` the MemoryError is raised after few minutes of computations. Pearu From elcorto at gmx.net Fri Jun 18 05:19:57 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Fri, 18 Jun 2004 11:19:57 +0200 (MEST) Subject: [SciPy-user] plt problems Message-ID: <29109.1087550397@www37.gmx.net> Hi I'm using scipy 0.3.0_266.4242, Python 2.3.4, PythonWin. The call import gui_thread gui_thread.start() from scipy.plt import * x=arange(0,5,.1) y=sin(x) plot(x,y) caues this error. ============================================================================ File "C:\PROGRA~1\Python23\Lib\site-packages\scipy\plt\wxplt.py", line 143, in on_paint self.draw(wx.wxPaintDC(self)) File "C:\PROGRA~1\Python23\Lib\site-packages\scipy\plt\wxplt.py", line 424, in draw self.draw_graph_area(dc) File "C:\PROGRA~1\Python23\Lib\site-packages\scipy\plt\wxplt.py", line 379, in draw_graph_area int(gb.width()+2),int(gb.height()+2)) File "C:\PROGRA~1\Python23\Lib\site-packages\wx\gdi.py", line 2597, in SetClippingRegion return _gdi.DC_SetClippingRegion(*args, **kwargs) TypeError: DC_SetClippingRegion() takes exactly 3 arguments (5 given) ============================================================================ It would be nice if someone had an idea what I can do about this. Thanks in advance. bye. -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! Jetzt aktivieren unter http://www.gmx.net/info From ltauxe at ucsd.edu Mon Jun 21 15:10:27 2004 From: ltauxe at ucsd.edu (Lisa Tauxe) Date: Mon, 21 Jun 2004 12:10:27 -0700 Subject: [SciPy-user] scipy on Mac OSX Message-ID: I've been trying for a week now to compile scipy on a Panther machine. I have faithfully followed Chris Fonnesbeck's procedure but the scipy compilation chokes near the end every time. The final messages are: collect2: ld returned 1 exit status /usr/bin/ld: Undefined symbols: _PyArg_ParseTuple _PyArg_ParseTupleAndKeywords _PyCObject_AsVoidPtr _PyCObject_Type _PyComplex_Type _PyDict_GetItemString _PyDict_SetItemString _PyErr_Clear and a bunch more, then restFP saveFP collect2: ld returned 1 exit status error: Command "/usr/local/bin/g77 -lcc_dynamic -bundle build/temp.darwin-7.4.0-Power_Macintosh-2.3/build/src/Lib/fftpack/ _fftpackmodule.o build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/zfft.o build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/drfft.o build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/zrfft.o build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/zfftnd.o build/temp.darwin-7.4.0-Power_Macintosh-2.3/build/src/fortranobject.o -L/usr/local/lib -L/usr/local/lib/gcc/powerpc-apple-darwin7.2.0/3.4.0 -Lbuild/temp.darwin-7.4.0-Power_Macintosh-2.3 -ldfftpack -lrfftw -lfftw -lg2c -o build/lib.darwin-7.4.0-Power_Macintosh-2.3/scipy/fftpack/_fftpack.so" failed with exit status 1 Any ideas? Lisa Tauxe Scripps Institution of Oceanography La Jolla, CA 92093-0220 tel: (858) 534-6084 fax: (858) 534-0784 http://magician.ucsd.edu/~ltauxe/ ltauxe at ucsd.edu NOTE: Fedex or other courier deliveries address: 300C Ritter Hall 8635 Discovery Way La Jolla, CA 92037 From bob at redivi.com Mon Jun 21 18:24:07 2004 From: bob at redivi.com (Bob Ippolito) Date: Mon, 21 Jun 2004 18:24:07 -0400 Subject: [SciPy-user] scipy on Mac OSX In-Reply-To: References: Message-ID: On Jun 21, 2004, at 3:10 PM, Lisa Tauxe wrote: > I've been trying for a week now to compile scipy on a Panther machine. > I have faithfully followed Chris Fonnesbeck's procedure but the scipy > compilation chokes near the end every time. The final messages are: > > collect2: ld returned 1 exit status > /usr/bin/ld: Undefined symbols: > _PyArg_ParseTuple > _PyArg_ParseTupleAndKeywords > _PyCObject_AsVoidPtr > _PyCObject_Type > _PyComplex_Type > _PyDict_GetItemString > _PyDict_SetItemString > _PyErr_Clear > and a bunch more, then > > restFP > saveFP > collect2: ld returned 1 exit status > error: Command "/usr/local/bin/g77 -lcc_dynamic -bundle > build/temp.darwin-7.4.0-Power_Macintosh-2.3/build/src/Lib/fftpack/ > _fftpackmodule.o > build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/zfft.o > build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/drfft.o > build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/zrfft.o > build/temp.darwin-7.4.0-Power_Macintosh-2.3/Lib/fftpack/src/zfftnd.o > build/temp.darwin-7.4.0-Power_Macintosh-2.3/build/src/fortranobject.o > -L/usr/local/lib -L/usr/local/lib/gcc/powerpc-apple-darwin7.2.0/3.4.0 > -Lbuild/temp.darwin-7.4.0-Power_Macintosh-2.3 -ldfftpack -lrfftw > -lfftw -lg2c -o > build/lib.darwin-7.4.0-Power_Macintosh-2.3/scipy/fftpack/_fftpack.so" > failed with exit status 1 > > Any ideas? I don't know anything about g77, but if it's like gcc/g++ you'll either need to use -undefined dynamic_lookup with the env var MACOSX_DEPLOYMENT_TARGET set to 10.3 (resulting binary will be compatible with 10.3 or later with any Python 2.3), or you will need to add -framework Python to that command line (extension will be compatible with Python 2.3 installed in a specific location, doesn't use any 10.3 specific features). That won't fix restFP and saveFP, but it will fix all of the missing Python symbols. -bob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2357 bytes Desc: not available URL: From danny_shevitz at yahoo.com Wed Jun 23 13:59:00 2004 From: danny_shevitz at yahoo.com (danny shevitz) Date: Wed, 23 Jun 2004 10:59:00 -0700 (PDT) Subject: [SciPy-user] bug and fix in Scipy.Scientific.Statistics.Histogram Message-ID: <20040623175900.44338.qmail@web41010.mail.yahoo.com> I found a bug in the histogram code written by Konrad Hinsen . The existing version of the code is Scipy.Scientific.Statistics.Histogram line 74: histo = N.add.reduce(N.equal(N.arange(nbins)[:,N.NewAxis], data), -1) The correct code should be: histo = N.add.reduce(N.equal(N.arange(nbins)[:,N.NewAxis], data).astype(N.Int), -1) The difference is the .astype(N.Int) after the N.equal block. The bug manifests itself whenever bin counts get above 256, the counts cycle back to 0. Logicals in Numeric are short ints and the above change turns them back into regular ints. Allegedly counting on logicals as 0's or 1's is fraught with peril, and this code runs afoul of it. Danny __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From sseefeld at art.ca Wed Jun 23 16:47:38 2004 From: sseefeld at art.ca (Stefan Seefeld) Date: Wed, 23 Jun 2004 16:47:38 -0400 Subject: [SciPy-user] Re: plt problems Message-ID: <20DCDD8F0FCED411AC4D001083CF504501AA96BD@MTL-EXCHANGE> Hi Steve, I'v seen the same problem. In my case I believe the problem is due to the fact that I was using wxPython 2.5.x which contains some API changes that make it incompatible with scipy 0.3's plt wrapper. If you are using wxPython 2.5.x, too, you may consider downgrading to 2.4 as that fixed the problem for me. It seems wxPython is following the convention of using impaired version numbers to signify developmental versions, and thus the scipy developers may decide to switch from wxpython 2.4 to 2.6 (once that is out), i.e. 2.5 will never be supported. Regards, Stefan From sseefeld at art.ca Wed Jun 23 17:15:44 2004 From: sseefeld at art.ca (Stefan Seefeld) Date: Wed, 23 Jun 2004 17:15:44 -0400 Subject: [SciPy-user] plotting modules Message-ID: <20DCDD8F0FCED411AC4D001083CF504501AA96BE@MTL-EXCHANGE> hi there, the scipy documents presently mention three distinct plotting modules (gplt, plt, and xplt), and I'm wondering which one fits my needs best. I'm trying to rewrite some code that has previously been written for matlab, so what I'd like to be able to do is the following: * draw 2D and 3D plots/meshes/etc. * keep multiple figures open simultaneously and interact with all of them * simple user interaction, such as zoom, rotation, querying for coordinates (mouse-to-image mapped), overlay of graphics (for example points, lines, polygons interactively drawn with the mouse on top of a mesh or image) Is any of this already possible in one of the plotting modules ? If not, is this being worked on ? What are the long-term plans for scipy ? What should I be looking into if I wanted to contribute ? plt (wxpython) looks like the most advanced contender among the three, but I also read about vtk as a future candidate for a drawing/plotting module. Thanks for any tips, Stefan From elcorto at gmx.net Thu Jun 24 12:53:36 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Thu, 24 Jun 2004 18:53:36 +0200 (MEST) Subject: [SciPy-user] Re: plt problems References: <20DCDD8F0FCED411AC4D001083CF504501AA96BD@MTL-EXCHANGE> Message-ID: <28154.1088096016@www49.gmx.net> > Hi Steve, > > I'v seen the same problem. In my case I believe > the problem is due to the fact that I was using wxPython 2.5.x > which contains some API changes that make it incompatible with > scipy 0.3's plt wrapper. If you are using wxPython 2.5.x, too, > you may consider downgrading to 2.4 as that fixed the problem > for me. Thanx. This works :) > > It seems wxPython is following the convention of using impaired > version numbers to signify developmental versions, and thus > the scipy developers may decide to switch from wxpython 2.4 > to 2.6 (once that is out), i.e. 2.5 will never be supported. -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- +++ Jetzt WLAN-Router f?r alle DSL-Einsteiger und Wechsler +++ GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl From elcorto at gmx.net Thu Jun 24 13:32:28 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Thu, 24 Jun 2004 19:32:28 +0200 (MEST) Subject: [SciPy-user] plotting modules References: <20DCDD8F0FCED411AC4D001083CF504501AA96BE@MTL-EXCHANGE> Message-ID: <11011.1088098348@www49.gmx.net> > hi there, > > the scipy documents presently mention three distinct > plotting modules (gplt, plt, and xplt), and I'm wondering > which one fits my needs best. I'm trying to rewrite some > code that has previously been written for matlab, so what > I'd like to be able to do is the following: > > * draw 2D and 3D plots/meshes/etc. > * keep multiple figures open simultaneously and interact > with all of them > * simple user interaction, such as zoom, rotation, querying > for coordinates (mouse-to-image mapped), overlay of graphics > (for example points, lines, polygons interactively drawn > with the mouse on top of a mesh or image) > > Is any of this already possible in one of the plotting modules ? > If not, is this being worked on ? What are the long-term > plans for scipy ? What should I be looking into if I wanted > to contribute ? plt (wxpython) looks like the most advanced > contender among the three, but I also read about vtk as a future > candidate for a drawing/plotting module. > > Thanks for any tips, > Stefan > Hi here are some of my scipy-plotting-experiences .... xplt ==== I've been using xplt for a while now. It's good for a short look at your data etc. It's pretty fast. There is a mouse-click-zoom function, but this one is a bit unhandy (compared to Matlab or plt). 3D-plotting is not supported (or only _without_ a coord-sys, but I'm not sure). You can find a manual at http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/pygist.html xplt can export .eps with the eps(.. filemame ..) function wich is very helpful for LaTeX-users. plt === I'll start playing around with it now that it works :) with scipy 0.3x and wxPython 2.4.2.4 . As you probably have experienced yourself plt has the most Matlab-like syntax and output. The mouse-click-zoom function is much better then xplt's. No 3D plots as far as I know. No .eps-export :( (at least I haven't found a function for doing this; if anyone can give me a hint ...) gplt ==== I've played arourd with gplt a bit. If you come from Matlab the syntax may be a little strange (or not if you are familiar with gnuplot). For example plot(x,y,'w lp') gives lines with points but the title of the graph is a pathname. plot(x,y,'title "" w lp') removes the annoying title, hmmm. The plots look fine, similar to plt. There are some 3D capabilities as it is a wrapper for gnuplot (as you probably have read on the scipy-page). On my machine it is the most slow plotting package (on Win32, it calls wgnuplot). I havn't tested it on Linux jet. I think I exported an .eps with the export(...) function, but it's been a while. others ====== You may have a look at http://www.physik.tu-dresden.de/~baecker/python/plot.html where you can find further links to other plotting packages. Have fun :) bye -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- +++ Jetzt WLAN-Router f?r alle DSL-Einsteiger und Wechsler +++ GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl From arnd.baecker at web.de Fri Jun 25 03:23:13 2004 From: arnd.baecker at web.de (Arnd Baecker) Date: Fri, 25 Jun 2004 09:23:13 +0200 (CEST) Subject: [SciPy-user] plotting modules In-Reply-To: <11011.1088098348@www49.gmx.net> References: <20DCDD8F0FCED411AC4D001083CF504501AA96BE@MTL-EXCHANGE> <11011.1088098348@www49.gmx.net> Message-ID: Moin, On Thu, 24 Jun 2004, Steve Schmerler wrote: > > hi there, > > > > the scipy documents presently mention three distinct > > plotting modules (gplt, plt, and xplt), and I'm wondering > > which one fits my needs best. I'm trying to rewrite some > > code that has previously been written for matlab, [... snip - list of requirements and Steve's discussion of xplt and plt] > gplt > ==== > > I've played arourd with gplt a bit. If you come from Matlab the syntax may > be a little strange (or not if you are familiar with gnuplot). For example > > plot(x,y,'w lp') > > gives lines with points but the title of the graph is a pathname. > > plot(x,y,'title "" w lp') > > removes the annoying title, hmmm. The plots look fine, similar to plt. There > are some 3D capabilities as it is a wrapper for gnuplot (as you probably > have read on the scipy-page). On my machine it is the most slow plotting > package (on Win32, it calls wgnuplot). I havn't tested it on Linux jet. > I think I exported an .eps with the export(...) function, but it's been a > while. An alternative interface to gnuplot is http://sourceforge.net/projects/gnuplot-py/ together with Fernando Perez' Ipython (highly recommended independent of this) which has some add--ons to Gnuplot.py (see "Access to gnuplot") http://ipython.scipy.org/doc/manual/node12.html Coming from matlab you should definitively have a look at matplotlib http://matplotlib.sourceforge.net/ A general remark: I am not sure about the feasability of one plotting tool for all tasks. For _my_ purposes it boils down to the following - quick plots, interactive usage: gnuplot or scipy.xplt - publication quality 2D graphs: gnuplot or PyX (http://pyx.sourceforge.net/) - 3D interactive plots: gnuplot, geomview (http://www.geomview.org/) or MayaVi (http://mayavi.sourceforge.net/) - 3D publication quality plots This is more tricky (IMHO): Possible toolchains: - geomview, RIB output and rendering - MayaVI, RIB output and rendering (.ps output etc. of course also exists) - gnuplot + postprocessing of the resulting big .ps files - Embedded plots in GUIs (wxPython, to be honest here): - fast plotting of many points: PlottingCanvas - or FloatCanvas/wxPyPlot - or matplolib (not tested though) Best, Arnd From sseefeld at art.ca Fri Jun 25 09:40:59 2004 From: sseefeld at art.ca (Stefan Seefeld) Date: Fri, 25 Jun 2004 09:40:59 -0400 Subject: [SciPy-user] plotting modules Message-ID: <20DCDD8F0FCED411AC4D001083CF504501AA96BF@MTL-EXCHANGE> Hi Steve, Arnd, thanks for the tips ! I'v had a look into yet another plotting package which looks quite terrific: (py)qwt. I'll play with some of them to see whether they fit my needs. Thanks again, Stefan From reg3777 at yahoo.com Sat Jun 26 17:24:50 2004 From: reg3777 at yahoo.com (Reggie Smith) Date: Sat, 26 Jun 2004 14:24:50 -0700 (PDT) Subject: [SciPy-user] Genetic algorithm segment fault Message-ID: <20040626212450.23047.qmail@web40810.mail.yahoo.com> Hello everyone. I have a quick question. I'm using the genetic algorithm module in Scipy 0.3 with Numeric 23.3 and Python 2.3.4 on a Windows 2000 machine. The GA works fine until it finishes processing the first generation and tn it crashes due to this line in ga.py: Line 236 return self.allele_set.index(self.value()). I was wondering if anyone knows what would cause this. Is it a Win32 type issue or is something wrong in my ga or fitness functions? Reggie __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From cfuller at thinkingplanet.net Sun Jun 27 01:42:18 2004 From: cfuller at thinkingplanet.net (cfuller at thinkingplanet.net) Date: Sun, 27 Jun 2004 00:42:18 -0500 (CDT) Subject: [SciPy-user] (no subject) Message-ID: <20040627054218.32199B22B@lynx.thinkingplanet.net> I had a problem installing scipy, but I figured it out. I saw on the list archives that other folks were having this problem also, so here is my solution. From cfuller at thinkingplanet.net Sun Jun 27 01:48:01 2004 From: cfuller at thinkingplanet.net (cfuller at thinkingplanet.net) Date: Sun, 27 Jun 2004 00:48:01 -0500 (CDT) Subject: [SciPy-user] (no subject) Message-ID: <20040627054801.2581FB22B@lynx.thinkingplanet.net> So much for my good first impression! I had a problem installing scipy, but I figured it out. I saw on the list archives that other folks were having this problem also, so here is my solution. The problem: after installing wxPython wxPython-2.5.1.5 and scipy 0.3.0, the basic plot tutorial fails, with the exception TypeError: DC_SetClippingRegion() takes exactly 3 arguments (5 given) I checked the wx docs, and changed the dc.SetClippingRegion calls to dc.SetClippingRegionXY. Only two files had these calls: plt/wxplt.py and plt/plot_objects.py This might do the job for some folks, but it raised hell for me. GTK spit out a load of errors and python dumped core. So, I thought I'd try the GTK2 rpm. wx didn't work at all. Turns out there's a little incompatability between redhat 9, for which the rpms were built, and fc2, which I'm using. Since I was rebuilding, I decided I'd rebuild the GTK rpm first, and try that one. It worked. You could always do GTK2, if that's what you prefer. You need to have gtk+-devel and glib-devel installed, and maybe some others, but after I got those in, it was cake. Find something to read, or maybe you have a mail server to set up, like me, but you are in for a wait. It's not as bad as KDE or X windows, but its a long compile! This command will do all the work. Pretty slick! rpmbuild --rebuild srcpkg You will need to do this as root, change the perms on /usr/src/redhat, or (the best solution) edit ~/.rpmmacros to tell rpmbuild to use something in your home directory: %_topdir /home/cfuller/rpm %_tmppath /home/cfuller/rpm/tmp I'm sure the folks with a nonrpm distribution can figure out how to adapt this to their needs. If you can't, don't ask me, I don't use them much, except knoppix :) From martin.wiechert at gmx.de Mon Jun 28 08:55:50 2004 From: martin.wiechert at gmx.de (Martin Wiechert) Date: Mon, 28 Jun 2004 14:55:50 +0200 Subject: [SciPy-user] IRIX problems Message-ID: <200406281455.50955.martin.wiechert@gmx.de> Hi all, I'm trying to install scipy on our dunno-how-old IRIX server. I've used a lib called complib.sgimath instead of atlas/LAPACK ... Now I get the following error: import lapack_lite ImportError: 563534:python2.3: rld: Fatal Error: unresolvable symbol in /user/wiechert/lib/python2.3/site-packages/Numeric/lapack_lite.so: zgelsd_ lapack_lite is linked against following libs: ldd lapack_lite.so libcomplib.sgimath.so => /usr/lib32/libcomplib.sgimath.so libblas.so => /usr/lib32/libblas.so libftn.so => /usr/lib32/libftn.so libm.so => /usr/lib32/libm.so libc.so.1 => /usr/lib32/libc.so.1 What can I do? Thanks, Martin. From pearu at scipy.org Mon Jun 28 11:39:56 2004 From: pearu at scipy.org (Pearu Peterson) Date: Mon, 28 Jun 2004 10:39:56 -0500 (CDT) Subject: [SciPy-user] IRIX problems In-Reply-To: <200406281455.50955.martin.wiechert@gmx.de> References: <200406281455.50955.martin.wiechert@gmx.de> Message-ID: On Mon, 28 Jun 2004, Martin Wiechert wrote: > Hi all, > > I'm trying to install scipy on our dunno-how-old IRIX server. > I've used a lib called complib.sgimath instead of atlas/LAPACK ... > Now I get the following error: > > import lapack_lite > ImportError: 563534:python2.3: rld: Fatal Error: unresolvable symbol > in /user/wiechert/lib/python2.3/site-packages/Numeric/lapack_lite.so: zgelsd_ (This is a Numeric installation problem, not scipy.) > lapack_lite is linked against following libs: > ldd lapack_lite.so > libcomplib.sgimath.so => /usr/lib32/libcomplib.sgimath.so > libblas.so => /usr/lib32/libblas.so > libftn.so => /usr/lib32/libftn.so > libm.so => /usr/lib32/libm.so > libc.so.1 => /usr/lib32/libc.so.1 > > What can I do? Try to find out which libraries in your system contain zgelsd_ and use it when linking lapack_lite. When that's unsuccessful then I suggest building LAPACK libraries yourself, see the relevant section in http://www.scipy.org/documentation/buildatlas4scipy.txt HTH, Pearu From martin.wiechert at gmx.de Mon Jun 28 13:22:23 2004 From: martin.wiechert at gmx.de (Martin Wiechert) Date: Mon, 28 Jun 2004 19:22:23 +0200 Subject: [SciPy-user] IRIX problems In-Reply-To: References: <200406281455.50955.martin.wiechert@gmx.de> Message-ID: <200406281922.23886.martin.wiechert@gmx.de> Hi Pearu, thanks for your help. The solution is to replace libcomplib.sgimath with the newer libscs, which has the missing symbol. Our sysadmin pointed me to that. Martin. On Monday 28 June 2004 17:39, Pearu Peterson wrote: > On Mon, 28 Jun 2004, Martin Wiechert wrote: > > Hi all, > > > > I'm trying to install scipy on our dunno-how-old IRIX server. > > I've used a lib called complib.sgimath instead of atlas/LAPACK ... > > Now I get the following error: > > > > import lapack_lite > > ImportError: 563534:python2.3: rld: Fatal Error: unresolvable symbol > > in /user/wiechert/lib/python2.3/site-packages/Numeric/lapack_lite.so: > > zgelsd_ > > (This is a Numeric installation problem, not scipy.) > > > lapack_lite is linked against following libs: > > ldd lapack_lite.so > > libcomplib.sgimath.so => /usr/lib32/libcomplib.sgimath.so > > libblas.so => /usr/lib32/libblas.so > > libftn.so => /usr/lib32/libftn.so > > libm.so => /usr/lib32/libm.so > > libc.so.1 => /usr/lib32/libc.so.1 > > > > What can I do? > > Try to find out which libraries in your system contain zgelsd_ and use it > when linking lapack_lite. When that's unsuccessful then I suggest building > LAPACK libraries yourself, see the relevant section in > > http://www.scipy.org/documentation/buildatlas4scipy.txt > > HTH, > Pearu > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user From jrennie at csail.mit.edu Mon Jun 28 13:47:45 2004 From: jrennie at csail.mit.edu (Jason Rennie) Date: Mon, 28 Jun 2004 13:47:45 -0400 Subject: [SciPy-user] error: build/src/atlas321/fblas.pyf: No such file or directory Message-ID: <20040628174745.GJ16011@csail.mit.edu> I sent this earlier as a non-member. I've since joined and don't see my message in the archives, so I'm posting it again. Sorry if this yields duplicate messages. I'm trying to install SciPy from source. I'm using Debian Sarge. I've installed all of the 'PREREQUISITES', i.e. these Debian packages: python python-dev python-numeric python-numeric-ext atlas2-headers atlas2-sse2 atlas2-sse2-dev gcc g++ g77 I've also installed: Scipy_core-0.3.0_108.1820 F2PY-2.39.235_1693 Python seems to have the zlib module enabled: jrennie at orava:~$ python Python 2.3.4 (#2, May 29 2004, 03:31:27) [GCC 3.3.3 (Debian 20040417)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import zlib >>> Here's the error I'm getting. When I run 'python setup.py build', I get: -----8<----- ... generating fblas interface 20 error: build/src/atlas321/fblas.pyf: No such file or directory jrennie at orava:/tmp/SciPy_complete-0.3$ ----->8----- Any help is appreciated. I've included lots of diagnostic information below and attached. Thanks, Jason -----8<----- >>> from f2py2e.diagnose import run;run() ------ os.name='posix' ------ sys.platform='linux2' ------ sys.version: 2.3.4 (#2, May 29 2004, 03:31:27) [GCC 3.3.3 (Debian 20040417)] ------ sys.prefix: /usr ------ sys.path=':/afs/csail.mit.edu/u/j/jrennie:/afs/csail/u/j/jrennie/usr/lib/python2.3/site-packages:/afs/csail/u/j/jrennie/usr/linux/lib/python2.3/site-packages:/usr/lib/python23.zip:/usr/lib/python2.3:/usr/lib/python2.3/plat-linux2:/usr/lib/python2.3/lib-tk:/usr/lib/python2.3/lib-dynload:/usr/local/lib/python2.3/site-packages:/usr/lib/python2.3/site-packages:/usr/lib/python2.3/site-packages/Numeric' ------ Failed to import numarray: No module named numarray Found Numeric version '23.1' in /usr/lib/python2.3/site-packages/Numeric/Numeric.pyc Found f2py2e version '2.39.235_1693' in /afs/csail/u/j/jrennie/usr/lib/python2.3/site-packages/f2py2e/f2py2e.pyc Found scipy_distutils version '0.3.0_27.455' in '/afs/csail/u/j/jrennie/usr/linux/lib/python2.3/site-packages/scipy_distutils/__init__.pyc' ------ Importing scipy_distutils.command.build_flib ... error: No module named build_flib ------ Checking availability of supported Fortran compilers: error: local variable 'build_flib' referenced before assignment ------ Importing scipy_distutils.fcompiler ... ok ------ Checking availability of supported Fortran compilers: customize CompaqFCompiler customize AbsoftFCompiler Could not locate executable ifort Could not locate executable ifc Could not locate executable efort Could not locate executable efc Could not locate executable ifort customize IntelFCompiler customize GnuFCompiler customize SunFCompiler customize VastFCompiler customize IbmFCompiler customize LaheyFCompiler customize IntelVisualFCompiler customize IntelItaniumFCompiler customize PGroupFCompiler customize CompaqVisualFCompiler customize MipsFCompiler customize HPUXFCompiler customize IntelItaniumVisualFCompiler customize NAGFCompiler List of available Fortran compilers: --fcompiler=gnu GNU Fortran Compiler (3.3.3) List of unavailable Fortran compilers: --fcompiler=absoft Absoft Corp Fortran Compiler --fcompiler=compaq Compaq Fortran Compiler --fcompiler=compaqv DIGITAL|Compaq Visual Fortran Compiler --fcompiler=hpux HP Fortran 90 Compiler --fcompiler=ibm IBM XL Fortran Compiler --fcompiler=intel Intel Fortran Compiler for 32-bit apps --fcompiler=intele Intel Fortran Compiler for Itanium apps --fcompiler=intelev Intel Visual Fortran Compiler for Itanium apps --fcompiler=intelv Intel Visual Fortran Compiler for 32-bit apps --fcompiler=lahey Lahey/Fujitsu Fortran 95 Compiler --fcompiler=mips MIPSpro Fortran Compiler --fcompiler=nag NAGWare Fortran 95 Compiler --fcompiler=pg Portland Group Fortran Compiler --fcompiler=sun Sun|Forte Fortran 95 Compiler --fcompiler=vast Pacific-Sierra Research Fortran 90 Compiler List of unimplemented Fortran compilers: --fcompiler=f Fortran Company/NAG F Compiler For compiler details, run 'config_fc --verbose' setup command. ------ Importing scipy_distutils.command.cpuinfo ... error: No module named cpuinfo Importing scipy_distutils.cpuinfo ... ok ------ CPU information: getNCPUs has_mmx has_sse has_sse2 is_Intel ------ >>> jrennie at orava:~$ uname -a Linux orava.csail.mit.edu 2.4.26-1-686-smp #1 SMP Sat May 1 19:17:11 EST 2004 i686 GNU/Linux jrennie at orava:~$ gcc -v Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux Thread model: posix gcc version 3.3.3 (Debian 20040422) jrennie at orava:~$ g77 --version GNU Fortran (GCC) 3.3.3 (Debian 20040422) Copyright (C) 2002 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING or type the command `info -f g77 Copying'. ----->8----- Output of 'python scipy_core/scipy_distutils/system_info.py' is attached. THe file 'scipy_core/scipy_distutils/command/build_flib.py' does not exist in the distribution. -------------- next part -------------- _pkg_config_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine None info. NOT AVAILABLE agg2_info: ( src_dirs = .:/usr/local/src ) NOT AVAILABLE atlas_blas_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/libf77blas.so ) ( paths: /usr/lib/libcblas.so ) ( paths: /usr/lib/libatlas.so ) ( paths: /usr/lib/atlas ) system_info.atlas_blas_info ( include_dirs = /usr/local/include:/usr/include ) ( paths: /usr/include/atlas_misc.h,/usr/include/atlas_enum.h,/usr/include/atlas_aux.h,/usr/include/atlas_type.h ) ( paths: /usr/include/cblas.h ) FOUND: libraries = ['f77blas', 'cblas', 'atlas'] library_dirs = ['/usr/lib'] language = c include_dirs = ['/usr/include'] atlas_blas_threads_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/libatlas.so ) ( paths: /usr/lib/libatlas.a ) system_info.atlas_blas_threads_info NOT AVAILABLE atlas_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/libf77blas.so ) ( paths: /usr/lib/libcblas.so ) ( paths: /usr/lib/libatlas.so ) ( paths: /usr/lib/liblapack_atlas.so ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/atlas/liblapack.so ) system_info.atlas_info ( include_dirs = /usr/local/include:/usr/include ) ( paths: /usr/include/atlas_misc.h,/usr/include/atlas_enum.h,/usr/include/atlas_aux.h,/usr/include/atlas_type.h ) ( paths: /usr/include/cblas.h ) FOUND: libraries = ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs = ['/usr/lib/atlas', '/usr/lib'] language = f77 include_dirs = ['/usr/include'] atlas_threads_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/libatlas.so ) ( paths: /usr/lib/libatlas.a ) ( paths: /usr/lib/liblapack_atlas.so ) system_info.atlas_threads_info NOT AVAILABLE blas_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/libblas.so ) FOUND: libraries = ['blas'] library_dirs = ['/usr/lib'] language = f77 blas_opt_info: running build_src building extension "atlas_version" sources adding 'build/src/atlas_version_0x68649178.c' to sources. running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext FOUND: libraries = ['f77blas', 'cblas', 'atlas'] library_dirs = ['/usr/lib'] language = c define_macros = [('ATLAS_INFO', '"\\"3.2.1_pre3.3.6\\""')] include_dirs = ['/usr/include'] blas_src_info: ( src_dirs = .:/usr/local/src ) NOT AVAILABLE boost_python_info: ( src_dirs = .:/usr/local/src ) NOT AVAILABLE dfftw_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) NOT AVAILABLE dfftw_threads_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) NOT AVAILABLE djbfft_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) NOT AVAILABLE fftw_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) ( paths: /usr/lib/librfftw.so ) ( paths: /usr/lib/libfftw.so ) ( paths: /usr/include/fftw.h,/usr/include/rfftw.h ) FOUND: libraries = ['rfftw', 'fftw'] library_dirs = ['/usr/lib'] define_macros = [('SCIPY_FFTW_H', None)] include_dirs = ['/usr/include'] fftw_threads_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) ( paths: /usr/lib/librfftw_threads.so ) ( paths: /usr/lib/libfftw_threads.so ) ( paths: /usr/include/fftw_threads.h,/usr/include/rfftw_threads.h ) FOUND: libraries = ['rfftw_threads', 'fftw_threads'] library_dirs = ['/usr/lib'] define_macros = [('SCIPY_FFTW_THREADS_H', None)] include_dirs = ['/usr/include'] freetype2_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine freetype2 info. NOT AVAILABLE gdk_pixbuf_2_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine gdk_pixbuf_2 info. NOT AVAILABLE gdk_pixbuf_xlib_2_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine gdk_pixbuf_xlib_2 info. NOT AVAILABLE gdk_x11_2_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine gdk_x11_2 info. NOT AVAILABLE gtkp_2_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine gtkp_2 info. NOT AVAILABLE gtkp_x11_2_info: Could not locate executable pkg-config /tmp/SciPy_complete-0.3/scipy_core/scipy_distutils/system_info.py:808: FutureWarning: hex()/oct() of negative int will return a signed string in Python 2.4 and up magic = hex(hash(`config`)) File not found: pkg-config. Cannot determine gtkp_x11_2 info. NOT AVAILABLE lapack_atlas_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/liblapack_atlas.so ) ( paths: /usr/lib/libf77blas.so ) ( paths: /usr/lib/libcblas.so ) ( paths: /usr/lib/libatlas.so ) ( paths: /usr/lib/liblapack_atlas.so ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/atlas/liblapack.so ) system_info.lapack_atlas_info ( include_dirs = /usr/local/include:/usr/include ) ( paths: /usr/include/atlas_misc.h,/usr/include/atlas_enum.h,/usr/include/atlas_aux.h,/usr/include/atlas_type.h ) ( paths: /usr/include/cblas.h ) FOUND: libraries = ['lapack', 'lapack_atlas', 'f77blas', 'cblas', 'atlas'] library_dirs = ['/usr/lib/atlas', '/usr/lib'] language = f77 include_dirs = ['/usr/include'] lapack_atlas_threads_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/atlas ) ( paths: /usr/lib/liblapack_atlas.so ) ( paths: /usr/lib/libatlas.so ) ( paths: /usr/lib/liblapack_atlas.a ) ( paths: /usr/lib/libatlas.a ) ( paths: /usr/lib/liblapack_atlas.so ) system_info.lapack_atlas_threads_info NOT AVAILABLE lapack_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( paths: /usr/lib/liblapack.so ) FOUND: libraries = ['lapack'] library_dirs = ['/usr/lib'] language = f77 lapack_opt_info: running build_src building extension "atlas_version" sources adding 'build/src/atlas_version_0xce783626.c' to sources. running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext customize GnuFCompiler customize GnuFCompiler customize GnuFCompiler using build_ext FOUND: libraries = ['lapack', 'f77blas', 'cblas', 'atlas'] library_dirs = ['/usr/lib/atlas', '/usr/lib'] language = f77 define_macros = [('ATLAS_INFO', '"\\"3.2.1_pre3.3.6\\""')] include_dirs = ['/usr/include'] lapack_src_info: ( src_dirs = .:/usr/local/src ) NOT AVAILABLE numarray_info: NOT AVAILABLE numpy_info: ( include_dirs = /usr/include/python2.3 ) ( paths: /usr/include/python2.3/Numeric/arrayobject.h ) FOUND: define_macros = [('NUMERIC_VERSION', '"\\"23.1\\""')] include_dirs = ['/usr/include/python2.3'] sfftw_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) NOT AVAILABLE sfftw_threads_info: ( library_dirs = /usr/local/lib:/usr/lib ) ( include_dirs = /usr/local/include:/usr/include ) NOT AVAILABLE wx_info: Could not locate executable wx-config File not found: wx-config. Cannot determine wx info. NOT AVAILABLE x11_info: ( library_dirs = /usr/X11R6/lib:/usr/lib ) ( include_dirs = /usr/X11R6/include:/usr/include ) NOT AVAILABLE xft_info: Could not locate executable pkg-config File not found: pkg-config. Cannot determine xft info. NOT AVAILABLE From pearu at scipy.org Mon Jun 28 16:15:59 2004 From: pearu at scipy.org (Pearu Peterson) Date: Mon, 28 Jun 2004 15:15:59 -0500 (CDT) Subject: [SciPy-user] error: build/src/atlas321/fblas.pyf: No such file or directory In-Reply-To: <20040628174745.GJ16011@csail.mit.edu> References: <20040628174745.GJ16011@csail.mit.edu> Message-ID: On Mon, 28 Jun 2004, Jason Rennie wrote: > I'm trying to install SciPy from source. I'm using Debian Sarge. > I've installed all of the 'PREREQUISITES', i.e. these Debian packages: Sorry, INSTALL.txt is a bit out-of-date. Use http://www.scipy.org/documentation/buildscipy.txt instead. > > python python-dev > python-numeric python-numeric-ext > atlas2-headers atlas2-sse2 atlas2-sse2-dev > gcc g++ g77 > > I've also installed: > > Scipy_core-0.3.0_108.1820 > F2PY-2.39.235_1693 > Here's the error I'm getting. When I run 'python setup.py build', I get: > > -----8<----- > ... > generating fblas interface > 20 > error: build/src/atlas321/fblas.pyf: No such file or directory > jrennie at orava:/tmp/SciPy_complete-0.3$ > ----->8----- > > Any help is appreciated. I've included lots of diagnostic information > below and attached. I suggest using atlas 3.6.0 instead of 3.2.1. I.e. install atlas3-headers atlas3-sse2 atlas3-sse2-dev I am not sure whether uninstalling atlas2 would be required. If that does not help then use CVS version of scipy and scipy_distutils. HTH, Pearu From elcorto at gmx.net Mon Jun 28 18:47:15 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Tue, 29 Jun 2004 00:47:15 +0200 (MEST) Subject: [SciPy-user] random number References: Message-ID: <17219.1088462835@www24.gmx.net> Hi I'm looking for a random number generator wich generates (uniformly distributed) rn's from 0 to 1e200. scipy.stats.rand.uniform(0,1e38)[0] gives a rn, but scipy.stats.rand.uniform(0,1e38)[0] gives 1.#INF !? Any hint is much appreciated. Thanx! bye -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! Jetzt aktivieren unter http://www.gmx.net/info From JeanClaude.Razafindrakoto at axa-cessions.com Tue Jun 29 05:22:08 2004 From: JeanClaude.Razafindrakoto at axa-cessions.com (Razafindrakoto Jean Claude) Date: Tue, 29 Jun 2004 11:22:08 +0200 Subject: [SciPy-user] random number Message-ID: <7D225E91F9F3D211B31A0020352A8DA5030A89AC@srv_cessions_10.axa-cessions.intraxa> Don't see the point !! Tried the code below, don't get errors !! ______________________________________________________________ AXA CESSIONS Jean-Claude RAZAFINDRAKOTO Re-ARMS Reinsurance - Actuarial and Risk Management Services 109 rue La Bo?tie 75008 Paris Tel. : +33 1 56 43 78 54 Fax. : +33 1 56 43 78 70 E-mail : jeanclaude.razafindrakoto at axa-cessions.com _______________________________________________________________ |-----Message d'origine----- |De?: Steve Schmerler [mailto:elcorto at gmx.net] |Envoy??: mardi 29 juin 2004 00:47 |??: SciPy Users List |Objet?: [SciPy-user] random number | |Hi | |I'm looking for a random number generator wich generates (uniformly |distributed) rn's from 0 to 1e200. | | scipy.stats.rand.uniform(0,1e38)[0] | |gives a rn, but | | scipy.stats.rand.uniform(0,1e38)[0] | |gives | | 1.#INF | |!? | |Any hint is much appreciated. Thanx! | |bye | | | |-- |"Documentation is like sex: when it's good, |it is very, very good; and when it's bad, it |is better than nothing." -- Dick Brandon |-- | |"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! |Jetzt aktivieren unter http://www.gmx.net/info | |_______________________________________________ |SciPy-user mailing list |SciPy-user at scipy.net |http://www.scipy.net/mailman/listinfo/scipy-user From elcorto at gmx.net Tue Jun 29 05:50:24 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Tue, 29 Jun 2004 11:50:24 +0200 (MEST) Subject: [SciPy-user] random number References: <7D225E91F9F3D211B31A0020352A8DA5030A89AC@srv_cessions_10.axa-cessions.intraxa> Message-ID: <11200.1088502624@www51.gmx.net> > Don't see the point !! > Tried the code below, don't get errors !! > Code below ? What I ment: from scipy.stats.rand import * uniform(0,1e38)[0] gives a float rn (e.g. 5.9437827355745297e+037) but uniform(0,1e38)[0] gives 1.#INF (on win32, PythonWin, Python 2.3.4, scipy 0.3x). It seems that 'uniform' can't handle maximum values beyond 1e38. > > > > ______________________________________________________________ > AXA CESSIONS > > Jean-Claude RAZAFINDRAKOTO > > Re-ARMS > Reinsurance - Actuarial and Risk Management Services > > 109 rue La Bo?tie > 75008 Paris > > Tel. : +33 1 56 43 78 54 > Fax. : +33 1 56 43 78 70 > E-mail : jeanclaude.razafindrakoto at axa-cessions.com > _______________________________________________________________ > > |-----Message d'origine----- > |De : Steve Schmerler [mailto:elcorto at gmx.net] > |Envoy? : mardi 29 juin 2004 00:47 > |? : SciPy Users List > |Objet : [SciPy-user] random number > | > |Hi > | > |I'm looking for a random number generator wich generates (uniformly > |distributed) rn's from 0 to 1e200. > | > | scipy.stats.rand.uniform(0,1e38)[0] > | > |gives a rn, but > | > | scipy.stats.rand.uniform(0,1e38)[0] > | > |gives > | > | 1.#INF > | > |!? > | > |Any hint is much appreciated. Thanx! > | > |bye > | -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- +++ Jetzt WLAN-Router f?r alle DSL-Einsteiger und Wechsler +++ GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl From JeanClaude.Razafindrakoto at axa-cessions.com Tue Jun 29 06:10:21 2004 From: JeanClaude.Razafindrakoto at axa-cessions.com (Razafindrakoto Jean Claude) Date: Tue, 29 Jun 2004 12:10:21 +0200 Subject: [SciPy-user] random number Message-ID: <7D225E91F9F3D211B31A0020352A8DA5030A89AD@srv_cessions_10.axa-cessions.intraxa> When running the example, I didn't get any errors. I'm running Pythonwin with Python 2.3.2 and scipy 0.3 >>> from scipy.stats.rand import * >>> x=uniform(0,1e38)[0] >>> x 5.9481523519433107e+037 >>> uniform(0,1e38)[0] 7.5203911045864378e+037 >>> But if you change the seed, e.g >>> uniform(0,1e38)[1] Traceback (most recent call last): File "", line 1, in ? IndexError: index out of bounds ______________________________________________________________ AXA CESSIONS Jean-Claude RAZAFINDRAKOTO Re-ARMS Reinsurance - Actuarial and Risk Management Services 109 rue La Bo?tie 75008 Paris Tel. : +33 1 56 43 78 54 Fax. : +33 1 56 43 78 70 E-mail : jeanclaude.razafindrakoto at axa-cessions.com _______________________________________________________________ |-----Message d'origine----- |De?: Steve Schmerler [mailto:elcorto at gmx.net] |Envoy??: mardi 29 juin 2004 11:50 |??: SciPy Users List |Objet?: Re: RE : [SciPy-user] random number | |> Don't see the point !! |> Tried the code below, don't get errors !! |> | |Code below ? | |What I ment: | | from scipy.stats.rand import * | uniform(0,1e38)[0] | |gives a float rn (e.g. 5.9437827355745297e+037) but | | uniform(0,1e38)[0] | |gives | | 1.#INF | |(on win32, PythonWin, Python 2.3.4, scipy 0.3x). It seems that 'uniform' |can't handle maximum values beyond 1e38. | |> |> |> |> ______________________________________________________________ |> AXA CESSIONS |> |> Jean-Claude RAZAFINDRAKOTO |> |> Re-ARMS |> Reinsurance - Actuarial and Risk Management Services |> |> 109 rue La Bo?tie |> 75008 Paris |> |> Tel. : +33 1 56 43 78 54 |> Fax. : +33 1 56 43 78 70 |> E-mail : jeanclaude.razafindrakoto at axa-cessions.com |> _______________________________________________________________ |> |> |-----Message d'origine----- |> |De : Steve Schmerler [mailto:elcorto at gmx.net] |> |Envoy? : mardi 29 juin 2004 00:47 |> |? : SciPy Users List |> |Objet : [SciPy-user] random number |> | |> |Hi |> | |> |I'm looking for a random number generator wich generates (uniformly |> |distributed) rn's from 0 to 1e200. |> | |> | scipy.stats.rand.uniform(0,1e38)[0] |> | |> |gives a rn, but |> | |> | scipy.stats.rand.uniform(0,1e38)[0] |> | |> |gives |> | |> | 1.#INF |> | |> |!? |> | |> |Any hint is much appreciated. Thanx! |> | |> |bye |> | | |-- |"Documentation is like sex: when it's good, |it is very, very good; and when it's bad, it |is better than nothing." -- Dick Brandon |-- | |+++ Jetzt WLAN-Router f?r alle DSL-Einsteiger und Wechsler +++ |GMX DSL-Powertarife zudem 3 Monate gratis* http://www.gmx.net/dsl | |_______________________________________________ |SciPy-user mailing list |SciPy-user at scipy.net |http://www.scipy.net/mailman/listinfo/scipy-user From bpsu at james.hut.fi Tue Jun 29 08:00:49 2004 From: bpsu at james.hut.fi (Sudheer Phani) Date: Tue, 29 Jun 2004 15:00:49 +0300 Subject: [SciPy-user] function for sqrt of matrix Message-ID: Hello I am looking for a function to calculate the square root (sqrt) of matrix M. For e.g. x = sqrtm(M) such that M is square matrix and dot(x,x) = M. Thanks in advance regds Sudheer From elcorto at gmx.net Tue Jun 29 09:23:27 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Tue, 29 Jun 2004 15:23:27 +0200 (MEST) Subject: [SciPy-user] random number References: <7D225E91F9F3D211B31A0020352A8DA5030A89AD@srv_cessions_10.axa-cessions.intraxa> Message-ID: <20969.1088515407@www35.gmx.net> > When running the example, I didn't get any errors. I'm running Pythonwin > with Python 2.3.2 and scipy 0.3 > > >>> from scipy.stats.rand import * > >>> x=uniform(0,1e38)[0] > >>> x > 5.9481523519433107e+037 > >>> uniform(0,1e38)[0] > 7.5203911045864378e+037 > >>> sure, 1e38 works also on my machine >>> uniform(0,1e38)[0] 7.6608738834125681e+037 but 1e39 doesn't >>> uniform(0,1e39)[0] 1.#INF > > But if you change the seed, e.g > >>> uniform(0,1e38)[1] > Traceback (most recent call last): > File "", line 1, in ? > IndexError: index out of bounds This is seed changing? Since 'uniform' gives an array like this >>> uniform(0,1e38) array([ 5.15205248e+037]) the call >>> uniform(0,1e38)[1] is truly out of bound. bye -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! Jetzt aktivieren unter http://www.gmx.net/info From JeanClaude.Razafindrakoto at axa-cessions.com Tue Jun 29 09:40:10 2004 From: JeanClaude.Razafindrakoto at axa-cessions.com (Razafindrakoto Jean Claude) Date: Tue, 29 Jun 2004 15:40:10 +0200 Subject: [SciPy-user] random number Message-ID: <7D225E91F9F3D211B31A0020352A8DA5030A89AF@srv_cessions_10.axa-cessions.intraxa> You're right. Wasn't seed changing but truly out of bound call. Why do you need to generate uniform variate (0,1e38) ? Curious about applications ! JC. ______________________________________________________________ AXA CESSIONS Jean-Claude RAZAFINDRAKOTO Re-ARMS Reinsurance - Actuarial and Risk Management Services 109 rue La Bo?tie 75008 Paris Tel. : +33 1 56 43 78 54 Fax. : +33 1 56 43 78 70 E-mail : jeanclaude.razafindrakoto at axa-cessions.com _______________________________________________________________ |-----Message d'origine----- |De?: Steve Schmerler [mailto:elcorto at gmx.net] |Envoy??: mardi 29 juin 2004 15:23 |??: SciPy Users List |Objet?: Re: RE : RE : [SciPy-user] random number | |> When running the example, I didn't get any errors. I'm running Pythonwin |> with Python 2.3.2 and scipy 0.3 |> |> >>> from scipy.stats.rand import * |> >>> x=uniform(0,1e38)[0] |> >>> x |> 5.9481523519433107e+037 |> >>> uniform(0,1e38)[0] |> 7.5203911045864378e+037 |> >>> | |sure, 1e38 works also on my machine | | >>> uniform(0,1e38)[0] | 7.6608738834125681e+037 | |but 1e39 doesn't | | >>> uniform(0,1e39)[0] | 1.#INF | |> |> But if you change the seed, e.g |> >>> uniform(0,1e38)[1] |> Traceback (most recent call last): |> File "", line 1, in ? |> IndexError: index out of bounds | |This is seed changing? Since 'uniform' gives an array like this | | >>> uniform(0,1e38) | array([ 5.15205248e+037]) | |the call | | >>> uniform(0,1e38)[1] | |is truly out of bound. | |bye | |-- |"Documentation is like sex: when it's good, |it is very, very good; and when it's bad, it |is better than nothing." -- Dick Brandon |-- | |"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! |Jetzt aktivieren unter http://www.gmx.net/info | |_______________________________________________ |SciPy-user mailing list |SciPy-user at scipy.net |http://www.scipy.net/mailman/listinfo/scipy-user From elcorto at gmx.net Tue Jun 29 10:07:25 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Tue, 29 Jun 2004 16:07:25 +0200 (MEST) Subject: [SciPy-user] random number References: <7D225E91F9F3D211B31A0020352A8DA5030A89AF@srv_cessions_10.axa-cessions.intraxa> Message-ID: <21150.1088518045@www55.gmx.net> > You're right. Wasn't seed changing but truly out of bound call. > Why do you need to generate uniform variate (0,1e38) ? > Curious about applications ! > > JC. > I'm testing an evolution strategy (similar to a genetic algorithm) for parameter fitting. I need to construct parameter vectors p = [p[1], ..., p[n]] where each p[i] sould be a random number from 0 to 1e200. I found that the module 'random' works with the 1e39-thing. >>> from random import * >>> uniform(0,1e39) 2.3437216521520377e+038 >>> uniform(0,1e200) 2.7167859425411156e+199 But there is another downside here. >>> x=[uniform(0,1e200) for i in range(1000)] gives nearly 1000 rn's like 2.3107981948610023e+199 All rn's have an order of magnitude of 1e199, but I want also things like e.g. 1e23, 1e45, 1e2, .... Any idea how to do this??? (google should do it :) ) It seems as if 'uniform(min, max)' is implemented as random()*max where 'random()' is a random float out of [0,1). bye -- "Documentation is like sex: when it's good, it is very, very good; and when it's bad, it is better than nothing." -- Dick Brandon -- "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! Jetzt aktivieren unter http://www.gmx.net/info From oliphant at ee.byu.edu Tue Jun 29 13:03:50 2004 From: oliphant at ee.byu.edu (Travis E. Oliphant) Date: Tue, 29 Jun 2004 11:03:50 -0600 Subject: [SciPy-user] function for sqrt of matrix In-Reply-To: References: Message-ID: <40E1A0F6.3040606@ee.byu.edu> Sudheer Phani wrote: > Hello > > I am looking for a function to calculate the square root (sqrt) of > matrix M. For e.g. x = sqrtm(M) such that M is square matrix and dot(x,x) > = M. > In SciPy: It would be good to have a specific sqrtm function. But for now you can do: x = linalg.funm(M, sqrt) or def sqrtm(M): return linalg.funm(M,sqrt) x = sqrtm(M) -Travis O. From gpajer at rider.edu Tue Jun 29 13:05:25 2004 From: gpajer at rider.edu (Gary Pajer) Date: Tue, 29 Jun 2004 13:05:25 -0400 Subject: [SciPy-user] random number In-Reply-To: <21150.1088518045@www55.gmx.net> References: <7D225E91F9F3D211B31A0020352A8DA5030A89AF@srv_cessions_10.axa-cessions.intraxa> <21150.1088518045@www55.gmx.net> Message-ID: <40E1A155.6070003@rider.edu> Steve Schmerler wrote: >>You're right. Wasn't seed changing but truly out of bound call. >>Why do you need to generate uniform variate (0,1e38) ? >>Curious about applications ! >> >>JC. >> >> >> > >I'm testing an evolution strategy (similar to a genetic algorithm) for >parameter fitting. I need to construct parameter vectors > > p = [p[1], ..., p[n]] > >where each p[i] sould be a random number from 0 to 1e200. > >I found that the module 'random' works with the 1e39-thing. > > >>> from random import * > >>> uniform(0,1e39) > 2.3437216521520377e+038 > >>> uniform(0,1e200) > 2.7167859425411156e+199 > >But there is another downside here. > > >>> x=[uniform(0,1e200) for i in range(1000)] > >gives nearly 1000 rn's like > > 2.3107981948610023e+199 > >All rn's have an order of magnitude of 1e199, but I want also things like >e.g. > > 1e23, 1e45, 1e2, .... > >Any idea how to do this??? (google should do it :) ) > >It seems as if 'uniform(min, max)' is implemented as > > random()*max > >where 'random()' is a random float out of [0,1). > >bye > > > I was going to suggest random()*1e39, but it seems that that is not really what you want. A uniformly distributed collection of numbers between (0, 1e38) is going to have very few members between (0, 1e3). Or (0, 1e24). Or (0, 1e35). Only 1 in 10 will be in the range (0, 1e37). It sounds like you may be looking for logarithmically distributed numbers. How about 10**x where x is a random number in (0, 38). Caveat: I'm no expert in random numbers. I'm just following my nose, here. -gary From jrennie at csail.mit.edu Tue Jun 29 16:09:19 2004 From: jrennie at csail.mit.edu (Jason Rennie) Date: Tue, 29 Jun 2004 16:09:19 -0400 Subject: [SciPy-user] error: build/src/atlas321/fblas.pyf: No such file or directory In-Reply-To: References: <20040628174745.GJ16011@csail.mit.edu> Message-ID: <20040629200919.GD27104@csail.mit.edu> On Mon, Jun 28, 2004 at 03:15:59PM -0500, Pearu Peterson wrote: > Sorry, INSTALL.txt is a bit out-of-date. Use > > http://www.scipy.org/documentation/buildscipy.txt > > I suggest using atlas 3.6.0 instead of 3.2.1. I.e. install > > atlas3-headers atlas3-sse2 atlas3-sse2-dev It spens more time working building stuff before crapping out, but it still hits an error... Any chance there's a debian package available? I found Jose Fonseca's repository, but that version of scipy (0.2.1) doesn't include the lbgfsb code that I want to use. Thanks, Jason From elcorto at gmx.net Tue Jun 29 16:53:57 2004 From: elcorto at gmx.net (Steve Schmerler) Date: Tue, 29 Jun 2004 22:53:57 +0200 (MEST) Subject: [SciPy-user] random number References: <40E1A155.6070003@rider.edu> Message-ID: <6570.1088542437@www40.gmx.net> > Steve Schmerler wrote: > > >>You're right. Wasn't seed changing but truly out of bound call. > >>Why do you need to generate uniform variate (0,1e38) ? > >>Curious about applications ! > >> > >>JC. > >> > >> > >> > > > >I'm testing an evolution strategy (similar to a genetic algorithm) for > >parameter fitting. I need to construct parameter vectors > > > > p = [p[1], ..., p[n]] > > > >where each p[i] sould be a random number from 0 to 1e200. > > > >I found that the module 'random' works with the 1e39-thing. > > > > >>> from random import * > > >>> uniform(0,1e39) > > 2.3437216521520377e+038 > > >>> uniform(0,1e200) > > 2.7167859425411156e+199 > > > >But there is another downside here. > > > > >>> x=[uniform(0,1e200) for i in range(1000)] > > > >gives nearly 1000 rn's like > > > > 2.3107981948610023e+199 > > > >All rn's have an order of magnitude of 1e199, but I want also things like > >e.g. > > > > 1e23, 1e45, 1e2, .... > > > >Any idea how to do this??? (google should do it :) ) > > > >It seems as if 'uniform(min, max)' is implemented as > > > > random()*max > > > >where 'random()' is a random float out of [0,1). > > > >bye > > > > > > > I was going to suggest random()*1e39, but it seems that that is not > really what you want. Yes. The problem is that the minimal random numbers are mostly only 1e1 smaller (1e199) than the max value (1e200 in my case). > > A uniformly distributed collection of numbers between (0, 1e38) is going > to have very few members between (0, 1e3). Or (0, 1e24). Or (0, > 1e35). Only 1 in 10 will be in the range (0, 1e37). It sounds like > you may be looking for logarithmically distributed numbers. > > How about 10**x where x is a random number in (0, 38). > Yeah, I tried something similar: import random from Numeric import * def alloverRand(min, max): # e.g. max = x*10**y = exp(max_exponent) max_exponent = log(max) return exp(random.uniform(.1*max_exponent,max_exponent)) This gives log-like distribution. Though it's not uniformly I'll test if it works since it covers _all_ numbers from (nearly 0) to 'max'. > Caveat: I'm no expert in random numbers. I'm just following my nose, > here. me neither, so do I :) thanx! bye -- All those who believe in psychokinesis raise my hand. - Steven Wright -- "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen! Jetzt aktivieren unter http://www.gmx.net/info From rkern at ucsd.edu Tue Jun 29 17:34:32 2004 From: rkern at ucsd.edu (Robert Kern) Date: Tue, 29 Jun 2004 14:34:32 -0700 Subject: [SciPy-user] random number In-Reply-To: <6570.1088542437@www40.gmx.net> References: <40E1A155.6070003@rider.edu> <6570.1088542437@www40.gmx.net> Message-ID: <40E1E068.7070008@ucsd.edu> Steve Schmerler wrote: [snip] [Gary Pajer:] >>I was going to suggest random()*1e39, but it seems that that is not >>really what you want. > > > Yes. The problem is that the minimal random numbers are mostly only 1e1 > smaller (1e199) than the max value (1e200 in my case). In [9]: a = stats.uniform.rvs(0,1e200,size=1000) In [10]: min(a) Out[10]: 8.4753666305914514e+196 In [11]: max(a) Out[11]: 9.9870741367340092e+199 Works as expected for me. >>A uniformly distributed collection of numbers between (0, 1e38) is going >>to have very few members between (0, 1e3). Or (0, 1e24). Or (0, >>1e35). Only 1 in 10 will be in the range (0, 1e37). It sounds like >>you may be looking for logarithmically distributed numbers. >> >>How about 10**x where x is a random number in (0, 38). >> > > > Yeah, I tried something similar: > > import random > from Numeric import * > def alloverRand(min, max): > # e.g. max = x*10**y = exp(max_exponent) > max_exponent = log(max) > return exp(random.uniform(.1*max_exponent,max_exponent)) > > This gives log-like distribution. Though it's not uniformly I'll test if it > works since it covers _all_ numbers from (nearly 0) to 'max'. Getting pseudo-random numbers over such a large range leaves gaping holes no matter what you do. Double precision will only get you 1e16ish possible numbers. Uniform rvs just spreads out the holes mostly evenly across the whole range. The exponential distribution puts those holes mostly out near the large end. If you want the orders of magnitude to be distributed evenly, then that's what you'd use. If you want the values themselves to be distributed evenly, then you will have to live with the fact that, with a perfect RNG, the probabilities of generating small numbers like 1e23, 1e45, and 1e2 from a range of 1e200 in your lifetime are too small. With a finite precision PRNG, most orders of magnitude are impossible to achieve: In [19]: machar_double.epsilon * 1e200 Out[19]: 2.220446049250313e+184 The smallest exponent you can expect is 184. So I guess my question is, "Can you do anything to reduce the range to something reasonable?" -- Robert Kern rkern at ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter From horstess2001 at yahoo.de Wed Jun 30 14:41:53 2004 From: horstess2001 at yahoo.de (Horst Horstsen) Date: Wed, 30 Jun 2004 20:41:53 +0200 Subject: [SciPy-user] summation of array elements Message-ID: <5.1.0.14.0.20040630203204.00ba8588@rcs.urz.tu-dresden.de> Hi Scipy-Experts, I've got a question concerning the summation of elements in an array. The following small sample programm illustrates the problem: _________________________________ from scipy.xplt import * from RandomArray import * nx,ny=100,10 def gen_lattice(nx,ny,c): x=uniform(0.0,1.0,((nx,ny))) return (x References: <5.1.0.14.0.20040630203204.00ba8588@rcs.urz.tu-dresden.de> Message-ID: <40E30F40.6070501@ee.byu.edu> Horst Horstsen wrote: > Hi Scipy-Experts, > > I've got a question concerning the summation of elements in an array. > The following small sample programm illustrates the problem: > > _________________________________ > from scipy.xplt import * > from RandomArray import * > > nx,ny=100,10 > > def gen_lattice(nx,ny,c): > x=uniform(0.0,1.0,((nx,ny))) > return (x > c=1 > x=gen_lattice(nx,ny,c) > print sum(x) > print sum(ravel(x)) > ___________________________________ The problem is that you are using Numeric's sum instead of scipy's sum and the x > One would expect an output of ten 100s and a 1000 but instead of the > 1000 it prints 232. Does anybody have a idea whats wrong? > > To anticipate corresponding questions, normally I also want to vary c > between 0..1 ;-) > > Thank you for your help! > Ciao by Philipp > > > _______________________________________________ > SciPy-user mailing list > SciPy-user at scipy.net > http://www.scipy.net/mailman/listinfo/scipy-user From cookedm at physics.mcmaster.ca Wed Jun 30 16:37:49 2004 From: cookedm at physics.mcmaster.ca (David M. Cooke) Date: Wed, 30 Jun 2004 16:37:49 -0400 Subject: [SciPy-user] summation of array elements In-Reply-To: <40E30F40.6070501@ee.byu.edu> References: <5.1.0.14.0.20040630203204.00ba8588@rcs.urz.tu-dresden.de> <40E30F40.6070501@ee.byu.edu> Message-ID: <200406301637.49920.cookedm@physics.mcmaster.ca> On June 30, 2004 03:06 pm, Travis E. Oliphant wrote: > Horst Horstsen wrote: > > Hi Scipy-Experts, > > > > I've got a question concerning the summation of elements in an array. > > The following small sample programm illustrates the problem: > > > > _________________________________ > > from scipy.xplt import * > > from RandomArray import * > > > > nx,ny=100,10 > > > > def gen_lattice(nx,ny,c): > > x=uniform(0.0,1.0,((nx,ny))) > > return (x > > > c=1 > > x=gen_lattice(nx,ny,c) > > print sum(x) > > print sum(ravel(x)) > > ___________________________________ > > The problem is that you are using Numeric's sum instead of scipy's sum > and the x (Numeric's sum is just short for add.reduce). > > SciPy's sum check's this case. It's not a problem with Numeric; replacing 'from scipy.xplt import *' with 'from Numeric import *' gives the expected result (1000). The original code gives me the same result as the OP, 232. Using 'from scipy import *' instead also gives me 1000. So there's something funny about importing scipy.xplt. So, this works: import Numeric import RandomArray nx, ny = 300, 10 def gen_lattice(nx, ny, c): x = RandomArray.uniform(0.0, 1.0, ((nx, ny))) return (x < c) c = 1 x = gen_lattice(nx, ny, c) print x.typecode() print Numeric.sum(x) print Numeric.sum(Numeric.ravel(x)) Output: l [300 300 300 300 300 300 300 300 300 300] 3000 BUT! putting an 'import scipy' into there makes it not work: import Numeric import RandomArray import scipy #... same code (with no calls to any scipy code) Output: b [44 44 44 44 44 44 44 44 44 44] 184 So scipy is doing something screwy to Numeric....It looks like the fastumath module is not consistent with Numeric with respect to using a long for comparisions as opposed to the type (compare UBYTE_less in Numeric's umathmodule.c with that in scipy's fastumath_unsigned.inc, for instance). -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |cookedm at physics.mcmaster.ca From oliphant at ee.byu.edu Wed Jun 30 17:03:36 2004 From: oliphant at ee.byu.edu (Travis E. Oliphant) Date: Wed, 30 Jun 2004 15:03:36 -0600 Subject: [SciPy-user] summation of array elements In-Reply-To: <200406301637.49920.cookedm@physics.mcmaster.ca> References: <5.1.0.14.0.20040630203204.00ba8588@rcs.urz.tu-dresden.de> <40E30F40.6070501@ee.byu.edu> <200406301637.49920.cookedm@physics.mcmaster.ca> Message-ID: <40E32AA8.8030201@ee.byu.edu> David M. Cooke wrote: > > It's not a problem with Numeric; replacing 'from scipy.xplt import *' with > 'from Numeric import *' gives the expected result (1000). The original code > gives me the same result as the OP, 232. Using 'from scipy import *' instead > also gives me 1000. So there's something funny about importing scipy.xplt. > > So, this works: > > import Numeric > import RandomArray Yes, this works if you don't need to use SciPy. > > BUT! putting an 'import scipy' into there makes it not work: > > import Numeric > import RandomArray > import scipy As I said, you should not need to mix and match SciPy and Numeric. Replace all of your import Numeric code with import scipy and things should work fine. Yes, scipy does change a couple of things about Numeric (check out scipy.alter_numeric in the latest CVS for even more interesting changes --- like index arrays and coercion rule changes). For the most part these changes should not cause big issues, but this is an example of where you should use SciPy's sum instead of Numeric's sum. -Travis O. From aaron_lamont_w at yahoo.com Wed Jun 30 23:47:41 2004 From: aaron_lamont_w at yahoo.com (Aaron Williams) Date: Wed, 30 Jun 2004 20:47:41 -0700 (PDT) Subject: [SciPy-user] Help with FFT code Message-ID: <20040701034741.39160.qmail@web13807.mail.yahoo.com> Hi I am a new user of python and scipy. I am trying to write a code that Fast Fourier Transforms 2-D arrays saved as binary FORTRAN files. I would like for my code to also create an output file containing the certain statistics about the imported data set. First I am having a problem calling my program from the command line. When I run the code with Python shell IDLE nothing happens. Second I was wondering how to create an output file in my code. Here is an example of my code. ################################# # FFT converter #!/usr/bin/python from scipy import * io.array_import #open Fortran Binary array x = raw_input("enter in file path, i.e. 'path' else enter 'No'") if x == No: print "no data file enter end of program" else: fid=io.fopen(x,'r','n') z1=fid.fort_read(256,dtype='f') #data array is brought in as 1D array needs to be 2D zcl=reshape(z1,(256,256)) zcl2=fftpack.fft2(zcl) zcl3=fftpack.fftshift(zcl2) zcl4=zcl3*conjugate(zlc3) #power spectrum zcl5=zcl4.real #xplt.imagesc(zcl5) #xplt.imagesc(zcl) #Ask for the name of plot q=raw_input("Enter name of transformed File") xplt.imagesc(log(zcl5)) xplt.eps(q) s=raw_input("Enter Name of Original") xplt.imagesc(zcl) xplt.eps(s) ##################################### I have been able to enter the italicized parts into the command individually, but this not efficient for as many transforms I need to do. Cheers, --------------------------------- Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! -------------- next part -------------- An HTML attachment was scrubbed... URL: