Let us say I have two nested structures of the following kind:
[(array, (array, array, array)), (array, (array, array, array))]
All of the interesting data inside are NumPy arrays. What is the easiest way to compare two of such data structures? I could index and compare each of the corresponding arrays individually, but that is a lot of indexing and typing.
If there is an easy way to just "swallow" all of the numbers in the contained arrays and "serialise" them unambiguously into one NumPy array, that resulting array would be easy to compare. I am mainly interesting in checking if two such arrays are equal (== or np.allclose()). I have naïvely tried doing so by throwing a np.array around the whole thing but that only converts the outermost list to a NumPy array.
arrayand second element a tuple of arrays?allclose.