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! Andrew

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

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 keekychen.sha...@gmail.com 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')

[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

Re: [Numpy-discussion] searching binary data

2010-09-22 Thread David Cournapeau
On Wed, Sep 22, 2010 at 11:10 PM, Neal Becker ndbeck...@gmail.com 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 ?

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 ndbeck...@gmail.com 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

Re: [Numpy-discussion] printable random seed ?

2010-09-22 Thread Robert Kern
On Wed, Sep 22, 2010 at 09:27, 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

Re: [Numpy-discussion] searching binary data

2010-09-22 Thread Robert Kern
On Wed, Sep 22, 2010 at 09:10, Neal Becker ndbeck...@gmail.com 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

[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 ndbeck...@gmail.com wrote: David Cournapeau wrote: On Wed, Sep 22, 2010 at 11:10 PM, Neal Becker ndbeck...@gmail.com wrote: A colleague of mine posed the following problem.  He wants to search large files of binary data for sequences. Is there

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 dalc...@gmail.com 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,

Re: [Numpy-discussion] slicing / indexing question

2010-09-22 Thread Anne Archibald
On 21 September 2010 19:20, Timothy W. Hilton hil...@meteo.psu.edu 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

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 to

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

[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 rosswilliamson@gmail.com 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]

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 binary

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 dalc...@gmail.com wrote: On 22 September 2010 13:48, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Sep 22, 2010 at 8:35 AM, Lisandro Dalcin dalc...@gmail.com wrote: It seems that lib2to3 does not process the main f2py

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 charlesr.har...@gmail.com 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

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 fperez@gmail.comwrote: On Wed, Sep 22, 2010 at 7:16 PM, Charles R Harris charlesr.har...@gmail.com wrote: Done in 29cccb6. Mmh, I think it broke something: File /home/fperez/tmp/src/scipy/numpy/numpy/distutils/command/build.py,

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 fperez@gmail.comwrote: On Wed, Sep 22, 2010 at 7:16 PM, Charles R Harris charlesr.har...@gmail.com wrote: Done in 29cccb6. Mmh, I think it broke