Re: [Numpy-discussion] .transpose() of memmap array fails to close()

2007-08-15 Thread Anne Archibald
On 15/08/07, Glen W. Mabey <[EMAIL PROTECTED]> wrote: > On Tue, Aug 14, 2007 at 12:23:26AM -0400, Anne Archibald wrote: > > On 13/08/07, Glen W. Mabey <[EMAIL PROTECTED]> wrote: > > > > > As I have tried to think through what should be the appropriate > > > behavior for the returned value of __geti

Re: [Numpy-discussion] .transpose() of memmap array fails to close()

2007-08-15 Thread Matthew Brett
Hi, Thanks for looking into this because we (neuroimaging.scipy.org) use mmaps a lot. I am very away from my desk at the moment but please do keep us all informed, and we'll try and pitch in if we can... Matthew On 8/15/07, Glen W. Mabey <[EMAIL PROTECTED]> wrote: > On Tue, Aug 14, 2007 at 12:2

Re: [Numpy-discussion] .transpose() of memmap array fails to close()

2007-08-15 Thread Glen W. Mabey
On Tue, Aug 14, 2007 at 12:23:26AM -0400, Anne Archibald wrote: > On 13/08/07, Glen W. Mabey <[EMAIL PROTECTED]> wrote: > > > As I have tried to think through what should be the appropriate > > behavior for the returned value of __getitem__, I have not been able to > > see an appropriate solution

[Numpy-discussion] NumPy 1.0.3.x and SciPy 0.5.2.x

2007-08-15 Thread Jarrod Millman
Hello, I am hoping to release NumPy 1.0.3.1 and SciPy 0.5.2.1 this weekend. These releases will work with each other and get rid of the annoying deprecation warning about SciPyTest. They are both basically ready to release. If you have some time, please build and install the stable branches and

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-15 Thread mark
Maybe this is not the intended use of where, but it seems to work: >>> from numpy import * # No complaining now >>> a = arange(12) >>> a.shape = (4,3) >>> a array([[ 0, 1, 2], [ 3, 4, 5], [ 6, 7, 8], [ 9, 10, 11]]) >>> b = array([6,7,8]) >>> row = all( equal(a,b), 1 ) >>>

[Numpy-discussion] memory error caused by astype()

2007-08-15 Thread Gong, Shawn (Contractor)
Hi list, When I do large array manipulations, I get out-of-memory errors. If the array size is 5000 by 6000, the following codes use nearly 1G. Then my PC displays a Python error box. The try/except won't catch it if the memory error happens in "astype" instead of "array1* array2" try:

Re: [Numpy-discussion] deleting value from array

2007-08-15 Thread Gael Varoquaux
On Wed, Aug 15, 2007 at 03:11:59AM -0700, mark wrote: > Yeah, I can see the copying is essential. > I just think the syntax > a = delete(a,1) > confusing, as I would expect the deleted value back, rather than the > updated array. > As in the 'pop' function for lists. > No 'pop' in numpy? (I presume

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-15 Thread Matthieu Brucher
The where function ? Matthieu 2007/8/15, mark <[EMAIL PROTECTED]>: > > Oops, 'find' is in pylab (matplotlib). > I guess in numpy you have to use 'where', which does almost the same, > but it returns a Tuple. > Is there a function that is more like the find in matplotlib? > Mark > > > On Aug 15, 1

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-15 Thread mark
Oops, 'find' is in pylab (matplotlib). I guess in numpy you have to use 'where', which does almost the same, but it returns a Tuple. Is there a function that is more like the find in matplotlib? Mark On Aug 15, 12:26 pm, Andy Cheesman <[EMAIL PROTECTED]> wrote: > Thanks for the speedy response bu

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-15 Thread Andy Cheesman
Thanks for the speedy response but where can I locate the find function as it isn't in numpy. Andy mark wrote: > I think you can create an array with a true value in the right spot as > folows: > > row = all( equal(a,b), 1 ) > > Then you can either find the row (but you already knew that one, a

Re: [Numpy-discussion] deleting value from array

2007-08-15 Thread mark
Yeah, I can see the copying is essential. I just think the syntax a = delete(a,1) confusing, as I would expect the deleted value back, rather than the updated array. As in the 'pop' function for lists. No 'pop' in numpy? (I presume this may have been debated extensively in the past). I find the syn

Re: [Numpy-discussion] Finding a row match within a numpy array

2007-08-15 Thread mark
I think you can create an array with a true value in the right spot as folows: row = all( equal(a,b), 1 ) Then you can either find the row (but you already knew that one, as it is b) a[row] or the row index find(row==True) Mark On Aug 15, 11:53 am, Andy Cheesman <[EMAIL PROTECTED]> wrote: >

[Numpy-discussion] Finding a row match within a numpy array

2007-08-15 Thread Andy Cheesman
Dear nice people I'm trying to match a row (b) within a large numpy array (a). My most successful attempt is below hit = equal(b, a) total_hits = add.reduce(hit, 1) max_hit = argmax(total_hits, 0) answer = a[max_hit] where ... a = array([[ 0, 1, 2, 3], [ 4, 5, 6, 7],

Re: [Numpy-discussion] deleting value from array

2007-08-15 Thread Matthieu Brucher
> > I now get the feeling the delete command needs to copy the entire > array with exception of the deleted item. I guess this is a hard thing > to do efficiently? > Well, if you don't copy the array, the value will always remain present. Matthieu ___ N

[Numpy-discussion] deleting value from array

2007-08-15 Thread mark
I am trying to delete a value from an array This seems to work as follows >>> a = array([1,2,3,4]) >>> a = delete( a, 1 ) >>> a array([1, 3, 4]) But wouldn't it make more sense to have a function like a.delete(1) ? I now get the feeling the delete command needs to copy the entire array with exc