In [1]:
from scipy import stats
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
import auswertung as au
In [2]:
au.import_experiment_data("../Daten/2017-05-08-1351-Aufgabe 2")
In [3]:
DruckT1 = au.messungen[0]
DruckT2 = au.messungen[1]
Zeit = au.messungen[2]
In [4]:
# we will now calculate the logarithm of the data of t1 and t2
logDruckT1 = [np.log(elem) for elem in DruckT1]
logDruckT2 = [np.log(elem) for elem in DruckT2]
In [5]:
T1slope, T1intercept, T1r_value, T1p_value, T1std_err = stats.linregress(Zeit, logDruckT1)
T2slope, T2intercept, T2r_value, T2p_value, T2std_err = stats.linregress(Zeit, logDruckT2)
print(T1slope)
print(T2slope)
In [6]:
figure = plt.figure()
axis_1 = figure.add_subplot(111)
axis_2 = axis_1.twinx()
xlabel_2 = axis_2.set_xlabel('')
ylabel_2 = axis_2.set_ylabel('log(Druck)')
xlabel_1 = axis_1.set_xlabel('Zeit [s]')
ylabel_1 = axis_1.set_ylabel('Druck [mbar]')
T2kurve = axis_1.plot(Zeit,DruckT2, 'rx', label= 'T2 Druck')
T1kurve = axis_1.plot(Zeit,DruckT1, 'bx', label= 'T1 Druck')
T1Logkurve = axis_2.plot(Zeit, logDruckT1, 'gx', label = 'log(Druck T1)')
T2Logkurve = axis_2.plot(Zeit, logDruckT2, 'yx', label = 'log(Druck T2)')
red_patch = mpatches.Patch(color='red', label='Druck T2')
blue_patch = mpatches.Patch(color='blue', label='Druck T1')
green_patch = mpatches.Patch(color='green', label='ln(Druck T1)')
yellow_patch = mpatches.Patch(color='y', label='ln(Druck T2)')
plt.legend(handles=[red_patch, blue_patch, green_patch, yellow_patch])
plt.savefig('../Daten/grap_aufgabe2.pdf')
figure = plt.figure()
axis_3 = figure.add_subplot(111)
xlabel_3 = axis_3.set_xlabel('Zeit [s]')
ylabel_3 = axis_3.set_ylabel('log(Druck)')
T1Logkurve = axis_3.plot(Zeit, logDruckT1, 'gx', label = 'log(Druck T1)')
T2Logkurve = axis_3.plot(Zeit, logDruckT2, 'yx', label = 'log(Druck T2)')
T1Logfit = axis_3.plot(Zeit, T1slope*Zeit+T1intercept, 'g', label= 'Fit T1')
T2Logfit = axis_3.plot(Zeit, T2slope*Zeit+T2intercept, 'y', label= 'Fit T2')
plt.legend(handles=[green_patch,yellow_patch])
T1slope = np.round(T1slope, 5)
T2slope = np.round(T2slope, 5)
T1fitinclination = axis_3.text(175, 5, r'm(T2) = '+str(T1slope))
T2fitinclination = axis_3.text(25, 1, r'm(T1) = '+str(T2slope))
T1Datenpunkte = axis_3.plot()
plt.savefig('../Daten/graph_fit_aufgabe2.pdf')
plt.show()
In [7]:
# we want to calculate the leitwert now
Vs = (5.1*0.28**2*np.pi)/4
print(Vs)
V = 10.6-Vs
print(V)
S_eff = -T2slope*V
print(S_eff)
S = -T1slope*V
print(S)
G = 1/(1./S_eff-1./S)
print(G)
In [8]:
tabellendaten = au.pivot_table(au.messungen)
au.Create_Messdaten_tabellen('../Daten/Aufgabe2Tabelle', au.messgroessen, tabellendaten)