Re: [Numpy-discussion] select part of array using two conditions

2006-10-11 Thread Nils Wagner
Mark Bakker wrote: Hello - I want to select part of an array using two conditions. I know how to do it with one condition (and it works great), but when I use two conditions I get an error message? This is probably easy, but I cannot figure it out. Thanks for any help, Mark a =

Re: [Numpy-discussion] ide for python/numpy/scipy/mpl, development ?

2006-10-11 Thread humufr
Le mardi 10 octobre 2006 16:30, Darren Dale a écrit : On Tuesday 10 October 2006 15:41, [EMAIL PROTECTED] wrote: I asked if that will be possible to use ipython instead of the python console in eric4 (I know that it's not possible with eric3) but it's seems that eric4 does have it's own

[Numpy-discussion] warning upon running numpy rc02 tests

2006-10-11 Thread O'Keefe, Michael
Just FYI, I got the following warning while running the unittests from RC02: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type copyright, credits or license() for more information.

[Numpy-discussion] naive RNG question

2006-10-11 Thread Alan G Isaac
Python's MT documentation exmphasize the period of the MT19937 algorithm but discusses not at all the seed size. The numpy documentation contains no commentary (I believe). Speaking from a position of utter RNG ignorance, seed size seems really important too: why is it not discussed? I noticed

Re: [Numpy-discussion] asmatrix and asarray exception

2006-10-11 Thread Keith Goodman
On 10/11/06, Keith Goodman [EMAIL PROTECTED] wrote: This works: M.asmatrix(['a', 'b', None]) matrix([[a, b, None]], dtype=object) But this doesn't: M.asmatrix(['a', 'b', None, 'c']) TypeError: expected a readable buffer object M.__version__ '1.0rc1' It also doesn't work for

Re: [Numpy-discussion] naive RNG question

2006-10-11 Thread Charles R Harris
On 10/11/06, Alan G Isaac [EMAIL PROTECTED] wrote: Python's MT documentation exmphasize the period of theMT19937 algorithm but discusses not at all the seed size.The numpy documentation contains no commentary (I believe).Speaking from a position of utter RNG ignorance, seed size seems really

Re: [Numpy-discussion] cannot import Numeric

2006-10-11 Thread Darren Dale
On Wednesday 11 October 2006 12:48, Carl Wenrich wrote: The installation of Numpy went well, and numeric.py is in the python site-packages/numpy/core directory. But when I run python, and enter import Numeric, it says no module named Numeric. Please advise. import numpy

Re: [Numpy-discussion] asmatrix and asarray exception

2006-10-11 Thread Charles R Harris
On 10/11/06, Keith Goodman [EMAIL PROTECTED] wrote: On 10/11/06, Keith Goodman [EMAIL PROTECTED] wrote: This works: M.asmatrix(['a', 'b', None]) matrix([[a, b, None]], dtype=object) But this doesn't: M.asmatrix(['a', 'b', None, 'c']) TypeError: expected a readable buffer objectAs a side

Re: [Numpy-discussion] cannot import Numeric

2006-10-11 Thread Carl Wenrich
thanks, but actually it's the other applications i want to use that have the 'import Numeric' line in them. i'm sure others have noted this before. what's the normal procedure?Darren Dale [EMAIL PROTECTED] wrote: On Wednesday 11 October 2006 12:48, Carl Wenrich wrote: The installation of Numpy

Re: [Numpy-discussion] cannot import Numeric

2006-10-11 Thread Travis Oliphant
Carl Wenrich wrote: thanks, but actually it's the other applications i want to use that have the 'import Numeric' line in them. i'm sure others have noted this before. what's the normal procedure? You must install Numeric if a package needs Numeric. As far as Python is concerned NumPy is

Re: [Numpy-discussion] cannot import Numeric

2006-10-11 Thread Carl Wenrich
thanks.Travis Oliphant [EMAIL PROTECTED] wrote: Carl Wenrich wrote: thanks, but actually it's the other applications i want to use that have the 'import Numeric' line in them. i'm sure others have noted this before. what's the normal procedure?You must install Numeric if a package needs Numeric.

Re: [Numpy-discussion] select part of array using two conditions

2006-10-11 Thread Bill Baxter
On 10/11/06, Nils Wagner [EMAIL PROTECTED] wrote: Mark Bakker wrote: Hello - I want to select part of an array using two conditions. I know how to do it with one condition (and it works great), but when I use two conditions I get an error message? This is probably easy, but I cannot

[Numpy-discussion] Things to address for Py3K

2006-10-11 Thread Travis Oliphant
Hi all, Py3K is undergoing active development. This gives us an opportunity to discuss more significant changes to the language that might improve the experience of NumPy users. We should form a list and start commenting on the py3k mailing lists about what changes would be most helpful

Re: [Numpy-discussion] Things to address for Py3K

2006-10-11 Thread Christopher Barker
Travis Oliphant wrote: A couple on my short list 1) Adding a *few* new infix operators. a) an extra multiplication operator to distinguish between element-by-element and dot b) extending 'and' and 'or' to allow element-by-element logical operations or adding and || 2)

