################### # Operating point # ################### delta_V_4 = hp.fetch2('data/operating_point.xlsx', 'err V_4 [mV]') V_4 = hp.fetch2('data/operating_point.xlsx', 'V_4 [mV]', delta_V_4)/1000 delta_I = hp.fetch2('data/operating_point.xlsx', 'err I [mu A]') I = hp.fetch2('data/operating_point.xlsx', 'I [mu A]', delta_I)/10**6 T = hp.fetch2('data/operating_point.xlsx', 'T [°C]', 0.1) R_S = V_4/I fig, ax1 = plt.subplots() ax1.errorbar(hp.nominal(I)*10**3, hp.nominal(T), fmt='b.', xerr=hp.stddev(I)*10**3, yerr=hp.stddev(T)) ax1.set_xlabel('Current $I \, [mA]$') ax1.set_ylabel('Temperature $T \, [^{\circ}C]$', color='b') ax1.tick_params('y', colors='b') ax2 = ax1.twinx() ax2.errorbar([100000], [1000000], fmt='b.', xerr=0, yerr=0, label="measured temperature") # dummy for the label ax2.errorbar(hp.nominal(I)*10**3, hp.nominal(R_S)/1000, fmt='r.', xerr=hp.stddev(I)*10**3, yerr=hp.stddev(R_S)/1000, label="measured resistance") ax2.set_ylabel('Resistance $R_S \, [k\Omega]$', color='r') ax2.tick_params('y', colors='r') I_Op = 0.4007 V_2_Op = 3.250 hp.replace("I_Op", I_Op) hp.replace("V_2_Op", V_2_Op)
p2 = lambda x: np.polyval(coeffs2, x) x2 = np.linspace(0, 18, 100) coeffs3 = hp.phpolyfit(I_mean, deltaTplus + deltaTminus, 2) p3 = lambda x: np.polyval(coeffs3, x) x3 = np.linspace(0, 18, 100) coeffs4 = hp.phpolyfit(I, deltaT, 2) p4 = lambda x: np.polyval(coeffs4, x) x4 = np.linspace(-18, 18, 100) ### PLOTS ### # I - Pi12V plt.figure(0) plt.errorbar(hp.nominal(I_mean), hp.nominal(Pi12V) * 10**3, xerr=hp.stddev(I_mean), yerr=hp.stddev(Pi12V) * 10**3, label=r'' + Temp + '°C') plt.ylabel(r'$\Pi_{12}^{(V)}$ [mV]') # I - Pi12I plt.figure(1) plt.errorbar(hp.nominal(I_mean), hp.nominal(Pi12I) * 10**3, xerr=hp.stddev(I_mean), yerr=hp.stddev(Pi12I) * 10**3, label=r'' + Temp + '°C') plt.ylabel(r'$\Pi_{12}^{(I)}$ [mV]')
Pi12V = 0.5 * V_p_mean * (deltaTplus - deltaTminus) / (deltaTplus + deltaTminus) Pi12I = ( (k_1(T_b) * F_1) / L_1 + (k_2(T_b) * F_2) / L_2) * (deltaTplus - deltaTminus) / (2 * I_mean) # some fitlines for the plots coeffs2 = hp.phpolyfit(I_mean, deltaTplus - deltaTminus, 1) p2 = lambda x: np.polyval(coeffs2, x) x2 = np.linspace(0, 18, 100) ### PLOTS ### # I - Pi12V plt.figure(0) plt.errorbar(hp.nominal(I_mean), hp.nominal(Pi12V) * 10**3, xerr=hp.stddev(I_mean), yerr=hp.stddev(Pi12V) * 10**3, label=r'' + Temp + '°C') plt.ylabel(r'$\Pi_{12}^{(V)}$ [mV]') # I - Pi12I plt.figure(1) plt.errorbar(hp.nominal(I_mean), hp.nominal(Pi12I) * 10**3, xerr=hp.stddev(I_mean), yerr=hp.stddev(Pi12I) * 10**3, label=r'' + Temp + '°C') plt.ylabel(r'$\Pi_{12}^{(I)}$ [mV]')
hp.replace("time_readoff_error", hp.physical(time_readoff_error, 0, 1)) hp.replace("x_readoff_error", hp.physical(x_readoff_error * 100, 0, 1)) hp.replace("delta_turns", hp.physical(delta_turns, 0, 1)) # erf fit def erf_param(x, a, b, c, d): return (np.vectorize(lambda x, a, b, c, d: a * erf(b * x + c) + d)(x, a, b, c, d)) guess_a, guess_b, guess_c, guess_d = -20.0, 1.2, -3.5, 20.0 # erf() guesses = np.array([guess_a, guess_b, guess_c, guess_d]) popt, pcov = curve_fit(erf_param, hp.nominal(turns), hp.nominal(ctps), p0=guesses, sigma=hp.stddev(ctps), absolute_sigma=True) aerr, berr, cerr, derr = list(np.sqrt(np.diag(pcov))) a, b, c, d = list(popt) erf_fit = lambda x: np.vectorize(lambda x: a * erf(b * x + c) + d)(x) # parameters of the erf fit hp.replace("fit:erf_a", hp.physical(a, aerr, 4)) hp.replace("fit:erf_b", hp.physical(b, berr, 4)) hp.replace("fit:erf_c", hp.physical(c, cerr, 4)) hp.replace("fit:erf_d", hp.physical(d, derr, 4)) X = np.linspace(0, 6, 500)
hp.physical(peak_yvalue('eu152', 'NaI', 1408.08), 0, 3)) hp.replace("eu_HPGe_peak_y", hp.physical(peak_yvalue('eu152_ged', 'HPGe', 1408.08), 0, 3)) if run['dose rate']: print("calculating dose rate ...") x = hp.fetch2('data/doserate.xlsx', 'x [cm]', 1) / 100 A = hp.fetch2('data/doserate.xlsx', 'A [muSv/hr]', 0.2) A[10].sf = 1 def invsq_param(x, a): return (np.vectorize(lambda x, a: a / (x**2))(x, a)) fit_x = hp.nominal(x) fit_x[0] = 10**-10 # "very" small => "zero" guesses = np.array([0.0207]) popt, pcov = curve_fit(invsq_param, fit_x, hp.nominal(A), p0=guesses, sigma=hp.stddev(A), absolute_sigma=True) aerr = list(np.sqrt(np.diag(pcov))) #a = list(popt) a = popt[0] invsq_fit = lambda x: np.vectorize(lambda x: 0.02 / (x**2))(x) X = np.linspace(0.001, 2.2, 500)