Re: [Numpy-discussion] Grid indexing

2011-02-28 Thread Davide
I had a similar problem some time ago, which i solved by building my own class containing an n-d array and an n-d interpolator. Then i overrided the __getitem__ special method so that i could use a fancy notation like the one you want. Inside the method i used n-d dimensional interpolation of the

Re: [Numpy-discussion] {zeros, empty, ...}_like functions behavior with subclasses

2011-02-28 Thread Wes McKinney
On Mon, Feb 28, 2011 at 7:24 PM, Pierre GM wrote: > > On Mar 1, 2011, at 1:05 AM, Bruce Southey wrote: > >> On Mon, Feb 28, 2011 at 4:52 PM, Wes McKinney wrote: >>> I'm having some trouble with the zeros_like function via np.fix: >>> >>> def zeros_like(a): >>>    if isinstance(a, ndarray): >>>  

Re: [Numpy-discussion] Small typo in fromregex

2011-02-28 Thread Ralf Gommers
On Mon, Feb 28, 2011 at 11:51 PM, Matthieu Brucher wrote: > Hi, > I'm sorry I didn't file a bug, I have some troubles getting my old trac > account back :| > In lib/npyio.py, there is a mistake line 1029. > Instead on fh.close(), it should have been file.close(). If fromregex opens > the file, it

Re: [Numpy-discussion] Numpy 1.6 schedule (was: Numpy 2.0 schedule)

