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

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

2017-05-17 Thread Nissim Derdiger
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 if (np.allclose(Arr1, Arr2, Threshold, equal_nan=True)):