[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

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() HTH

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

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

2007-08-15 Thread Andy Cheesman
, 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) within a large numpy array (a). My most successful attempt is below hit = equal(b, a) total_hits = add.reduce(hit, 1