2011-02-28 Thread Ralf Gommers
On Mon, Feb 28, 2011 at 11:31 PM, Ralf Gommers wrote: > On Mon, Feb 28, 2011 at 10:36 PM, Bruce Southey wrote: >> It would be great to do some 'housekeeping' and try to address some of >> the old tickets dealt with before numpy 2.0. For example, I think ticket >> 225 (bincount does not accept inp

Re: [Numpy-discussion] Adding `offset` argument to np.lib.format.open_memmap and np.load

2011-02-28 Thread Robert Kern
On Mon, Feb 28, 2011 at 18:50, Sturla Molden wrote: > Den 01.03.2011 01:15, skrev Robert Kern: >> You can have each of those processes memory-map the whole file and >> just operate on their own slices. Your operating system's virtual >> memory manager should handle all of the details for you. > >

Re: [Numpy-discussion] Adding `offset` argument to np.lib.format.open_memmap and np.load

2011-02-28 Thread Sturla Molden
Den 01.03.2011 01:50, skrev Sturla Molden: > Mapping large files from the start will not always work on 32-bit > systems. That is why mmap.mmap take an offset argument now (Python 2.7 > and 3.1.) > Also, numpy.memmap is stricty speaking not needed. One can just use mmap.mmap and pass it to np.fro

Re: [Numpy-discussion] permute and sum?

2011-02-28 Thread josef . pktd
On Mon, Feb 28, 2011 at 6:50 PM, Angus McMorland wrote: > Hi all, > > I want to create a transpose of a vector, such that if the same index > is given in the 'axes' list (as per np.transpose), then the sum of the > original values sharing the same index is placed in the corresponding > output inde

Re: [Numpy-discussion] Adding `offset` argument to np.lib.format.open_memmap and np.load

2011-02-28 Thread Sturla Molden
Den 01.03.2011 01:15, skrev Robert Kern: > You can have each of those processes memory-map the whole file and > just operate on their own slices. Your operating system's virtual > memory manager should handle all of the details for you. Mapping large files from the start will not always work on 32

Re: [Numpy-discussion] {zeros, empty, ...}_like functions behavior with subclasses

2011-02-28 Thread Pierre GM
On Mar 1, 2011, at 1:05 AM, Bruce Southey wrote: > On Mon, Feb 28, 2011 at 4:52 PM, Wes McKinney wrote: >> I'm having some trouble with the zeros_like function via np.fix: >> >> def zeros_like(a): >>if isinstance(a, ndarray): >>res = ndarray.__new__(type(a), a.shape, a.dtype, order=

Re: [Numpy-discussion] Adding `offset` argument to np.lib.format.open_memmap and np.load

2011-02-28 Thread Robert Kern
On Thu, Feb 24, 2011 at 09:49, Jon Olav Vik wrote: > My use case was to preallocate a big record array on disk, then start many > processes writing to their separate, memory-mapped segments of the file. The > end result was one big array on disk, with the correct shape and data type > information

Re: [Numpy-discussion] {zeros, empty, ...}_like functions behavior with subclasses

2011-02-28 Thread Bruce Southey
On Mon, Feb 28, 2011 at 4:52 PM, Wes McKinney wrote: > I'm having some trouble with the zeros_like function via np.fix: > > def zeros_like(a): >    if isinstance(a, ndarray): >        res = ndarray.__new__(type(a), a.shape, a.dtype, order=a.flags.fnc) >        res.fill(0) >        return res >    

[Numpy-discussion] permute and sum?

2011-02-28 Thread Angus McMorland
Hi all, I want to create a transpose of a vector, such that if the same index is given in the 'axes' list (as per np.transpose), then the sum of the original values sharing the same index is placed in the corresponding output index. For example: In: data = np.array([5, 7, 9, 6, 2]) In: order =

Re: [Numpy-discussion] Adding `offset` argument to np.lib.format.open_memmap and np.load

2011-02-28 Thread Jon Olav Vik
Ralf Gommers googlemail.com> writes: > My first question after looking at this is why we would want three > very similar ways to load memory-mapped arrays (np.memmap, np.load, > np.lib.format.open_memmap)? They already exist but your changes make > those three even more similar. If I understand

[Numpy-discussion] {zeros, empty, ...}_like functions behavior with subclasses

2011-02-28 Thread Wes McKinney
I'm having some trouble with the zeros_like function via np.fix: def zeros_like(a): if isinstance(a, ndarray): res = ndarray.__new__(type(a), a.shape, a.dtype, order=a.flags.fnc) res.fill(0) return res try: wrap = a.__array_wrap__ except AttributeError:

[Numpy-discussion] ticket 1562 on loadtxt (was Re: Numpy 2.0 schedule)

2011-02-28 Thread Bruce Southey
On 02/28/2011 09:47 AM, Benjamin Root wrote: On Mon, Feb 28, 2011 at 9:25 AM, Bruce Southey > wrote: On 02/28/2011 09:02 AM, Benjamin Root wrote: [snip] > > > So, is there still no hope in addressing this old bug report of mine? > > http

[Numpy-discussion] Small typo in fromregex

2011-02-28 Thread Matthieu Brucher
Hi, I'm sorry I didn't file a bug, I have some troubles getting my old trac account back :| In lib/npyio.py, there is a mistake line 1029. Instead on fh.close(), it should have been file.close(). If fromregex opens the file, it will crash because the name of the file is not correct. Matthieu --

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Benjamin Root
On Mon, Feb 28, 2011 at 9:25 AM, Bruce Southey wrote: > On 02/28/2011 09:02 AM, Benjamin Root wrote: > [snip] > > > > > > So, is there still no hope in addressing this old bug report of mine? > > > > http://projects.scipy.org/numpy/ticket/1562 > > > > Ben Root > > > I think you need to add more d

[Numpy-discussion] Numpy 1.6 schedule (was: Numpy 2.0 schedule)

2011-02-28 Thread Ralf Gommers
On Mon, Feb 28, 2011 at 10:36 PM, Bruce Southey wrote: > On 02/28/2011 02:00 AM, Ralf Gommers wrote: >> Hi, >> >> On Fri, Jan 28, 2011 at 7:15 AM, Travis Oliphant   >> wrote: >>> The reason for a NumPy 1.6 suggestion, is that Mark (and others it would >>> seem) have additional work and features th

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Bruce Southey
On 02/28/2011 09:02 AM, Benjamin Root wrote: [snip] > > > So, is there still no hope in addressing this old bug report of mine? > > http://projects.scipy.org/numpy/ticket/1562 > > Ben Root > I think you need to add more details to this. So do you have an example of the problem that includes code a

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Benjamin Root
On Mon, Feb 28, 2011 at 8:36 AM, Bruce Southey wrote: > On 02/28/2011 02:00 AM, Ralf Gommers wrote: > > Hi, > > > > On Fri, Jan 28, 2011 at 7:15 AM, Travis Oliphant > wrote: > >> The reason for a NumPy 1.6 suggestion, is that Mark (and others it would > >> seem) have additional work and features

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Bruce Southey
On 02/28/2011 02:00 AM, Ralf Gommers wrote: > Hi, > > On Fri, Jan 28, 2011 at 7:15 AM, Travis Oliphant > wrote: >> The reason for a NumPy 1.6 suggestion, is that Mark (and others it would >> seem) have additional work and features that do not need to wait for the >> NumPy 2.0 ABI design to finali

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread John Salvatier
I just want to say that I am looking forward to np.newiter, and I am impressed at how quickly it's being released. On Mon, Feb 28, 2011 at 2:49 AM, Pauli Virtanen wrote: > Mon, 28 Feb 2011 16:50:59 +0800, Ralf Gommers wrote: > > On Mon, Feb 28, 2011 at 4:00 PM, Ralf Gommers > > wrote: > > > >>

Re: [Numpy-discussion] Grid indexing

2011-02-28 Thread Wolfgang Kerzendorf
I think it is possible to construct a class that takes as init function index converter functions and stores an array. That do for example linear mappings from the floats to the int. I am wondering if the numpy community would be interested in such a thing? I think the code would be very short,

Re: [Numpy-discussion] Grid indexing

2011-02-28 Thread Ian Stokes-Rees
On 2/26/11 3:36 AM, Wolfgang Kerzendorf wrote: > I have a n dimensional grid. The grids axes are linear but not > intergers. Let's say I want the value in gridcell [3.2,-5.6,0.01]. Is > there an easy way to transform the index? Do I have to write my own > class to accomplish this. Is there an

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Pauli Virtanen
Mon, 28 Feb 2011 16:50:59 +0800, Ralf Gommers wrote: > On Mon, Feb 28, 2011 at 4:00 PM, Ralf Gommers > wrote: > >> The other thing that needs to be done is some (more) documentation of >> new features. Einsum and the new iterator seem to be well documented, >> but not described in the release not

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Ralf Gommers
On Mon, Feb 28, 2011 at 4:00 PM, Ralf Gommers wrote: > The other thing that needs to be done is some (more) documentation of > new features. Einsum and the new iterator seem to be well documented, > but not described in the release notes. Hmm, I take that back. Just saw that np.newiter and its m

Re: [Numpy-discussion] Numpy 2.0 schedule

2011-02-28 Thread Ralf Gommers
Hi, On Fri, Jan 28, 2011 at 7:15 AM, Travis Oliphant wrote: > The reason for a NumPy 1.6 suggestion, is that Mark (and others it would > seem) have additional work and features that do not need to wait for the > NumPy 2.0 ABI design to finalize in order to get out there. > If someone is willing t