Cool danke jetzt vieleicht noch was anderes. Wie kann ich das was ich heir widerholt in eine Schleife schreiben:
Code: Alles auswählen
f = data[:, 0]
mask1 = (23.92 <= f) & (f <= 1196) 
mask2 = (0.01 <= f) & (f <= 23.92)
LDS1 = data[mask1, :]
LDS2 = data[mask2, :]
#Part 1
logx,logy = np.log(LDS1[:,0]),np.log(LDS1[:,1])
coeffs1 = np.polyfit(logx,logy,deg=1)                                         
poly = np.poly1d(coeffs1)                                                   
yfit = lambda f_new: np.exp(poly(np.log(LDS1[:,0])))
plt.loglog(LDS1[:,0],yfit(LDS1[:,0]),'r-',zorder=4)
#Part 2
logx,logy = np.log(LDS2[:,0]),np.log(LDS2[:,1])
coeffs2 = np.polyfit(logx,logy,deg=1)                                         
poly = np.poly1d(coeffs2)                                                   
yfit = lambda f_new: np.exp(poly(np.log(LDS2[:,0])))
plt.loglog(LDS2[:,0],yfit(LDS2[:,0]),'r-',zorder=4)
 Irgendwie so oder:
 aber wie drücke ich z.B LDS 1 aus?