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

2010-09-22 Thread Andrew Jaffe
On 21/09/2010 18:29, David Huard wrote: > Have you tried > > http://code.google.com/p/python-fortranformat/ > > It's not officially released yet but it's probably worth a try. Well, I noticed it, bugt the website does say "This is a work in progress, a working version is not yet available"! And

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

2010-09-22 Thread Pierre GM
On Sep 21, 2010, at 2:25 PM, Andrew Jaffe wrote: > 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,1

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

2010-09-22 Thread josef . pktd
On Wed, Sep 22, 2010 at 2:04 AM, keekychen.shared wrote: >  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

[Numpy-discussion] searching binary data

2010-09-22 Thread Neal Becker
A colleague of mine posed the following problem. He wants to search large files of binary data for sequences. I thought of using mmap (to avoid reading all data into memory at once) and then turning this into a numpy array (using buffer=). But, how to then efficiently find a sequence? Note t

Re: [Numpy-discussion] searching binary data

2010-09-22 Thread David Cournapeau
On Wed, Sep 22, 2010 at 11:10 PM, Neal Becker wrote: > A colleague of mine posed the following problem.  He wants to search large > files of binary data for sequences. > Is there a reason why you cannot use one of the classic string search algorithms applied to the bytestream ? David ___

Re: [Numpy-discussion] searching binary data

2010-09-22 Thread Neal Becker
David Cournapeau wrote: > On Wed, Sep 22, 2010 at 11:10 PM, Neal Becker wrote: >> A colleague of mine posed the following problem. He wants to search >> large files of binary data for sequences. >> > > Is there a reason why you cannot use one of the classic string search > algorithms applied to

[Numpy-discussion] printable random seed ?

2010-09-22 Thread josef . pktd
I would like to generate random numbers based on a random seed, for example what numpy.random does if the seed is not specified. But I would also like to print out the initial state, so I can replicate the random numbers. Can I get a human readable or printable version of the initial state? Altern

Re: [Numpy-discussion] printable random seed ?

2010-09-22 Thread Neal Becker
josef.p...@gmail.com wrote: > I would like to generate random numbers based on a random seed, for > example what numpy.random does if the seed is not specified. But I > would also like to print out the initial state, so I can replicate the > random numbers. > > Can I get a human readable or print

Re: [Numpy-discussion] printable random seed ?

2010-09-22 Thread Robert Kern
On Wed, Sep 22, 2010 at 09:27, wrote: > I would like to generate random numbers based on a random seed, for > example what numpy.random does if the seed is not specified. But I > would also like to print out the initial state, so I can replicate the > random numbers. > > Can I get a human readabl

Re: [Numpy-discussion] searching binary data

