a b/app/scratch/test_h5py.py
1
import numpy as np
2
import h5py
3
import matplotlib.pyplot as plt
4
5
h5file = h5py.File('output.anydata.h5')
6
data = np.array(h5file['Output/JointAngleOutputs/CMC1Flexion'])
7
h5file.close()
8
print(data)
9
10
number_frames = np.size(data)
11
frames = np.arange(0, number_frames)
12
13
# use LaTeX fonts in the plot
14
# plt.rc('text', usetex=True)
15
plt.rc('font', family='serif')
16
17
plt.plot(frames, np.multiply(data, 180/np.pi))
18
plt.xlim(0, number_frames)
19
plt.ylim(-90, 90)
20
plt.xlabel('frames')
21
plt.ylabel('angle in degree')
22
plt.title('flexion (x-axis)')
23
plt.legend(['bvh', 'any'], loc=2)
24
plt.grid(True)
25
plt.show()