import numpy as np
import matplotlib.pyplot as plt
import dtw

len = 10
add_noise = True
noise = np.random.uniform(size=len)if add_noise else np.zeros((len,))
arx = np.linspace(start = 1, stop = 6.28,num = len)
query = np.sin(arx) + noise
ref = np.cos(arx)

alignment =  dtw.dtw(query,ref,dist_method='cosine',step_pattern='symmetric2', window_type=None,keep_internals=True)
print( f'Accumulated Cost Matrix is {alignment.costMatrix}')
print(f'Distance is {alignment.distance}, \n normalize distance is {alignment.normalizedDistance}')
print(f'Warp Path is {alignment.index1[:]}:{alignment.index2[:]}')
plt.plot(alignment.index1,alignment.index2)
plt.show()
