Created
December 9, 2022 07:52
-
-
Save dev-opus/c52f5edc089feee423646702c64a2f4c to your computer and use it in GitHub Desktop.
This Gist holds a Python script that was used in computing the Mass Attenuation Coefficient of samples used for my final year project work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import statistics as stat | |
import math | |
def computeIntensity(list): | |
readings = [x * 1000 for x in list] | |
intensity = stat.mean(readings) - bg_intensity | |
return intensity | |
def computeMac(intensity, thickness, density): | |
mass_thickness = density * thickness | |
ln_of_intensities = math.log(intensity / incident_intensity) | |
mac = -(ln_of_intensities / mass_thickness) | |
return mac | |
bg_readings = [6, 12, 17, 15, 12, 6, 17, 7, 7, 11] | |
bg_intensity = stat.mean(bg_readings) | |
incident_intensity = computeIntensity( | |
[ | |
20.40, | |
23.01, | |
22.58, | |
22.68, | |
22.96, | |
22.58, | |
23.07, | |
22.67, | |
22.23, | |
20.58, | |
] | |
) | |
asbestos_intensity_ta = computeIntensity( | |
[13.97, 13.10, 14.23, 14.32, 13.07, 14.56, 14.43, 14.17, 14.45, 14.12] | |
) | |
asbestos_mac_ta = computeMac(asbestos_intensity_ta, 0.328, 1.72) | |
print("mac asbestos ta = " + str(asbestos_mac_ta)) | |
asbestos_intensity_m3 = computeIntensity( | |
[ | |
14.25, | |
13.95, | |
14.59, | |
12.39, | |
14.35, | |
14.56, | |
14.64, | |
14.74, | |
14.57, | |
14.44, | |
] | |
) | |
asbestos_mac_m3 = computeMac(asbestos_intensity_m3, 0.407, 1.56) | |
print("mac asbestos m3 = " + str(asbestos_mac_m3)) | |
pipe_intensity_ta = computeIntensity( | |
[ | |
12.93, | |
13.36, | |
13.38, | |
13.19, | |
13.36, | |
13.63, | |
12.87, | |
13.43, | |
13.40, | |
13.45, | |
] | |
) | |
pipe_mac_ta = computeMac(pipe_intensity_ta, 0.0800, 1.10) | |
print("mac pipe ta = " + str(pipe_mac_ta)) | |
pipe_intensity_m3 = computeIntensity( | |
[ | |
11.18, | |
11.14, | |
11.46, | |
11.35, | |
11.22, | |
11.23, | |
11.52, | |
11.27, | |
11.36, | |
11.08, | |
] | |
) | |
pipe_mac_m3 = computeMac(pipe_intensity_m3, 0.0770, 1.47) | |
print("mac pipe m3 = " + str(pipe_mac_m3)) | |
cement_intensity_ta = computeIntensity( | |
[ | |
5.126, | |
5.192, | |
5.261, | |
5.060, | |
5.151, | |
5.065, | |
5.222, | |
5.120, | |
5.021, | |
4.887, | |
] | |
) | |
cement_mac_ta = computeMac(cement_intensity_ta, 1.5, 2.34) | |
print("mac cement ta = " + str(cement_mac_ta)) | |
cement_intensity_m3 = computeIntensity( | |
[ | |
5.259, | |
5.057, | |
5.352, | |
5.366, | |
5.068, | |
5.101, | |
5.263, | |
4.872, | |
5.135, | |
5.338, | |
] | |
) | |
cement_mac_m3 = computeMac(cement_intensity_m3, 1.7, 3.23) | |
print("mac cement m3 = " + str(cement_mac_m3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment