Class_Work/NUCE_2113/lab6/quick_maths.py
2025-04-17 12:28:55 -04:00

90 lines
2.0 KiB
Python

print("Experiment 6.1\n")
measured_activity = 5.2e-6 # curies
elapsed_time = 193.92 # s
sigma_u1 = 35331 # counts
background_time = 193.94 # s
sigma_b = 558 # counts
R = sigma_u1 / elapsed_time - sigma_b / background_time
print(f"R: {R:.3e} counts / s")
print(f"R: {R/3.7e10*1e6:.3e} microcurie")
eps_ip = 0.101 # from figure 6.2
f = 0.6617
d = 100 # mm
r = 38 / 2 # mm
G = r**2 / 4 / d**2
A = R / eps_ip / G / f
print(f"G: {G:.3e}")
print(f"A: {A:.3e} decays / s")
print(f"A: {A/3.7e10*1e6:.3e} microcurie")
A = 4.5 * 3.7e10 / 1e6
eps_ip_est = R / A / G / f
print(f"eps_ips: {eps_ip_est:.3e}")
sigma_u1 = [10122, 11763, 14464, 17476, 22073, 28268, 38084]
sigma_b = 130
d = [100, 90, 80, 70, 60, 50, 40]
t = 60 # s
import numpy as np
n = len(sigma_u1)
R = np.empty(n)
G = np.empty(n)
eps_ip = np.empty(n)
for i, value in enumerate(sigma_u1):
print(i, value)
R[i] = (value - sigma_b) / t
G[i] = r**2 / 4 / d[i] ** 2
eps_ip[i] = R[i] / A / G[i] / f
print("R")
print(R.transpose())
print("G")
print(G.transpose())
print("eps_ip")
print(eps_ip.transpose())
import matplotlib.pyplot as plt
plt.plot(d, eps_ip, ".b")
plt.xlabel("Distance [mm]")
plt.ylabel("$\epsilon_{ip}$")
plt.grid("both")
plt.savefig("exercise6_4.png")
# plt.show()
print("Experiment 6.3")
peak_1 = 234484 # counts
peak_2 = 169703 # counts
sum_peak = 950 # counts
t = 1129.16 #
activity = 0.4e-6 # Ci
activity = activity * 3.7e10 # disintegrations / second
time_to_manufacture = 12 + 1 / 12 # years
t_one_half = 5.27 # years
## find decay
activity_corrected = activity * np.exp(-np.log(2) / t_one_half * time_to_manufacture)
d = 15 # mm
r = 38 / 2 # mm
G = r**2 / 4 / d**2
f = 1
eps_1 = peak_1 / G / f / activity_corrected / t
eps_2 = peak_2 / G / f / activity_corrected / t
sum_peak_pred = G**2 * t * activity_corrected * eps_1 * eps_2
print(f"eps_1: {eps_1:.3e}")
print(f"eps_2: {eps_2:.3e}")
print(f"G: {G:.3e}")
print(f"Experimental sum peak: {sum_peak:.3e}")
print(f"Predicted sum peak: {sum_peak_pred:.3e}")
print(f"Percent error: {(sum_peak_pred-sum_peak)/sum_peak}")