ich habe aus 15 verschiedenen CSV-Dateien Werte extrahiert und dargestellt. Dies sieht dann so aus:
https://drive.google.com/file/d/1AT5zMv ... sp=sharing
Nun muss ich aber Extremwerte, die dem Durchschnitt 10% oder so abweichen, löschen. Weiterhin möchte ich an jedem Punkt von e_y (x-Achse) den Mittelwert von allen y-Werten berechnen und dies in einer Geraden darstellen. Dabei sollte die 2 Punkte, welche am meisten vom Durchschnitt abweichen, irgendwie durch einen Punkt oder eine Gerade dargestellt werden. Dies sähe dann etwa so aus:
https://www.google.ch/search?q=graph+mi ... YMzvQsBTM:
Hier mein bisheriger Code: (wäre froh wenn mir noch jemand sagen könnte wie ich das zusammenfassen kann, verstehe nicht wie ich eine Variable definieren muss mit einer iterierenden Zahl im Namen)
Code: Alles auswählen
import csv
import numpy as np
import matplotlib as mlp
import matplotlib.pyplot as plt
achse_t1 = np.arange(0.0,0.055,0.00125)
achse_t2 = np.arange(0.0,0.0575,0.00125)
achse_t3 = np.arange(0.0,0.0525,0.00125)
achse_t4 = np.arange(0.0,0.0525,0.00125)
achse_t5 = np.arange(0.0,0.05625,0.00125)
achse_t6 = np.arange(0.0,0.05125,0.00125)
##achse_t7 = np.arange(0.0,0.5,0.00125)
achse_t8 = np.arange(0.0,0.0575,0.00125)
achse_t9 = np.arange(0.0,0.05375,0.00125)
achse_t10 = np.arange(0.0,0.05375,0.00125)
achse_t11 = np.arange(0.0,0.05375,0.00125)
achse_t12 = np.arange(0.0,0.055,0.00125)
achse_t13 = np.arange(0.0,0.05375,0.00125)
achse_t14 = np.arange(0.0,0.05625,0.00125)
achse_t15 = np.arange(0.0,0.055,0.00125)
for i in range(1,2):
with open("specimen_"+str(i)+"_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data1 = list(reader) #creates a list of read data
with open("specimen_2_nonholed.csv") as f:
reader = csv.reader(f) #reads holed data
_ = next(reader) #ignores header
data2 = list(reader) #creates a list of read data
with open("specimen_3_nonholed.csv") as f:
reader = csv.reader(f) #reads patched data
_ = next(reader) #ignores header
data3 = list(reader) #creates a list of read data
with open("specimen_4_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data4 = list(reader) #creates a list of read data
with open("specimen_5_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data5 = list(reader) #creates a list of read data
with open("specimen_6_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data6 = list(reader) #creates a list of read data
##with open("specimen_7_nonholed.csv") as f:
## reader = csv.reader(f) #reads nonholed data
## _ = next(reader) #ignores header
## data7 = list(reader) #creates a list of read data
with open("specimen_8_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data8 = list(reader) #creates a list of read data
with open("specimen_9_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data9 = list(reader) #creates a list of read data
with open("specimen_10_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data10 = list(reader) #creates a list of read data
with open("specimen_11_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data11 = list(reader) #creates a list of read data
with open("specimen_12_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data12 = list(reader) #creates a list of read data
with open("specimen_13_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data13 = list(reader) #creates a list of read data
with open("specimen_14_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data14 = list(reader) #creates a list of read data
with open("specimen_15_nonholed.csv") as f:
reader = csv.reader(f) #reads nonholed data
_ = next(reader) #ignores header
data15 = list(reader) #creates a list of read data
##print("Der Maximalwert (nonholed) lautet: ", max(float(row[1])*100 for row in data1), "%")
##print("Der Maximalwert (holed) lautet: ", max(float(row[1])*100 for row in data2), "%")
##print("Der Maximalwert (patched) lautet: ", max(float(row[1])*100 for row in data3), "%")
achse_y1 = list(float(row[2])*100 for row in data1)
achse_y2 = list(float(row[2])*100 for row in data2)
achse_y3 = list(float(row[2])*100 for row in data3)
achse_y4 = list(float(row[2])*100 for row in data4)
achse_y5 = list(float(row[2])*100 for row in data5)
achse_y6 = list(float(row[2])*100 for row in data6)
##achse_y7 = list(float(row[2])*100 for row in data7)
achse_y8 = list(float(row[2])*100 for row in data8)
achse_y9 = list(float(row[2])*100 for row in data9)
achse_y10 = list(float(row[2])*100 for row in data10)
achse_y11 = list(float(row[2])*100 for row in data11)
achse_y12 = list(float(row[2])*100 for row in data12)
achse_y13 = list(float(row[2])*100 for row in data13)
achse_y14 = list(float(row[2])*100 for row in data14)
achse_y15 = list(float(row[2])*100 for row in data15)
plt.plot(achse_t1,achse_y1, label="1")
plt.plot(achse_t2,achse_y2, label="2")
plt.plot(achse_t3,achse_y3, label="3")
plt.plot(achse_t4,achse_y4, label="4")
plt.plot(achse_t5,achse_y5, label="5")
plt.plot(achse_t6,achse_y6, label="6")
##plt.plot(achse_t7,achse_y7, label="7")
plt.plot(achse_t8,achse_y8, label="8")
plt.plot(achse_t9,achse_y9, label="9")
plt.plot(achse_t10,achse_y10, label="10")
plt.plot(achse_t11,achse_y11, label="11")
plt.plot(achse_t12,achse_y12, label="12")
plt.plot(achse_t13,achse_y13, label="13")
plt.plot(achse_t14,achse_y14, label="14")
plt.plot(achse_t15,achse_y15, label="15")
plt.xlabel('e_y [%]')
plt.ylabel('e_xx [%]')
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3, ncol=2, borderaxespad=0.)
plt.show()