I have two arrays both from text file. By observation, it totally looks the same. However when I test the equivalence of the two arrays, they fail - element wise, shape wise etc.. I used the numpy test answered here.
Here are the two matrices.
import numpy as np
class TextMatrixAssertions(object):
def assertArrayEqual(self, dataX, dataY):
x = np.loadtxt(dataX)
y = np.loadtxt(dataY)
if not np.array_equal(x, y):
raise Exception("array_equal fail.")
if not np.array_equiv(x, y):
raise Exception("array_equiv fail.")
if not np.allclose(x, y):
raise Exception("allclose fail.")
dataX = "MyMatrix.txt"
dataY = "MyMatrix2.txt"
test = TextMatrixAssertions()
test.assertArrayEqual(dataX, dataY)
I want to know if there is really some difference between the two arrays or if not, what is causing the failures.