[Numpy-discussion] dtype from |S10 to object in array?

2010-09-21 Thread keekychen.shared
Dear All, See below code pls, import sicpy import numpy as np x = np.zeros((2,),dtype=('i4,f4,a10')) x[:] = [(1,2.,'Hello'),(2,3.,"World")] y = x['f2'] #array(['Hello', 'World'], dtype='|S10') x['f2'] = y x #array([(1, 2.0, 'Hello'), (2, 3.0, 'World')], dtype=[('f0', 'http://mail.

Re: [Numpy-discussion] Removing numpy numpy-1.1.0 in Python 2.5

2010-09-21 Thread josef . pktd
On Tue, Sep 21, 2010 at 10:32 PM, Wayne Watson wrote: >  I don't see  it in  Add/Remove.  Whoops.  It is on this Win7 machine. > I need to check my XP machine.  I'll be back when I figure out if that's > right. My not always recollection was that it was not on Add/Remove > under XP. > > I'm dealin

Re: [Numpy-discussion] Removing numpy numpy-1.1.0 in Python 2.5

2010-09-21 Thread Wayne Watson
I don't see it in Add/Remove. Whoops. It is on this Win7 machine. I need to check my XP machine. I'll be back when I figure out if that's right. My not always recollection was that it was not on Add/Remove under XP. I'm dealing with people who barely understand software, so keeping this

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Matthew Brett
Hi, > I see that I have interpreted this thread as "Doctor, it hurts when I do > this...  Well, don't do that!"  Sorry for the noise. It's all good - a reply is almost always more friendly and helpful than no reply ;) See you, Matthew ___ NumPy-Discus

Re: [Numpy-discussion] slicing / indexing question

2010-09-21 Thread josef . pktd
On Tue, Sep 21, 2010 at 7:54 PM, Brett Olsen wrote: > On Tue, Sep 21, 2010 at 6:20 PM, Timothy W. Hilton > wrote: >> Hello, >> >> I have an indexing problem which I suspect has a simple solution, but >> I've not been able to piece together various threads I've read on this >> list to solve. >> >

Re: [Numpy-discussion] slicing / indexing question

2010-09-21 Thread Brett Olsen
On Tue, Sep 21, 2010 at 6:20 PM, Timothy W. Hilton wrote: > Hello, > > I have an indexing problem which I suspect has a simple solution, but > I've not been able to piece together various threads I've read on this > list to solve. > > I have an 80x1200x1200 nd.array of floats this_par.  I have a >

Re: [Numpy-discussion] Removing numpy numpy-1.1.0 in Python 2.5

2010-09-21 Thread josef . pktd
On Tue, Sep 21, 2010 at 7:01 PM, Wayne Watson wrote: >  I may have bounced a similar problem around here a few months ago, but > this one is a bit more important to get an answer for. > > I'm about to distribute some report programs to three people who work > together and should be using the same

[Numpy-discussion] slicing / indexing question

2010-09-21 Thread Timothy W. Hilton
Hello, I have an indexing problem which I suspect has a simple solution, but I've not been able to piece together various threads I've read on this list to solve. I have an 80x1200x1200 nd.array of floats this_par. I have a 1200x1200 boolean array idx, and an 80-element float array pars. For ea

[Numpy-discussion] Removing numpy numpy-1.1.0 in Python 2.5

