ABBA
ABBA copied to clipboard
TypeError: ord() expected string of length
It is found that code with the problem:
ts = np.sin(7np.linspace(0,41.8*np.pi,2400)) ts = np.array(ts) ts -= np.median(ts) ts *= len(ts)/norm(ts,1)
TOL = .333 abba = ABBA.ABBA(tol=TOL, norm=1); pieces = abba.compress(ts) polyg = abba.inverse_compress(ts[0], pieces) polyg = np.array(polyg)
string, centers = abba.digitize_incremental(pieces) print('Polygon now represented by the string', string) # output: " Polygon now represented by the string [0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2]"
approx = abba.inverse_transform(string, centers, ts[0]) # TypeError: ord() expected string of length 1, but int found