[Numpy-discussion] ScipyTest Warning?

2007-04-24 Thread mark
Hello All - I have a piece of code that works fine for me, but a friend tries to run it and gets this warning. He claims to have updated his Python (2.4), Scipy and numpy. A Does anybody know what import triggers this Warning? I didn't think I imported ScipyTest. Thanks, Mark Warning (from

Re: [Numpy-discussion] ScipyTest Warning?

2007-04-24 Thread Stefan van der Walt
Hi Mark On Tue, Apr 24, 2007 at 07:28:35AM -, mark wrote: I have a piece of code that works fine for me, but a friend tries to run it and gets this warning. He claims to have updated his Python (2.4), Scipy and numpy. A Does anybody know what import triggers this Warning? I didn't think I

[Numpy-discussion] Bus Error with string in ndarray with named fields

2007-04-24 Thread Per B. Sederberg
Hi Folks: I'm getting a very strange bus error in the recent versions of numpy (almost current svn). Here's how you can (hopefully) replicate it: On my MacBook: Python 2.4.3 (#1, Apr 7 2006, 10:54:33) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type help, copyright, credits or

[Numpy-discussion] Getting subarray

2007-04-24 Thread Tommy Grav
I have two arrays: a = numpy.array([0,1,2,3,4,5,6,7,8,9]) b = numpy.array([0,0,1,1,2,2,0,1,2,3]) I would like to get the part of a that corresponds to where b is equal to i. For example: i = 0 = ([0,1,6]) i = 1 = ([2,3,7]) Cheers Tommy ___

[Numpy-discussion] numpy migration

2007-04-24 Thread Duncan Smith
Hello, Since moving to numpy I've had a few problems with my existing code. It basically revolves around the numpy scalar types. e.g. import Numeric as N a = N.array([[0,1],[2,3]]) a array([[0, 1], [2, 3]]) i = a[0,0] 1/i

Re: [Numpy-discussion] Getting subarray

2007-04-24 Thread Bill Baxter
Easy! a[b==i] --bb On 4/24/07, Tommy Grav [EMAIL PROTECTED] wrote: I have two arrays: a = numpy.array([0,1,2,3,4,5,6,7,8,9]) b = numpy.array([0,0,1,1,2,2,0,1,2,3]) I would like to get the part of a that corresponds to where b is equal to i. For example: i = 0 = ([0,1,6]) i = 1 =

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Bill Baxter
On 4/21/07, Dennis Cooke [EMAIL PROTECTED] wrote: I'm an ex-Matlab user trying to come up to speed with python and numpy. Howdy. First, I hope you've checked out the page: http://www.scipy.org/NumPy_for_Matlab_Users I'm confused on how to use the Numpy functions nonzero() and where(). In

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Christopher Barker
Bill Baxter wrote: In [35]: x = [ 0, 0, 0, 99, 0, 1, 5] In [37]: i=nonzero(x) In [38]: i Out[38]: (array([3, 5, 6]),) Just do i[0]. It's an array, not a string. Try typing type(i[0]) and see what it tells you. Which still begs the question: why does nonzero() return a tuple with an

Re: [Numpy-discussion] Bus Error with string in ndarray with named fields

2007-04-24 Thread Charles R Harris
On 4/20/07, Per B. Sederberg [EMAIL PROTECTED] wrote: Hi Folks: I'm getting a very strange bus error in the recent versions of numpy (almost current svn). Here's how you can (hopefully) replicate it: On my MacBook: Python 2.4.3 (#1, Apr 7 2006, 10:54:33) [GCC 4.0.1 (Apple Computer, Inc.

Re: [Numpy-discussion] using the functions nonzero and where

2007-04-24 Thread Robert Kern
Christopher Barker wrote: Bill Baxter wrote: In [35]: x = [ 0, 0, 0, 99, 0, 1, 5] In [37]: i=nonzero(x) In [38]: i Out[38]: (array([3, 5, 6]),) Just do i[0]. It's an array, not a string. Try typing type(i[0]) and see what it tells you. Which still begs the question: why does

Re: [Numpy-discussion] numpy migration

2007-04-24 Thread Timothy Hochberg
On 4/23/07, Duncan Smith [EMAIL PROTECTED] wrote: Hello, Since moving to numpy I've had a few problems with my existing code. It basically revolves around the numpy scalar types. e.g. import Numeric as N a = N.array([[0,1],[2,3]]) a

Re: [Numpy-discussion] numpy migration

2007-04-24 Thread Timothy Hochberg
On 4/24/07, Timothy Hochberg [EMAIL PROTECTED] wrote [CHOP] Sorry, cut and paste error, that should have read: : i = a[0,0] 1/i 0 You should be getting a warning here. Did one disappear in the cut and paste? Or are you using a nonstandard shell that eats warnings? Or an old version

Re: [Numpy-discussion] Oddity with numpy.int64 integer division

2007-04-24 Thread David M. Cooke
On Apr 23, 2007, at 22:04 , Warren Focke wrote: But even C89 required that x == (x/y)*y + (x%y), and that's not the case here. Missed that. You're right. We pull the same trick Python does with % so that the sign of x % y agrees with the sign of y, but we don't follow Python in

Re: [Numpy-discussion] Oddity with numpy.int64 integer division

2007-04-24 Thread Christian Marquardt
Restore the invariant, and follow python. This -5 // 6 -1 and array([-5])[0] // 6 0 simply doesn't make sense - in any language, you would expect that all basic operators provide you with the same same answer when applied to the same number, no? Christian. On Tue, April 24,

Re: [Numpy-discussion] Oddity with numpy.int64 integer division

2007-04-24 Thread Warren Focke
On Tue, 24 Apr 2007, Timothy Hochberg wrote: On 4/24/07, Robert Kern [EMAIL PROTECTED] wrote: Christian Marquardt wrote: Restore the invariant, and follow python. This seems to imply that once upon a time numpy/numeric/numarray followed python here, but as far as I can recall

Re: [Numpy-discussion] Oddity with numpy.int64 integer division

2007-04-24 Thread Travis Oliphant
Personally I'd opt for completely following Python here, with the C-like integer division and mod operators available as appropriately named ufuncs somewhere. It's a backwards incompatible change though, so it'd have to wait till at least a minor realease. I'm supportive of following