def closset_mtach(check, arr, itr):
id_min = []
for ii in range(itr):
id_min_tmp = np.argmin( abs(arr - check) )
id_min.append(id_min_tmp)
arr[id_min_tmp] = float('-inf')
id_min = np.array(id_min)
return id_min
def get_CS_id(arr1, arr2, tol, itr):
tt = arr2
for ii in range(5,6):
id_com = np.where( abs(arr1[ii] - tt) < tol )[0]
if np.size(id_com) >= itr:
mm = closset_mtach(arr1[ii], tt[id_com], itr)
id_ttt = np.array(id_com)[mm]
#print(id_ttt)
print(arr2[id_ttt])
tt[id_ttt] = 0.0 ########-9999.9 ###float('-inf')
print(arr2[id_ttt])
This is the two routines I am using to compare the two float arrays and
getting the matching in them up to some tolerance.
The very strange thing which is happening here is you see variable arr2 at
ID id_ttt before changing the variable tt at the same ID (i.e. id_ttt]) is
showing some value but once I am printing its value after assigning
tt[id_ttt] = 0.0, arr2[id_ttt] is also showing 0 value however, I have not
touched arr2 anywhere as far as changing its values are concerned.
Can any one please help me.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/L2XD3DHSV3FMJWCJS4JAMB2V45LH2CWK/
Code of Conduct: http://python.org/psf/codeofconduct/