Re: [Numpy-discussion] Compare NumPy arrays with threshold

2017-05-18 Thread Robert Kern
On Thu, May 18, 2017 at 5:07 AM, Nissim Derdiger wrote: > > Hi again, > Thanks for the responses to my question! > Roberts answer worked very well for me, except for 1 small issue: > > This line: > close_mask = np.isclose(MatA, MatB, Threshold, equal_nan=True) > returns each difference twice – onc

Re: [Numpy-discussion] Compare NumPy arrays with threshold

2017-05-18 Thread Nissim Derdiger
nt-0001.html> -------------- Message: 2 Date: Wed, 17 May 2017 10:13:46 -0700 From: Paul Hobson mailto:pmhob...@gmail.com>> To: Discussion of Numerical Python mailto:numpy-discussion@python.org>> Subject: Re: [Numpy-discussion] Compare NumPy arrays with threshold an

Re: [Numpy-discussion] Compare NumPy arrays with threshold and return the differences

2017-05-17 Thread Daniele Nicolodi
On 5/17/17 10:50 AM, Nissim Derdiger wrote: > Hi, > In my script, I need to compare big NumPy arrays (2D or 3D), and return > a list of all cells with difference bigger than a defined threshold. > The compare itself can be done easily done with "allclose" function, > like that: > Threshold = 0.1 >

Re: [Numpy-discussion] Compare NumPy arrays with threshold and return the differences

2017-05-17 Thread Robert Kern
On Wed, May 17, 2017 at 9:50 AM, Nissim Derdiger wrote: > Hi, > In my script, I need to compare big NumPy arrays (2D or 3D), and return a > list of all cells with difference bigger than a defined threshold. > The compare itself can be done easily done with "allclose" function, like > that: > Thre

Re: [Numpy-discussion] Compare NumPy arrays with threshold and return the differences

2017-05-17 Thread Paul Hobson
I would do something like: diff_is_large = (array1 - array2) > threshold index_at_large_diff = numpy.nonzero(diff_is_large) array1[index_at_large_diff].tolist() On Wed, May 17, 2017 at 9:50 AM, Nissim Derdiger wrote: > Hi, > In my script, I need to compare big NumPy arrays (2D or 3D), and retu