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
|
||||
|
||||
n = int(input("Aktuelle Sondennummer: "))
|
||||
|
||||
try:
|
||||
imp = open("Sonden2021.csv", "r")
|
||||
go = 1
|
||||
except FileNotFoundError:
|
||||
print("Failed to open file (non-existent or corrupted")
|
||||
print("Failed to open file (non-existent or corrupted?)")
|
||||
go = 0
|
||||
|
||||
if go == 1:
|
||||
reader = csv.reader(imp, delimiter=',')
|
||||
rohdaten = list(reader)
|
||||
@@ -22,10 +24,10 @@ if go == 1:
|
||||
extract = rohdaten.pop(0)
|
||||
sondennummer = int(extract.pop(0))
|
||||
if sondennummer == n:
|
||||
xe = extract.pop(0)
|
||||
ye = extract.pop(0)
|
||||
y.append(float(xe))
|
||||
x.append(float(ye))
|
||||
xe = extract.pop(0)
|
||||
y.append(float(ye))
|
||||
x.append(float(xe))
|
||||
|
||||
fit = np.polyfit(x, y, 2)
|
||||
print(fit)
|
||||
@@ -34,7 +36,6 @@ if go == 1:
|
||||
|
||||
fit_fn = np.poly1d(fit)
|
||||
|
||||
|
||||
plt.plot(x, fit_fn(x), color="BLUE", label="T(U)")
|
||||
|
||||
plt.scatter(x, y, color="MAGENTA", marker="o", label="Messsdaten")
|
||||
@@ -49,6 +50,7 @@ if go == 1:
|
||||
plt.show()
|
||||
|
||||
saveit = input("Soll der Graph gespeichert werden? (y/n) ").lower()
|
||||
|
||||
if saveit == "y":
|
||||
plt.savefig("Sonde"+str(n)+".png")
|
||||
plt.savefig("Sonde"+str(n)+".pdf", format="pdf")
|
||||
|
||||
Reference in New Issue
Block a user