Commit 890426c1 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Added rough data analysis

parent 5c2f9c3c
#!/usr/bin/python3
import sys
import numpy
import matplotlib.pyplot as plt
import math
if __name__ == '__main__':
data = numpy.loadtxt(sys.argv[1])
print(data.shape)
assert data.shape[1] == 32, "Unexpected # columns %d" % data.shape[1]
seq = data[...,0]
kp = data[...,4:11]
d_kp = kp[1:,...]-kp[0:-1,...]
pos = (data[...,11:25] - data[0,11:25]) * 180 / math.pi
torque = (data[...,25:32:] - data[0,25:32])
for i in range(0,7):
n = 4000 - 500 * i
cut = slice(1000,1000+n)
f, axarr = plt.subplots(3, sharex=True)
axarr[0].set_title(r'$\Delta K_p$')
axarr[0].plot(seq[1:][cut],d_kp[...,i][cut])
axarr[1].set_title('$\Delta Position$')
axarr[1].plot(seq[cut],(pos[...,i*2]-pos[...,i*2+1])[cut])
axarr[2].set_title(r'Torque [Nm]')
axarr[2].plot(seq[cut],torque[...,i][cut])
plt.show()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment