Exemple #1
0
            d += distance
        if d < dOut:
            dOut = d
    markusDistance.append(dOut / np.size(wData[0][0, ::]))
    labels.append(wLabels[i])

ankitaDistance = np.array(ankitaDistance)
markusDistance = np.array(markusDistance)
igorDistance = np.array(igorDistance)
labels = np.array(labels)
axis = np.linspace(0, len(labels) - 1, len(labels))

plt.plot(axis, ankitaDistance, label='ankita', color='r')
writeMatrixToCsvFile(
    data=np.array([axis, ankitaDistance]).T,
    fileName="ankitaCostTrSet.dat",
    path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/",
    matrix=False)
plt.plot(axis, igorDistance, label='igor', color='g')
writeMatrixToCsvFile(
    data=np.array([axis, igorDistance]).T,
    fileName="igorCostTrSet.dat",
    path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/",
    matrix=False)
plt.plot(axis, markusDistance, label='markus', color='b')
writeMatrixToCsvFile(
    data=np.array([axis, markusDistance]).T,
    fileName="markusCostTrSet.dat",
    path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/",
    matrix=False)
plt.stem(axis, 25 * testLabels)
Exemple #2
0
y2 = amp*np.sinc((2*np.pi*fsig)*(x2-l1/4))

distance, path = fastdtw(y1/np.sum(np.square(y1)), y2/np.sum(np.square(y2)), dist=euclidean)
path = np.array(path)
print(distance)

'landscape'

M = []
for i in range(len(y2)):
    temp = []
    for j in range(len(y1)):
        temp.append(np.sqrt(np.square(y2[i] - y1[j])))
    M.append(np.array(temp).T)
    # M.append(euclidean(y2[i]*np.ones(len(y1)),y1))
writeMatrixToCsvFile(data=np.array(M).T, fileName="dtwSinc.dat", path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/")

# check gangmusteranalyse.tex to unserstand (sin should be plotted to axis)

writeMatrixToCsvFile(data=path, fileName="dtwSincPath.dat", path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/", matrix=False)
axis1 = np.linspace(0, len(y1)-1, len(y1))
axis2 = np.linspace(0, len(y2)-1, len(y2))

y1 = 3*y1 - 5*np.ones(len(axis1))
y2 = 2*y2 - 5*np.ones(len(axis2))

writeMatrixToCsvFile(data=np.array([axis1, y1]).T, fileName="dtwSincX.dat", path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/", matrix=False)
writeMatrixToCsvFile(data=np.array([y2, axis2]).T, fileName="dtwSincY.dat", path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/", matrix=False)

'plotting'
plt.figure()
Exemple #3
0
    walkDistance.append(d / np.size(wData[0][0, ::]))
    d = 0
    for j in range(np.size(wData[0][0, ::])):
        distance, path = fastdtw(noWalkBase[::, j],
                                 wData[i][::, j],
                                 dist=euclidean)
        d += distance
    noWalkDistance.append(d / np.size(wData[0][0, ::]))
    labels.append(wLabels[i])

noWalkDistance = np.array(noWalkDistance)
walkDistance = np.array(walkDistance)
labels = np.array(labels)
axis = np.linspace(0, len(labels) - 1, len(labels))

plt.plot(axis, noWalkDistance, label='walk', color='r')
writeMatrixToCsvFile(
    data=np.array([axis, noWalkDistance]).T,
    fileName="walkCost250.dat",
    path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/",
    matrix=False)
plt.plot(axis, walkDistance, label='no walk', color='g')
writeMatrixToCsvFile(
    data=np.array([axis, walkDistance]).T,
    fileName="walkCost250.dat",
    path="/home/bonenberger/Dokumente/Praesentationen/Gangmusteranalyse/",
    matrix=False)
plt.stem(axis, 25 * labels)
plt.legend()
plt.show()