-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_spectrums_compared.py
100 lines (71 loc) · 2.29 KB
/
plot_spectrums_compared.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
#THis plots the values
import sys
import matplotlib.pyplot as plt
import numpy as np
#This returns 3 numbers and 6 lists. Namely in num_list_list, num_list_list, num_list_list
def read_file(filename):
print('Reading: ' , filename)
fo = open(filename,'r')
line1 = fo.readline()
line2 = fo.readline()
line3 = fo.readline()
#These lines were all just the normal lines. Now the numbers
name = str(fo.readline())
#print "myline:", fo.readline()[:-2]
a1 = [float(x) for x in fo.readline()[:-2].split(',')]
p1 = [float(x) for x in fo.readline()[:-2].split(',')]
#num2 = float(fo.readline())
#a2 = [float(x) for x in fo.readline()[:-2].split(',')]
#p2 = [float(x) for x in fo.readline()[:-2].split(',')]
#num3 = float(fo.readline())
#a3 = [float(x) for x in fo.readline()[:-2].split(',')]
#p3 = [float(x) for x in fo.readline()[:-2].split(',')]
#print("A3:",a3)
return name,a1, p1
legend = []
name,a1,p1 = read_file("test_out_file_33.txt")
legend.append(name + "_actual")
legend.append(name+"_predicted")
plt.plot(a1)
plt.plot(p1)
# iterations = 1000
# num3 = iterations
# legend.append(str(num3)+"_predicted")
# num1,a1,p1,num2,a2,p2,num3,a3,p3 = read_file("save_vals"+str(iterations)+".txt")
# #legend.append(str(num3)+"_actual")
# #plt.plot(a3)
# plt.plot(p3)
# iterations = 5000
# num3 = iterations
# legend.append(str(num3)+"_predicted")
# num1,a1,p1,num2,a2,p2,num3,a3,p3 = read_file("save_vals"+str(iterations)+".txt")
# #legend.append(str(num3)+"_actual")
# #plt.plot(a3)
# plt.plot(p3)
# iterations = 16500
# num3 = iterations
# legend.append(str(num3)+"_predicted")
# num1,a1,p1,num2,a2,p2,num3,a3,p3 = read_file("save_vals"+str(iterations)+".txt")
# #legend.append(str(num3)+"_actual")
# #plt.plot(a3)
# plt.plot(p3)
# iterations = 26000
# num3 = iterations
# legend.append(str(num3)+"_predicted")
# num1,a1,p1,num2,a2,p2,num3,a3,p3 = read_file("save_vals"+str(iterations)+".txt")
#legend.append(str(num3)+"_actual")
#plt.plot(a3)
#plt.plot(p3)
#legend.append(str(num1)+"_actual")
#legend.append(str(num1)+"_predicted")
#plt.plot(a1)
#plt.plot(p1)
#legend.append(str(num2)+"_actual")
#legend.append(str(num2)+"_predicted")
#plt.plot(a2)
#plt.plot(p2)
plt.title('Comparing spectrums')
plt.ylabel("Mean square distance")
plt.xlabel("Wavelength")
plt.legend(legend, loc='top left')
plt.show()