Re: [Numpy-discussion] Things to address for Py3K

2006-10-11 Thread Travis Oliphant
Christopher Barker wrote: Travis Oliphant wrote: A couple on my short list 1) Adding a *few* new infix operators. a) an extra multiplication operator to distinguish between element-by-element and dot b) extending 'and' and 'or' to allow element-by-element logical operations or

Re: [Numpy-discussion] Things to address for Py3K

2006-10-11 Thread Charles R Harris
On 10/11/06, Travis Oliphant [EMAIL PROTECTED] wrote: Hi all,Py3K is undergoing active development.This gives us an opportunity todiscuss more significant changes to the language that might improve theexperience of NumPy users.We should form a list and start commenting on the py3k mailing lists

[Numpy-discussion] sheet wizard create truly

2006-10-11 Thread Our Partners
Here log in you are raquo Magazine Home Todays Compact din Rail.Just anything in several skins choose between own style Creating takes few seconds click get.Create truly unique layout Change every of image Template system Thread a count Total.Modules Devices Embedded Systems Displays

[Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread pearu
Hi, I have recieved the following note from a user: In SciPy 0.3.x the ufuncs were overloaded by more intelligent versions. A very attractive feature was that sqrt(-1) would yield 1j as in Matlab. Then you can program formulas directly (e.g., roots of a 2nd order polynomial) and the right

Re: [Numpy-discussion] round

2006-10-11 Thread Charles R Harris
On 10/11/06, Greg Willden [EMAIL PROTECTED] wrote: Hi All,I've read discussions in the archives about how round() rounds to even and how that is supposedly better.But what I haven't been able to find is What do I use if I want the regular old round that you learn in school? Perhaps you could

[Numpy-discussion] Library problem on installation

2006-10-11 Thread Michael Subotin
Hi, I know that it's a perennial topic on the list, but I haven't been able to find my answer in the archives. After running the installation on a RedHat Linux machine, I'm getting the import error: /usr/lib/libblas.so.3: undefined symbol: e_wsfe. Judging from earlier exchanges here, it seems

Re: [Numpy-discussion] round

2006-10-11 Thread Greg Willden
On 10/11/06, Charles R Harris [EMAIL PROTECTED] wrote: Perhaps you could explain *why* you want the schoolbook round? Given that floating point is inherently inaccurate you would have to expect to produce a lot of numbers exactly of the form x.5 *without errors*, which means you probably don't

Re: [Numpy-discussion] round

2006-10-11 Thread Bill Baxter
Hmm. I learned round to even in school... But another formula that should get you what you want is: floor(x + 0.5).astype(int) --bb On 10/12/06, Greg Willden [EMAIL PROTECTED] wrote: Hi All, I've read discussions in the archives about how round() rounds to even and how that is supposedly

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Travis Oliphant
[EMAIL PROTECTED] wrote: Hi, I have recieved the following note from a user: In SciPy 0.3.x the ufuncs were overloaded by more intelligent versions. A very attractive feature was that sqrt(-1) would yield 1j as in Matlab. Then you can program formulas directly (e.g., roots of a 2nd order

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Sven Schreiber
Travis Oliphant schrieb: If not, shouldn't numpy.sqrt(-1) raise a ValueError instead of returning silently nan? This is user adjustable. You change the error mode to raise on 'invalid' instead of pass silently which is now the default. -Travis Could you please explain how

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Travis Oliphant
Sven Schreiber wrote: This is user adjustable. You change the error mode to raise on 'invalid' instead of pass silently which is now the default. -Travis Could you please explain how this adjustment is done, or point to the relevant documentation. numpy.sqrt(-1) old =

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Fernando Perez
On 10/11/06, Travis Oliphant [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Could sqrt(-1) made to return 1j again? Not in NumPy. But, in scipy it could. Without taking sides on which way to go, I'd like to -1 the idea of a difference in behavior between numpy and scipy. IMHO, scipy

Re: [Numpy-discussion] Things to address for Py3K

2006-10-11 Thread A. M. Archibald
On 11/10/06, Charles R Harris [EMAIL PROTECTED] wrote: Speaking long term, what about data types? The basic 80 bit extended precision float now occurs in 80, 96, and 128 bit versions depending on alignment. So what happens when quad precision, which will probably be in the next IEEE standard,

Re: [Numpy-discussion] Things to address for Py3K

2006-10-11 Thread Christopher Barker
A. M. Archibald wrote: IEEE floats in python proper +1 -CHB -- Christopher Barker, Ph.D. Oceanographer NOAA/ORR/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Tim Hochberg
Travis Oliphant wrote: Sven Schreiber wrote: This is user adjustable. You change the error mode to raise on 'invalid' instead of pass silently which is now the default. -Travis Could you please explain how this adjustment is done, or point to the relevant

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Fernando Perez
On 10/11/06, Travis Oliphant [EMAIL PROTECTED] wrote: Fernando Perez wrote: IMHO, scipy should be within reason a strict superset of numpy. This was not the relationship of scipy to Numeric. For me, it's the fact that scipy *used* to have the behavior that scipy.sqrt(-1) return 1j

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Fernando Perez
On 10/11/06, Travis Oliphant [EMAIL PROTECTED] wrote: Fernando Perez wrote: There are people who import scipy for everything, others distinguish between numpy and scipy, others use numpy alone and at some point in their life's code they do import numpy as N - import scipy as N because

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread pearu
On Wed, 11 Oct 2006, Travis Oliphant wrote: On the other hand requiring all calls to numpy.sqrt to go through an argument-checking wrapper is a bad idea as it will slow down other uses. Interestingly, in worst cases numpy.sqrt is approximately ~3 times slower than scipy.sqrt on negative

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Travis Oliphant
Stefan van der Walt wrote: I agree with Fernando on this one. Further, if I understand correctly, changing sqrt and power to give the right answer by default will slow things down somewhat. But is it worth sacrificing intuitive usage for speed? For NumPy, yes. This is one reason that

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Travis Oliphant
[EMAIL PROTECTED] wrote: On Wed, 11 Oct 2006, Travis Oliphant wrote: On the other hand requiring all calls to numpy.sqrt to go through an argument-checking wrapper is a bad idea as it will slow down other uses. Interestingly, in worst cases numpy.sqrt is approximately ~3 times

[Numpy-discussion] RC2 - f2py no workee

2006-10-11 Thread Mathew Yeates
I'm running the following python c:\Python24\Scripts\f2py.py --fcompiler=absoft -c foo.pyf foo.f and it seems that the compiler info isn't being passed down. When distutils tries to compile I get the error --- File

Re: [Numpy-discussion] incrementing along a diagonal

2006-10-11 Thread David Novakovic
Johannes Loehnert wrote: I'm just wondering if there is a way that i can increment all the values along a diagonal? Assume you want to change mat. # min() only necessary for non-square matrices index = arange(min(mat.shape[0], mat.shape[1])) # add 1 to each diagonal element

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread pearu
On Wed, 11 Oct 2006, Travis Oliphant wrote: Interestingly, in worst cases numpy.sqrt is approximately ~3 times slower than scipy.sqrt on negative input but ~2 times faster on positive input: In [47]: pos_input = numpy.arange(1,100,0.001) In [48]: %timeit -n 1000 b=numpy.sqrt(pos_input)

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Travis Oliphant
Tim Hochberg wrote: With python 2.5 out now, perhaps it's time to come up with a with statement context manager. Something like: from __future__ import with_statement import numpy class errstate(object): def __init__(self, **kwargs): self.kwargs = kwargs

Re: [Numpy-discussion] incrementing along a diagonal

2006-10-11 Thread Bill Baxter
On 10/12/06, David Novakovic [EMAIL PROTECTED] wrote: Johannes Loehnert wrote: This is very nice, exactly what i want, but it doesnt work for mxn matricies: x = zeros((5,3)) x array([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]) index =

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Pierre GM
nan's are making things really slow, Yeah, they do. This actually makes the case for masked arrays, rather than using NAN's. Travis, Talking about masked arrays, I'm about being done rewriting numpy.core.ma, mainly transforming MaskedArray as a subclass of ndarray (it should be OK by the

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Stefan van der Walt
On Wed, Oct 11, 2006 at 05:21:44PM -0600, Travis Oliphant wrote: Stefan van der Walt wrote: I agree with Fernando on this one. Further, if I understand correctly, changing sqrt and power to give the right answer by default will slow things down somewhat. But is it worth sacrificing

Re: [Numpy-discussion] incrementing along a diagonal

2006-10-11 Thread David Novakovic
Thanks for the help, i've learnt a lot and also figured out something that does what I want, i'll paste an interactive session below: x = zeros((4,7)) x array([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]]) index =

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread A. M. Archibald
On 11/10/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In SciPy 0.3.x the ufuncs were overloaded by more intelligent versions. A very attractive feature was that sqrt(-1) would yield 1j as in Matlab. Then you can program formulas directly (e.g., roots of a 2nd order polynomial) and the

Re: [Numpy-discussion] SPAM-LOW: Re: incrementing along a diagonal

2006-10-11 Thread David Novakovic
David Novakovic wrote: Thanks for the help, i've learnt a lot and also figured out something that does what I want, i'll paste an interactive session below: x = zeros((4,7)) x array([[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0,

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Stefan van der Walt
On Wed, Oct 11, 2006 at 08:24:01PM -0400, A. M. Archibald wrote: What is the desired behaviour of sqrt? [...] Should it return a complex array only when any entry in its input is negative? This will be even *more* surprising when a negative (perhaps even -0) value appears in their matrix

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Paul Dubois
This is a meta-statement about this argument.We already had it. Repeatedly. Whether you choose it one way or the other, for Numeric the community chose it the way it did for a reason. It is a good reason. It isn't stupid. There were good reasons for the other way. Those reasons weren't stupid. It

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Tim Hochberg
Travis Oliphant wrote: Tim Hochberg wrote: With python 2.5 out now, perhaps it's time to come up with a with statement context manager. Something like: from __future__ import with_statement import numpy class errstate(object): def __init__(self, **kwargs):

Re: [Numpy-discussion] incrementing along a diagonal

2006-10-11 Thread Travis Oliphant
David Novakovic wrote: Hi, i'm moving some old perl PDL code to python. I've come across a line which changes values in a diagonal line accross a matrix. matrix.diagonal() returns a list of values, but making changes to these does not reflect in the original (naturally). I'm just

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Greg Willden
On 10/11/06, Travis Oliphant [EMAIL PROTECTED] wrote: Stefan van der Walt wrote:Further, if I understand correctly, changing sqrt and power to givethe right answer by default will slow things down somewhat.But is itworth sacrificing intuitive usage for speed? For NumPy, yes.This is one reason that

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Travis Oliphant
Greg Willden wrote: On 10/11/06, *Travis Oliphant* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Stefan van der Walt wrote: Further, if I understand correctly, changing sqrt and power to give the right answer by default will slow things down somewhat. But is it

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Charles R Harris
On 10/11/06, Tim Hochberg [EMAIL PROTECTED] wrote: Greg Willden wrote: On 10/11/06, *Travis Oliphant* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Stefan van der Walt wrote: Further, if I understand correctly, changing sqrt and power to give the right answer by default will slow things down