2010-09-22 Thread Robert Kern
On Wed, Sep 22, 2010 at 09:10, Neal Becker wrote: > A colleague of mine posed the following problem.  He wants to search large > files of binary data for sequences. > > I thought of using mmap (to avoid reading all data into memory at once) and > then turning this into a numpy array (using buffer=

[Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Lisandro Dalcin
It seems that lib2to3 does not process the main f2py bootstrap script that gets autogenerated by f2py's setup.py. The trivial patch below replaces the print statements with sys.stderr.write() calls. After that change, f2py works just fine in Python 3.2 Index: numpy/f2py/setup.py =

Re: [Numpy-discussion] searching binary data

2010-09-22 Thread David Cournapeau
On Wed, Sep 22, 2010 at 11:25 PM, Neal Becker wrote: > David Cournapeau wrote: > >> On Wed, Sep 22, 2010 at 11:10 PM, Neal Becker wrote: >>> A colleague of mine posed the following problem.  He wants to search >>> large files of binary data for sequences. >>> >> >> Is there a reason why you canno

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Charles R Harris
On Wed, Sep 22, 2010 at 8:35 AM, Lisandro Dalcin wrote: > It seems that lib2to3 does not process the main f2py bootstrap script > that gets autogenerated by f2py's setup.py. The trivial patch below > replaces the print statements with sys.stderr.write() calls. After > that change, f2py works just

Re: [Numpy-discussion] slicing / indexing question

2010-09-22 Thread Gökhan Sever
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] printable random seed ?

2010-09-22 Thread josef . pktd
On Wed, Sep 22, 2010 at 10:32 AM, Neal Becker wrote: > josef.p...@gmail.com wrote: > >> I would like to generate random numbers based on a random seed, for >> example what numpy.random does if the seed is not specified. But I >> would also like to print out the initial state, so I can replicate th

Re: [Numpy-discussion] printable random seed ?

2010-09-22 Thread josef . pktd
On Wed, Sep 22, 2010 at 10:34 AM, Robert Kern wrote: > On Wed, Sep 22, 2010 at 09:27,   wrote: >> I would like to generate random numbers based on a random seed, for >> example what numpy.random does if the seed is not specified. But I >> would also like to print out the initial state, so I can re

Re: [Numpy-discussion] printable random seed ?

2010-09-22 Thread Robert Kern
On Wed, Sep 22, 2010 at 10:48, wrote: > On Wed, Sep 22, 2010 at 10:34 AM, Robert Kern wrote: >> On Wed, Sep 22, 2010 at 09:27,   wrote: >>> I would like to generate random numbers based on a random seed, for >>> example what numpy.random does if the seed is not specified. But I >>> would also li

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

2010-09-22 Thread Wayne Watson
I've considered it, but it's way too time consuming to work out the details. I spent a week some time ago dealing with a simple test program, maybe 10 lines of code, trying to get it to work, which I think I did. I just need to work what I've got. On 9/21/2010 7:49 PM, josef.p...@gmail.com

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Charles R Harris
On Wed, Sep 22, 2010 at 8:35 AM, Lisandro Dalcin wrote: > It seems that lib2to3 does not process the main f2py bootstrap script > that gets autogenerated by f2py's setup.py. The trivial patch below > replaces the print statements with sys.stderr.write() calls. After > that change, f2py works just

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

2010-09-22 Thread Bruce Southey
On 09/22/2010 11:16 AM, Wayne Watson wrote: >I've considered it, but it's way too time consuming to work out the > details. I spent a week some time ago dealing with a simple test > program, maybe 10 lines of code, trying to get it to work, which I think > I did. I just need to work what I'

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Lisandro Dalcin
On 22 September 2010 13:48, Charles R Harris wrote: > > > On Wed, Sep 22, 2010 at 8:35 AM, Lisandro Dalcin wrote: >> >> It seems that lib2to3 does not process the main f2py bootstrap script >> that gets autogenerated by f2py's setup.py. The trivial patch below >> replaces the print statements wit

Re: [Numpy-discussion] printable random seed ?

2010-09-22 Thread Neal Becker
josef.p...@gmail.com wrote: > On Wed, Sep 22, 2010 at 10:32 AM, Neal Becker wrote: >> josef.p...@gmail.com wrote: >> >>> I would like to generate random numbers based on a random seed, for >>> example what numpy.random does if the seed is not specified. But I >>> would also like to print out the

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

2010-09-22 Thread Wayne Watson
On 9/22/2010 10:28 AM, Bruce Southey wrote: ... > > On my old Windows XP (service pack 2!) running Python 2.5.2, running > 'numpy-1.1.0-win32-superpack-python2.5.exe' registers numpy (Python 2.5 > numpy-1.1.0). > > So you really have to remove numpy from the registry - usually via the > 'Add/

Re: [Numpy-discussion] slicing / indexing question

2010-09-22 Thread Anne Archibald
On 21 September 2010 19:20, Timothy W. Hilton wrote: > 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 > each element of idx that is True, I wish to replace the corresponding > 80x1x1 slice of this_par with the

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

2010-09-22 Thread Christopher Barker
Wayne Watson wrote: > I've considered it, but it's way too time consuming to work out the > details. I spent a week some time ago dealing with a simple test > program, maybe 10 lines of code, trying to get it to work, which I think > I did. I just need to work what I've got. There is a lot

Re: [Numpy-discussion] Asking for opinions: Priops

2010-09-22 Thread Sebastian Walter
Hello Friedrich, I have read your proposal. You describe issues that I have also encountered several times. I believe that your priops approach would be an improvement over the current overloading of binary operators. That being said, I think the issue is not so much numpy but rather the way Pytho

[Numpy-discussion] Indexing and lookup issues

2010-09-22 Thread Ross Williamson
Hi everyone I suspect this is easy but I'm stuck say I have a 1D array: t = [10,11,12] and a 2D array: id = [[0,1,0] [0,2,0] [2,0,2]] In could in IDL do y = t[id] which would produce: y = [[10,11,10] [10,12,10] [12,10,12]] i.e. use the indexes in id on the lookup array t. Is there an easy

Re: [Numpy-discussion] Indexing and lookup issues

2010-09-22 Thread Anne Archibald
On 22 September 2010 16:38, Ross Williamson wrote: > Hi everyone > > I suspect this is easy but I'm stuck > > say I have a 1D array: > > t = [10,11,12] > > and a 2D array: > > id = [[0,1,0] > [0,2,0] > [2,0,2]] > > In could in IDL do y = t[id] which would produce: > > y = [[10,11,10] > [10,12,10]

Re: [Numpy-discussion] Indexing and lookup issues

2010-09-22 Thread Ross Williamson
Thank you Anne I was doing something totally stupid at my end. Ross On Wed, Sep 22, 2010 at 3:42 PM, Anne Archibald wrote: > On 22 September 2010 16:38, Ross Williamson > wrote: >> Hi everyone >> >> I suspect this is easy but I'm stuck >> >> say I have a 1D array: >> >> t = [10,11,12] >> >> an

Re: [Numpy-discussion] Asking for opinions: Priops

2010-09-22 Thread Charles R Harris
On Wed, Sep 22, 2010 at 1:31 PM, Sebastian Walter < sebastian.wal...@gmail.com> wrote: > Hello Friedrich, > > I have read your proposal. You describe issues that I have also > encountered several times. > I believe that your priops approach would be an improvement over the > current overloading of

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Charles R Harris
On Wed, Sep 22, 2010 at 12:08 PM, Lisandro Dalcin wrote: > On 22 September 2010 13:48, Charles R Harris > wrote: > > > > > > On Wed, Sep 22, 2010 at 8:35 AM, Lisandro Dalcin > wrote: > >> > >> It seems that lib2to3 does not process the main f2py bootstrap script > >> that gets autogenerated by

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Fernando Perez
On Wed, Sep 22, 2010 at 7:16 PM, Charles R Harris wrote: > > Done in  29cccb6. > Mmh, I think it broke something: File "/home/fperez/tmp/src/scipy/numpy/numpy/distutils/command/build.py", line 37, in run old_build.run(self) File "/usr/lib/python2.6/distutils/command/build.py", line 135,

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Charles R Harris
On Wed, Sep 22, 2010 at 9:14 PM, Fernando Perez wrote: > On Wed, Sep 22, 2010 at 7:16 PM, Charles R Harris > wrote: > > > > Done in 29cccb6. > > > > Mmh, I think it broke something: > > File "/home/fperez/tmp/src/scipy/numpy/numpy/distutils/command/build.py", > line 37, in run >old_build.ru

Re: [Numpy-discussion] [PATCH] F2Py on Python 3

2010-09-22 Thread Charles R Harris
On Wed, Sep 22, 2010 at 10:00 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Wed, Sep 22, 2010 at 9:14 PM, Fernando Perez wrote: > >> On Wed, Sep 22, 2010 at 7:16 PM, Charles R Harris >> wrote: >> > >> > Done in 29cccb6. >> > >> >> Mmh, I think it broke something: >> >> File

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

2010-09-22 Thread Ralf Gommers
On Wed, Sep 22, 2010 at 4:14 AM, Anne Archibald wrote: > 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 = ra