print mismatch items in two array

Viewed 1087

I want to compare two array(4 floating point)and print mismatched items. I used this code:

>>> from numpy.testing import assert_allclose as np_assert_allclose
>>> x=np.array([1,2,3])
>>> y=np.array([1,0,3])
>>> np_assert_allclose(x,y, rtol=1e-4)

AssertionError: 
Not equal to tolerance rtol=0.0001, atol=0

(mismatch 33.33333333333333%)
 x: array([1, 2, 3])
 y: array([1, 0, 3])

the problem by this code is with big array:

(mismatch 0.0015104228617559556%)
 x: array([ 0.440088,  0.35994 ,  0.308225, ...,  0.199546,  0.226758,  0.2312  ])
 y: array([ 0.44009,  0.35994,  0.30822, ...,  0.19955,  0.22676,  0.2312 ])

I can not find what values are mismatched. how can see them ?

1 Answers
Related