-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotter.py
More file actions
44 lines (31 loc) · 962 Bytes
/
plotter.py
File metadata and controls
44 lines (31 loc) · 962 Bytes
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
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm as colormap
from mpl_toolkits.mplot3d import Axes3D as plt3d
import csv
SENSOR_SPACING = 71.2 # mm
def tempToVoltage(t):
return 0.01*(t-25) + 0.75
def voltageToTemp(x):
return 100*(x-0.75) + 25
data = np.loadtxt('RunMay17-1.csv', delimiter=',')
time = data[:, 0] / 1000
temp = np.array([voltageToTemp(data[:, i] * 5 / 1024) for i in range(1,6)])
x = np.array([i * SENSOR_SPACING for i in range(5)])
fig2 = plt.figure(2)
ax2 = fig2.add_subplot(111, projection = '3d')
ax2.set_xlabel("Position along rod (mm)")
ax2.set_ylabel("Time (s)")
ax2.set_zlabel("Temperature (degC)")
#time, x = np.meshgrid(time, x)
print(x.shape)
print(time.shape)
print(temp.shape)
# ax2.plot_surface(x, time, temp, cmap = colormap.viridis)
# plt.show()
plt.figure(1)
plt.xlabel("Time (s)")
plt.ylabel("Temperature (degC)")
for i in range(len(temp)):
plt.plot(time, temp[i])
plt.show()