y_current_4 = m.gimmeTHATcolumn(d.anode_4,1) x_volt_5 = m.gimmeTHATcolumn(d.anode_5,0) y_current_5 = m.gimmeTHATcolumn(d.anode_5,1) x_volt_langmuh = m.gimmeTHATcolumn(d.anode_langmuh,0) y_current_langmuh = m.gimmeTHATcolumn(d.anode_langmuh,1) print(x_volt_1) print(y_current_1) #plot.plot4(x_volt_langmuh,y_current_langmuh, "Anodenspannung in $V$","Anodenstrom in $\mu A$","../plots/anode1.pdf", None) plot.plot4(x_volt_5,y_current_5, "Anodenspannung in $V$","Anodenstrom in $ A$","../plots/anode1.pdf", None) plot.plot5(x_volt_4,y_current_4, "Anodenspannung in $V$","Anodenstrom in $ A$","../plots/anode1.pdf", None) plot.plot3(x_volt_3,y_current_3, "Anodenspannung in $V$","Anodenstrom in $ A$","../plots/anode1.pdf", None) plot.plot(x_volt_2,y_current_2, "Anodenspannung in $V$","Anodenstrom in $ A$","../plots/anode1.pdf", None) plot.plot2(x_volt_1,y_current_1, "Anodenspannung in $V$","Anodenstrom in $ A$","../plots/anode1.pdf", None) for i in range(5): plt.axhline(m.saturation_current[i], linewidth=0.2, color='c') plt.savefig('../plots/anode1.pdf') plt.clf() plt.clf() #plot.plot([0,5,9,12,15,22],m.q_gone_korr, "Teilchennummer","Korrigierte Ladung $q / C$","../plots/ladung2.pdf", None) plot.log_plot(x_volt_1,y_current_1, "Logarithmierte Anodenspannung $\ln(U)$","Logarithmierter Anodenstrom $\ln(\mu A)$","../plots/raum.pdf", None) x_flow = np.linspace(1,3,1000)
return noise_level + scale * 1 / sqrt(2 * pi * sigma) * exp(-(x - mu)**2 / 2 / sigma**2) initial_guess = [36e3, 100, 10, 0.1] params, quality = simplex.optimize(d.amplifier_f, d.amplifier_U, gaus, p0=initial_guess) fit = lambda x: gaus(x, *params) U_max = max(d.amplifier_U) U_half = U_max / sqrt(2) f_with_max_U = d.amplifier_f[argwhere(d.amplifier_U == U_max)] half_U_freq_left = optimize.brentq(lambda x: fit(x) - U_half, 34e3, f_with_max_U) half_U_freq_right = optimize.brentq(lambda x: fit(x) - U_half, f_with_max_U, 38e3) Q_exp = f_with_max_U / (half_U_freq_right - half_U_freq_left) print("Bandpass Quality:", Q_exp) plot.plot(d.amplifier_f, d.amplifier_U, "Frequenz in kHz", "Durchgelassene Spannung in V", "amplifier.pdf", fit) # Calculating CHI from measurements def χ_voltage(sample_voltage, sample_cross_section): """Uses bridge's difference in voltage""" # 'Exact' Formular doesn't lead to significantly better results # f = 35.16e3 # omega = 2 * pi * f # radicant = d.coil_res + omega**2 * (mu_0 * d.coil_n**2 / d.coil_lenght * d.coil_cross_secion)**2 # return sample_voltage / d.voltage_in * 4 * d.coil_lenght / omega / mu_0 / d.coil_n**2 / sample_cross_section * sqrt(radicant) # Approximation Formular return sample_voltage / (d.voltage_in) * 4 * d.coil_cross_secion / sample_cross_section
d.amplifier_U, gaus, p0=initial_guess) fit = lambda x: gaus(x, *params) U_max = max(d.amplifier_U) U_half = U_max / sqrt(2) f_with_max_U = d.amplifier_f[argwhere(d.amplifier_U == U_max)] half_U_freq_left = optimize.brentq(lambda x: fit(x) - U_half, 34e3, f_with_max_U) half_U_freq_right = optimize.brentq(lambda x: fit(x) - U_half, f_with_max_U, 38e3) Q_exp = f_with_max_U / (half_U_freq_right - half_U_freq_left) print("Bandpass Quality:", Q_exp) plot.plot(d.amplifier_f, d.amplifier_U, "Frequenz in kHz", "Durchgelassene Spannung in V", "amplifier.pdf", fit) # Calculating CHI from measurements def χ_voltage(sample_voltage, sample_cross_section): """Uses bridge's difference in voltage""" # 'Exact' Formular doesn't lead to significantly better results # f = 35.16e3 # omega = 2 * pi * f # radicant = d.coil_res + omega**2 * (mu_0 * d.coil_n**2 / d.coil_lenght * d.coil_cross_secion)**2 # return sample_voltage / d.voltage_in * 4 * d.coil_lenght / omega / mu_0 / d.coil_n**2 / sample_cross_section * sqrt(radicant) # Approximation Formular return sample_voltage / ( d.voltage_in) * 4 * d.coil_cross_secion / sample_cross_section
import numpy as np from uncertainties.unumpy import uarray import data import helpers as hel import plot_helpers as plot import main as m import functions as f import matplotlib as mpl import matplotlib.pyplot as plt #plot.plot(range(len(m.q)),m.q, "Teilchennummer","Ladung","../plots/ladung.pdf", None) #plot.plot(range(len(m.q_korr)),m.q_korr, "Teilchennummer","Korrigierte Ladung in C","../plots/ladung2.pdf", None) plot.plot2(range(len(m.q_new_korr)),m.q_new_korr, "Teilchennummer","Korrigierte Ladung $q / C$","../plots/ladung2.pdf", None) plot.plot([0,5,9,12,15,22],m.q_gone_korr, "Teilchennummer","Korrigierte Ladung $q / C$","../plots/ladung2.pdf", None) x,y = plot.extract_error(m.q_korr) x2,y2 = plot.extract_error(m.q) x3,y3 = plot.extract_error(m.q_new) x4,y4 = plot.extract_error(m.q_new_korr) bla = range(39, 45) print(bla) #plt.plot([0,12,22],m.q_gone_korr, 'r.') plt.plot(np.linspace(0,0.1,len(x4)),x4,'m.') #plt.plot(range(len(x2)),x2, 'b.') #hahaha korrektur macht zero unterschied -.- #plt.plot(range(len(x3)),x3, 'm.') #gemittelte Teilchen