Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Ausreißersuche verbessert
Browse files Browse the repository at this point in the history
* Code ordentlicher
  • Loading branch information
Findus23 committed Feb 25, 2014
1 parent 9342e60 commit 38166cd
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Endauswertung/mathe.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ def offnen(datei):
global liste # Liste außerhalb von Funtion nutzen
liste = list(zip(*reader)) # = [temp1,temp2,temp3,temp4,luft_temp,luft_feucht,druck,temp_druck,rasp]

def ausreisser(spalte):
zeilenanzahl = len(spalte) -1
i = 0
while i < zeilenanzahl:
if (spalte[i] != "") and (spalte[i+1] != "") and (spalte[i-1] != ""):
diff1 = spalte[i]-spalte[i+1]
diff2 = spalte[i]-spalte[i-1]
if ((diff1 < -10) or (diff1 > 10)) and ((diff2 < -10) or (diff2 > 10)):
print("in Spalte " + str(liste.index(spalte)+1) + " Zeile " + str(i+1) + " ist ein Ausreisser (" + str(spalte[i]) + ")")
# else:
# print("Passt:" + str(i),str(diff1),str(diff2))
i+= 1

def mittelwert(spalte):
summe = 0
anzahl = 0 # Anzahl der Messwerte
Expand Down Expand Up @@ -81,18 +94,8 @@ def datumsfrage(frage):

offnen("vorbereitet.csv")
datum_offnen()

for spalte in liste:
i = 0
while i < 500:
if (spalte[i] != "") and (spalte[i+1] != "") and (spalte[i-1] != ""):
diff1 = spalte[i]-spalte[i+1]
diff2 = spalte[i]-spalte[i-1]
if ((diff1 < -10) or (diff1 > 10)) and ((diff2 < -10) or (diff2 > 10)):
print("in Spalte " + str(liste.index(spalte)+1) + " Zeile " + str(i+1) + " ist ein Ausreisser")
# else:
# print("Passt:" + str(i),str(diff1),str(diff2))
i+= 1
ausreisser(spalte)

print("Bitte Datum im Format 'DD.MM.YY HH:MM:SS' eingeben")
print("Es sollte zwischen " + inhalt[1].rstrip() + " und " + inhalt[-1].rstrip() + " liegen")
Expand Down

0 comments on commit 38166cd

Please sign in to comment.