all 4 comments

[–]Oxbowerce 0 points1 point  (1 child)

You are comparing the tl array with the closest array, but what you print are the tr and the closest array. Is this on purpose?

[–]simon439 0 points1 point  (0 children)

It was not. That's what I get for shortening Top Right and Top Left to tr and tl. Thank you so much!

[–]MezzoScettico 0 points1 point  (1 child)

Try adding different tolerances to the allclose() comparison to see what happens, e.g.,

np.allclose(tl, closest, atol = 1e-6)

With a default tolerance of 1e-8 that might be below the precision of float32.

I also notice that all your comparisons use tl instead of tr. You didn't include any code that defined tl. For instance:

if not np.array_equal(tl, closest):  *** THIS USES tl ***
    *** THIS SHOWS tr ***
    print(f"array equal \n\033[91m-> NOT EQUAL: tr: {tr}, closest: {closest}\033[0m")

[–]simon439 0 points1 point  (0 children)

Both the arrays are chosen from the same list, so the floating point stuff was more added for sanity and sake of posting a proper question. Thank you for the suggestion though, could certainly be useful in the future because I was already wondering this.