-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_visualization.py
152 lines (99 loc) · 4.34 KB
/
data_visualization.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import pandas as pd
import matplotlib.pyplot as pyplot
import mplcursors
import seaborn as sns
test_size = 1000
df = pd.read_csv('fm_volvo_odb_telemetry.csv', index_col=0).interpolate(method='akima', axis=0).iloc[:test_size, :]
#.interpolate(method='akima', order=5)
#.interpolate(method='linear', axis=0)
#df.info()
#read_csv('recent-grads.csv')
#print(dt.shape)
#print(dt.dtypes)
#print(df.head())
#print()
#print(recent_grads.sample(5, random_state=0))
#recent_grads['Temp'].plot(linewidth=0.5);
#dt.plot(y=["EngineLoad", "VehicleSpeed","ThrottlePosition"])
#dt.plot(y=["CoolantTemperature", "IntakeAirTemperature", "AmbientAirTemperature"])
#dt.plot(y=["EngineRPM", "MAF","ThrottlePosition"])
#df.plot(y=["DirectFuelRailPressure","FuelLevel"])
#pyplot.show()
#{"DTC": 0, "MAF": 2958, "Date": "2020-11-22T16:38:48", "EGRError": 0, "Ignition": 1, "EngineRPM": 1405, "FuelLevel": 99, "IntakeMAP": 113, "EngineLoad": 47, "CommandedEGR": 15, "VehicleSpeed": 76, "ThrottlePosition": 7,
# "BarometicPressure": 100, "CoolantTemperature": 88, "ControlModuleVoltage": 14960, "IntakeAirTemperature": 8, "AmbientAirTemperature": 5, "DirectFuelRailPressure": 9478},
plots = 4 #14
pyplot.figure()
pyplot.subplots_adjust(hspace=0.5,bottom=0.05,top=0.95)
#pyplot.title("EngineRPM", y=1, loc='left')
#pyplot.plot(df["MAF"].values)
#pyplot.title("MAF", y=1, loc='right')
def position_cenerator():
i = 0
while True:
i += 1
yield i
position = position_cenerator()
pyplot.subplot(plots, 1, next(position))
pyplot.plot(df["speed"].values)
pyplot.ylabel('Speed')
#pyplot.legend()
pyplot.title('Prediction result RMSE:%.3f Test:%d ' % (0.543534543423, 123))
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["maf"].values)
# pyplot.title("MAF", y=1, loc='left')
pyplot.subplot(plots, 1, next(position))
pyplot.plot(df["engine_rpm"].values, label='RPM')
pyplot.ylabel('RPM')
#pyplot.legend()
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["throttle_position"].values)
# pyplot.title("ThrottlePosition", y=1, loc='left')
pyplot.subplot(plots, 1, next(position))
pyplot.plot(df["direct_fuel_rail_pressure"].values, label='DirectFuelRailPressure')
pyplot.ylabel('DirectFuelRailPressure')
#pyplot.legend()
pyplot.subplot(plots, 1, next(position))
pyplot.plot(df["fuel_level"].values, label='FuelLevel')
pyplot.ylabel('FuelLevel')
#pyplot.legend()
#pyplot.title("FuelLevel", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["egr_error"].values)
# pyplot.title("EGRError", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["commanded_egr"].values)
# pyplot.title("CommandedEGR", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["intake_map"].values)
# pyplot.title("IntakeMAP", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["engine_load"].values)
# pyplot.title("EngineLoad", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["barometic_pressure"].values)
# pyplot.title("BarometicPressure", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["fmmu_type"].values)
# #pyplot.plot(df["movement"].values)
# pyplot.title("I\M", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["coolant_temperature"].values)
# pyplot.title("CoolantTemperature", y=1, loc='left')
# #pyplot.subplot(plots, 1, 14)
# pyplot.plot(df["intake_air_temperature"].values)
# pyplot.title("IntakeAirTemperature", y=1, loc='left')
# #pyplot.subplot(plots, 1, 15)
# pyplot.plot(df["ambient_air_temperature"].values)
# pyplot.title("AmbientAirTemperature", y=1, loc='left')
# pyplot.subplot(plots, 1, next(position))
# pyplot.plot(df["control_module_voltage"].values)
# pyplot.title("ControlModuleVoltage", y=1, loc='left')
#mplcursors.cursor(hover=True)
pyplot.show()
#https://www.dataquest.io/blog/tutorial-time-series-analysis-with-pandas/
#https://towardsdatascience.com/machine-learning-recurrent-neural-networks-and-long-short-term-memory-lstm-python-keras-example-86001ceaaebc
#https://www.tensorflow.org/guide/keras/rnn
#https://adventuresinmachinelearning.com/keras-lstm-tutorial/
#https://keras.io/examples/
#https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/
#https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/