2010-09-21 Thread Wayne Watson
I may have bounced a similar problem around here a few months ago, but this one is a bit more important to get an answer for. I'm about to distribute some report programs to three people who work together and should be using the same version of Python and libraries that I use, and a common ap

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Robert Kern
On Tue, Sep 21, 2010 at 17:40, Pauli Virtanen wrote: > Tue, 21 Sep 2010 17:28:08 -0500, Robert Kern wrote: > [clip] >>> *that* == return a complex number from .real >> >> What is the alternative? I'm personally happy with saying that many of >> the operations we define on numpy arrays can be done

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Pauli Virtanen
Tue, 21 Sep 2010 17:28:08 -0500, Robert Kern wrote: [clip] >> *that* == return a complex number from .real > > What is the alternative? I'm personally happy with saying that many of > the operations we define on numpy arrays can be done because we know the > types and that object arrays subvert th

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Matthew Brett
Hi, On Tue, Sep 21, 2010 at 3:28 PM, Robert Kern wrote: > On Tue, Sep 21, 2010 at 17:17, Pauli Virtanen wrote: >> Tue, 21 Sep 2010 21:50:08 +, Pauli Virtanen wrote: >> >>> Tue, 21 Sep 2010 17:31:55 -0400, Michael Gilbert wrote: The following example demonstrates a rather unexpected resu

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Robert Kern
On Tue, Sep 21, 2010 at 17:17, Pauli Virtanen wrote: > Tue, 21 Sep 2010 21:50:08 +, Pauli Virtanen wrote: > >> Tue, 21 Sep 2010 17:31:55 -0400, Michael Gilbert wrote: >>> The following example demonstrates a rather unexpected result: >>> >> import numpy >> x = numpy.array( complex( 1.0

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Benjamin Root
On Tue, Sep 21, 2010 at 4:44 PM, Benjamin Root wrote: > On Tue, Sep 21, 2010 at 4:31 PM, Michael Gilbert < > michael.s.gilb...@gmail.com> wrote: > >> Hi, >> >> The following example demonstrates a rather unexpected result: >> >> >>> import numpy >> >>> x = numpy.array( complex( 1.0 , 1.0 ) , nump

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Pauli Virtanen
Tue, 21 Sep 2010 21:50:08 +, Pauli Virtanen wrote: > Tue, 21 Sep 2010 17:31:55 -0400, Michael Gilbert wrote: >> The following example demonstrates a rather unexpected result: >> > import numpy > x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object ) >> print x.real >> (1+1j) > pri

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Pauli Virtanen
Tue, 21 Sep 2010 17:31:55 -0400, Michael Gilbert wrote: > The following example demonstrates a rather unexpected result: > import numpy x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object ) > print x.real > (1+1j) print x.imag > 0 > > Shouldn't real and imag return an error in suc

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Matthew Brett
Hi, On Tue, Sep 21, 2010 at 2:44 PM, Benjamin Root wrote: > On Tue, Sep 21, 2010 at 4:31 PM, Michael Gilbert > wrote: >> >> Hi, >> >> The following example demonstrates a rather unexpected result: >> >> >>> import numpy >> >>> x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object ) >> >>> print x

Re: [Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Benjamin Root
On Tue, Sep 21, 2010 at 4:31 PM, Michael Gilbert < michael.s.gilb...@gmail.com> wrote: > Hi, > > The following example demonstrates a rather unexpected result: > > >>> import numpy > >>> x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object ) > >>> print x.real > (1+1j) > >>> print x.imag > 0 > > S

[Numpy-discussion] real and imag functions should produce errors for object arrays

2010-09-21 Thread Michael Gilbert
Hi, The following example demonstrates a rather unexpected result: >>> import numpy >>> x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object ) >>> print x.real (1+1j) >>> print x.imag 0 Shouldn't real and imag return an error in such a situation? Thanks, Mike ___

Re: [Numpy-discussion] A proposed change to rollaxis() behavior for negative 'start' values

2010-09-21 Thread Anne Archibald
Hi Ken, This is a tricky one. The current behaviour of rollaxis is to remove the requested axis from the list of axes and then insert it before the axis specified. This is exactly how python's list insertion works: In [1]: a = range(10) In [3]: a.insert(-1,'a') In [4]: a Out[4]: [0, 1, 2, 3, 4,

[Numpy-discussion] A proposed change to rollaxis() behavior for negative 'start' values

