-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotdata.py
More file actions
executable file
·62 lines (42 loc) · 1.34 KB
/
plotdata.py
File metadata and controls
executable file
·62 lines (42 loc) · 1.34 KB
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
import numpy as np
import matplotlib.pyplot as plt
import os
import glob
import pandas as pd
from scipy.interpolate import *
plt.rcParams['figure.figsize'] = [12, 5]
plt.rcParams['figure.dpi'] = 100
#os.chdir("/content/drive/MyDrive/Advanced_Systems_Final_Project/")
#df = pd.read_csv('testout1.csv')
df = pd.read_csv('./printTripleLoop/printLoopV13.csv')
lines = df.columns[1:]
print(lines)
# Average out the lines
df['mean'] = df[lines].mean(axis=1)
print(df.tail(10))
print(df.shape)
print(df.columns)
fig, ax = plt.subplots(figsize=(15,10))
for line in lines:
ax.plot(df.time, df[line], '--', linewidth=2, label=line)
ax.set_title('CPU Power Line Consumption Over Time from printTripleLoop')
ax.set_ylabel('Power (watts)')
ax.set_xlabel('Time (seconds)')
ax.legend()
plt.savefig('allLines.jpg')
x = df['time']
y = df['mean']
fig, ax = plt.subplots(figsize=(15,10))
ax.plot(df.time, df['mean'], '--', linewidth=2, c='black')
ax.scatter(x, y, c='red', label='Raw Data')
# Make interpolation spline as summary data
cs = CubicSpline(x, y)
xnew = np.linspace(x.min(), x.max(), 15)
ynew = cs(xnew)
ax.plot(xnew, ynew, label='Interpolated Data', linewidth=3)
ax.legend()
ax.set_title('CPU Lines -- Mean Power Consumption Over Time')
ax.set_ylabel('Mean Power (watts) From All Lines')
ax.set_xlabel('Time (seconds)')
plt.savefig('meanLines.jpg')
#plt.show()