[Numpy-discussion] Tests for empty arrays

2008-05-06 Thread Andy Cheesman
Hi nice numpy people I was wondering if anyone could shed some light on how to distinguish an empty array of a given shape and an zeros array of the same dimensions. Thanks Andy ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://proje

Re: [Numpy-discussion] Appending a numpy array to existing text file

2007-11-28 Thread Andy Cheesman
It does indeed work Thanks for the help Andy LB wrote: > If you just want to add your matrix to an existing ascii file, you can > open this file in append mode and give the file handle to > numpy.savetxt : > > f_handle = file('my_file.dat', 'a') > savetxt(f_handle, my_matrix) > f_handle.close()

[Numpy-discussion] Appending a numpy array to existing text file

2007-11-27 Thread Andy Cheesman
Hi people, Just a quick question, how do I append a numpy array to an existing ascii output file? I've looked at the numpy.savetxt function and it performs all the formating functions I desire for my output file but it doesn't let me specify how I save my array type Is there a clever work aroun

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

2007-08-16 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] Finding a row match within a numpy array

2007-08-15 Thread Andy Cheesman
u 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: >> Dear nice people >> >> I'm trying to match a row (b) withi

[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],

[Numpy-discussion] Identification of neighbouring sites for a periodic numpy array

2007-04-05 Thread Andy Cheesman
Hi people, I was wondering if people could give me a pointer or two upon the efficient identification of neighbouring sites for a given point upon a numpy array which has periodic conditions. Suggestions upon the web I've seen seem to use lots of loops which does not seem to be the most economical