Re: [Numpy-discussion] puzzle: generate index with many ranges

2009-02-01 Thread Raik Gruenberg
Beautiful! That should do the trick. Now let's see how this performs against the list comprehension... Thanks a lot! Raik Rick White wrote: Here's a technique that works: Python 2.4.2 (#5, Nov 21 2005, 23:08:11) [GCC 4.0.0 20041026 (Apple Computer, Inc. build 4061)] on darwin Type help,

Re: [Numpy-discussion] using numpy functions on an array of objects

2009-02-01 Thread Sebastian Walter
On Sun, Feb 1, 2009 at 12:24 AM, Robert Kern robert.k...@gmail.com wrote: On Sat, Jan 31, 2009 at 10:30, Sebastian Walter sebastian.wal...@gmail.com wrote: Wouldn't it be nice to have numpy a little more generic? All that would be needed was a little check of the arguments. If I do:

Re: [Numpy-discussion] example reading binary Fortran file

2009-02-01 Thread Neil Martinsen-Burrell
David Froger david.froger.info at gmail.com writes: Hy,My question is about reading Fortran binary file (oh no this question again...) I've posted this before, but I finally got it cleaned up for the Cookbook. For this purpose I use a subclass of file that has methods for reading unformatted

[Numpy-discussion] question about ufuncs

2009-02-01 Thread Darren Dale
I've been playing with __array_wrap__ to make quantities with units play well with numpy's ufuncs. For example, __array_wrap__ makes it is possible to do the following: numpy.sqrt([1.,4.,9.]*m**2) array([1.,2.,3.])*m Is there an analog to __array_wrap__ for preprocessing arrays on their way

Re: [Numpy-discussion] question about ufuncs

2009-02-01 Thread Pierre GM
On Feb 1, 2009, at 6:32 PM, Darren Dale wrote: Is there an analog to __array_wrap__ for preprocessing arrays on their way *into* a ufunc? For example, it would be nice if one could do something like: numpy.sin([1,2,3]*arcseconds) where we have the opportunity to inspect the context,

Re: [Numpy-discussion] question about ufuncs

2009-02-01 Thread Darren Dale
On Sun, Feb 1, 2009 at 7:33 PM, Pierre GM pgmdevl...@gmail.com wrote: On Feb 1, 2009, at 6:32 PM, Darren Dale wrote: Is there an analog to __array_wrap__ for preprocessing arrays on their way *into* a ufunc? For example, it would be nice if one could do something like:

[Numpy-discussion] numpy.load and gzip file handles

2009-02-01 Thread Matthew Miller
Hi everyone. I'd like to log the state of my program as it progresses. Using the numpy.save / numpy.load functions on the same filehandle repeatedly works very well for this -- but ends up making a file which very quickly grows to gigabytes. The data compresses well, though, so I thought I'd use

Re: [Numpy-discussion] numpy.load and gzip file handles

2009-02-01 Thread Stéfan van der Walt
2009/2/2 Matthew Miller mat...@mattdm.org: I'd like to log the state of my program as it progresses. Using the numpy.save / numpy.load functions on the same filehandle repeatedly works very well for this -- but ends up making a file which very quickly grows to gigabytes. The data compresses

Re: [Numpy-discussion] numpy.load and gzip file handles

2009-02-01 Thread Matthew Miller
On Mon, Feb 02, 2009 at 08:01:54AM +0200, Stéfan van der Walt wrote: The GzipFile in Python 2.5 does not support the 2nd (whence) argument. The solution may be to use this wrapper from the EffBot: http://effbot.org/librarybook/gzip-example-2.py In order to back-port that functionality.