-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathanalyze_data.py
53 lines (41 loc) · 990 Bytes
/
analyze_data.py
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
45
46
47
48
49
50
51
import csv
import numpy as np
import cv2
import pickle
import os
import sys
import tables
import matplotlib.pyplot as plt
# -------------------------------------
# Command line argument processing
# -------------------------------------
if len(sys.argv) < 2:
print("Missing training data file.")
print("python3 model.py <data.h5>")
H5_FILE = str(sys.argv[1])
# ------------------
# Read data from preprocessed HDF5 file
# ------------------
f = tables.open_file(H5_FILE, 'r')
# Convert to numpy array
angle = f.root.steer
throttle =f.root.throttle
brake = f.root.brake
speed = f.root.speed
plt.figure(1)
plt.subplot(131)
plt.plot(angle, throttle, 'ro')
plt.xlabel('angle')
plt.ylabel('throttle')
plt.subplot(132)
plt.plot(angle, speed, 'ro')
plt.xlabel('angle')
plt.ylabel('speed')
plt.subplot(133)
plt.hist(np.array(angle),20)
plt.xlabel('angle')
plt.ylabel('number of samples')
plt.tight_layout()
plt.suptitle(H5_FILE, size=15)
plt.subplots_adjust(top=0.9)
plt.show()