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

41 lines
1.8 KiB
Python

def E_e(E_gamma):
# Takes in a photopeak in MeV, and returns a compton edge in MeV
return E_gamma - E_gamma/(1+2*(E_gamma/0.511))
def E_gammaprime(E_gamma):
# Takes in a photopeak in MeV, and returns a compton edge in MeV
return E_gamma/(1+2*(E_gamma/0.511))
def chan_2_MeV(channel):
#uses the calibration I found in libre office to calculate energy from the channel number
return 6.871e-6 * channel**2 + 1.015e-3*channel + 3.664e-2
print("Experiment 5.2")
print(f'Compton Edge 137Cs Calculated {E_e(0.662):.3f} MeV')
print(f'Compton Edge 137Cs Observed {chan_2_MeV(180):.3f} MeV')
print(f'Percent Error {(E_e(0.662) - chan_2_MeV(180))/E_e(0.662):.3f}')
print(f'Compton Edge 60Co Calculated {E_e(1.33):.3f} MeV')
print(f'Compton Edge 60Co Observed {chan_2_MeV(295):.3f} MeV')
print(f'Percent Error {(E_e(1.33) - chan_2_MeV(295))/E_e(1.33):.3f}')
print("Experiment 5.3")
print(f'Backscattering 137Cs Calculated {E_gammaprime(0.662):.3f} MeV')
print(f'Backscattering 137Cs Observed {chan_2_MeV(92):.3f} MeV')
print(f'Percent Error {(E_gammaprime(0.662) - chan_2_MeV(92))/E_gammaprime(0.662):.3f}')
print(f'Backscattering 1.33 60Co Calculated {E_gammaprime(1.33):.3f} MeV')
print(f'Backscattering 1.3360Co Observed {chan_2_MeV(110):.3f} MeV')
print(f'Percent Error {(E_gammaprime(1.33) - chan_2_MeV(110))/E_gammaprime(1.33):.3f}')
print(f'Backscattering 1.17 60Co Calculated {E_gammaprime(1.17):.3f} MeV')
print(f'Backscattering 1.17 60Co Observed {chan_2_MeV(110):.3f} MeV')
print(f'Percent Error {(E_gammaprime(1.17) - chan_2_MeV(110))/E_gammaprime(1.17):.3f}')
sigma_u1 = 2507
sigma_s1 = 6886
sigma_b = 81
A_u1 = (sigma_u1-sigma_b)/(sigma_s1 - sigma_b) * sigma_s1 / 3.3e10 / 60
print(f'The activity is {A_u1:.3e} Curies')
print(f'The current activity of known is {(sigma_s1-sigma_b)/60/3.3e10}')