File: plot-results.py

package info (click to toggle)
python-qmix 1.0.6-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,460 kB
  • sloc: python: 4,312; makefile: 215
file content (44 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""Plot speed test results.

Usage:
    python plot-results.py results-speed-test-qtcurrent.txt
    # or
    python plot-results.py results-speed-test-harmonic-balance.txt

"""

import sys
import numpy as np 
import matplotlib.pyplot as plt 

results = np.genfromtxt(sys.argv[1], usecols=(1,2,3,4), delimiter='\t', skip_header=2).T

fig, ax = plt.subplots(4, 1, sharex=True, figsize=(5, 8))
fig.subplots_adjust(hspace=0)

for i in range(4):
    ax[i].plot(results[i]*1000, 'ro--')
    ax[i].grid()
    ax[i].text(0.95, 0.95, '{} tone'.format(i+1),  
               ha='right', va='top', transform=ax[i].transAxes)
    ax[i].set_ylabel('Time (ms)')

ax[3].set_xlim([0, len(results[0])])
ax[3].set_xlabel('Trial number')
fig.align_ylabels()
plt.show()

fig, ax = plt.subplots(4, 1, sharex=True, figsize=(5, 8))
fig.subplots_adjust(hspace=0)

for i in range(4):
    ax[i].plot((results[i]/results[i,0]-1)*100, 'ro--')
    ax[i].grid()
    ax[i].text(0.95, 0.95, '{} tone'.format(i+1),  
               ha='right', va='top', transform=ax[i].transAxes)
    ax[i].set_ylabel('Change (%)')

ax[3].set_xlim([0, len(results[0])])
ax[3].set_xlabel('Trial number')
fig.align_ylabels()
plt.show()