2010-09-21 Thread Ken Basye
Hi Numpy Folks, A while back, I filed this ticket: http://projects.scipy.org/numpy/ticket/1441 suggesting a change to rollaxis() and some fixes to the doc and error reporting. Ralf Gommers suggested I float the behavior change here, so that's what I'm doing. The motivation for the change

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Ernest Adrogué
21/09/10 @ 12:55 (-0500), thus spake Gökhan Sever: > On Tue, Sep 21, 2010 at 12:43 PM, wrote: > > > I'm a bit surprised, I think np.unique does some extra work to > > maintain the order. > > The tolist() might not be necessary if you iterate over rows. > > > > Testing again with a smaller k arra

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Gökhan Sever
On Tue, Sep 21, 2010 at 12:43 PM, wrote: > I'm a bit surprised, I think np.unique does some extra work to > maintain the order. > The tolist() might not be necessary if you iterate over rows. > Testing again with a smaller k array and more repeats I[25]: k = np.array((a.tolist()*5000)) I[27]:

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread josef . pktd
On Tue, Sep 21, 2010 at 1:29 PM, Gökhan Sever wrote: > > > On Tue, Sep 21, 2010 at 1:55 AM, Peter Schmidtke > wrote: >> >> Dear all, >> >> I'd like to know if there is a pythonic / numpy way of retrieving unique >> lines of a 2d numpy array. >> >> In a way I have this : >> >> [[409 152] >>  [409

Re: [Numpy-discussion] read ascii file from complex fortran format() -- genfromtxt

2010-09-21 Thread David Huard
Have you tried http://code.google.com/p/python-fortranformat/ It's not officially released yet but it's probably worth a try. David H. On Tue, Sep 21, 2010 at 8:25 AM, Andrew Jaffe wrote: > Hi all, > > I've got an ascii file with a relatively complicated structure, > originally written by for

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Gökhan Sever
On Tue, Sep 21, 2010 at 1:55 AM, Peter Schmidtke wrote: > Dear all, > > I'd like to know if there is a pythonic / numpy way of retrieving unique > lines of a 2d numpy array. > > In a way I have this : > > [[409 152] > [409 152] > [409 152] > [409 152] > [409 152] > [409 152] > [409 152] > [

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread Peter Schmidtke
Hey Josef, I didn't stumble upon these posts. Thanks for the hint...it doesn't look very pythonic or matlab like still. This would be a nice thing to have a unique function that is able to take an axis argument. Cheers. Peter josef.p...@gmail.com wrote: > On Tue, Sep 21, 2010 at 2:55 AM, Peter

[Numpy-discussion] help from OS X 10.5 users wanted

2010-09-21 Thread Ralf Gommers
Hi, There have been many reports from OS X 10.5(.8) users that the provided binaries on Sourceforge for numpy versions >= 1.4.0 do not work, see http://projects.scipy.org/numpy/ticket/1322. If you're an OS X 10.5 user I would like your help to test if the same issue occurs for the following binary

Re: [Numpy-discussion] unique 2d arrays

2010-09-21 Thread josef . pktd
On Tue, Sep 21, 2010 at 2:55 AM, Peter Schmidtke wrote: > Dear all, > > I'd like to know if there is a pythonic / numpy way of retrieving unique > lines of a 2d numpy array. > > In a way I have this : > > [[409 152] >  [409 152] >  [409 152] >  [409 152] >  [409 152] >  [409 152] >  [409 152] >  [

[Numpy-discussion] read ascii file from complex fortran format() -- genfromtxt

2010-09-21 Thread Andrew Jaffe
Hi all, I've got an ascii file with a relatively complicated structure, originally written by fortran with the format: 135format(a12,1x,2(f10.5,1x),i3,1x,4(f9.3,1x),4(i2,1x),3x, 1 16(f7.2,1x),i3,3x,f13.5,1x,f10.5,1x,f10.6,1x,i3,1x, 2 4(f10.6,1x), 2 i2,1x,f5

[Numpy-discussion] [ANN] SciPy India 2010 Call for Presentations

2010-09-21 Thread Jarrod Millman
== SciPy 2010 Call for Papers == The second `SciPy India Conference `_ will be held from December 13th to 18th, 2010 at `IIIT-Hyderabad `_. At this conference, novel applications and breakthroughs made in the