mirror of
https://github.com/janishutz/BiogasControllerApp.git
synced 2025-11-25 13:54:24 +00:00
typo and illogical variable names fixed
This commit is contained in:
@@ -4,12 +4,14 @@ import matplotlib.pyplot as plt
|
|||||||
go = 0
|
go = 0
|
||||||
|
|
||||||
n = int(input("Aktuelle Sondennummer: "))
|
n = int(input("Aktuelle Sondennummer: "))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
imp = open("Sonden2021.csv", "r")
|
imp = open("Sonden2021.csv", "r")
|
||||||
go = 1
|
go = 1
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("Failed to open file (non-existent or corrupted")
|
print("Failed to open file (non-existent or corrupted?)")
|
||||||
go = 0
|
go = 0
|
||||||
|
|
||||||
if go == 1:
|
if go == 1:
|
||||||
reader = csv.reader(imp, delimiter=',')
|
reader = csv.reader(imp, delimiter=',')
|
||||||
rohdaten = list(reader)
|
rohdaten = list(reader)
|
||||||
@@ -22,10 +24,10 @@ if go == 1:
|
|||||||
extract = rohdaten.pop(0)
|
extract = rohdaten.pop(0)
|
||||||
sondennummer = int(extract.pop(0))
|
sondennummer = int(extract.pop(0))
|
||||||
if sondennummer == n:
|
if sondennummer == n:
|
||||||
xe = extract.pop(0)
|
|
||||||
ye = extract.pop(0)
|
ye = extract.pop(0)
|
||||||
y.append(float(xe))
|
xe = extract.pop(0)
|
||||||
x.append(float(ye))
|
y.append(float(ye))
|
||||||
|
x.append(float(xe))
|
||||||
|
|
||||||
fit = np.polyfit(x, y, 2)
|
fit = np.polyfit(x, y, 2)
|
||||||
print(fit)
|
print(fit)
|
||||||
@@ -34,7 +36,6 @@ if go == 1:
|
|||||||
|
|
||||||
fit_fn = np.poly1d(fit)
|
fit_fn = np.poly1d(fit)
|
||||||
|
|
||||||
|
|
||||||
plt.plot(x, fit_fn(x), color="BLUE", label="T(U)")
|
plt.plot(x, fit_fn(x), color="BLUE", label="T(U)")
|
||||||
|
|
||||||
plt.scatter(x, y, color="MAGENTA", marker="o", label="Messsdaten")
|
plt.scatter(x, y, color="MAGENTA", marker="o", label="Messsdaten")
|
||||||
@@ -49,6 +50,7 @@ if go == 1:
|
|||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
saveit = input("Soll der Graph gespeichert werden? (y/n) ").lower()
|
saveit = input("Soll der Graph gespeichert werden? (y/n) ").lower()
|
||||||
|
|
||||||
if saveit == "y":
|
if saveit == "y":
|
||||||
plt.savefig("Sonde"+str(n)+".png")
|
plt.savefig("Sonde"+str(n)+".png")
|
||||||
plt.savefig("Sonde"+str(n)+".pdf", format="pdf")
|
plt.savefig("Sonde"+str(n)+".pdf", format="pdf")
|
||||||
|
|||||||
Reference in New Issue
Block a user