| empirical_attenuation_splines | ||
| media | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
| setup.py | ||
Package providing attenuation coefficients for radiation
Provides empirical estimates based on measurement (Vogt) of various radiation types (emission by nuclides, 511 keV photon) through diverse materials.
Based on Raphaël's Excel sheet. Log-interpolates between values.
Installation
On Windows in our organization:
- Download the zip file of this repository using the Download button at the top right of the file list (3-dots menu)
- Unzip it somewhere on your computer
- With the Anaconda prompt program, cd to the unziped directory.
- run `python setup.py install'.
On normal computers: From the desired python environment:
# clone the repo:
git clone https://git.fdux.ch/fred/empirical_attenuation_splines.git
# pip install it
cd empirical_attenuation_splines/
pip install .
Usage
Basic usage
Import the main functionality like this:
from empirical_attenuation_splines import load_attenuation_model
A model is loaded by passing the desired nuclide and material. Next, passing it depths in centimeters will yield attenuation values:
model = load_attenuation_model('Lu-177', 'lead')
model(0.5) # attenuation after crossing a 0.5cm lead barrier
# output: array(79.69497177)
We can pass several values at once:
model([0., 0.1, 0.2, 0.3]) # attenuation factor at various depths
# output: array([ 1., 2.87455444, 7.12654913, 16.81495093])
The model interpolates in log-space between the empirical values.
We can also rescale our material by changing its density:
model_concrete = load_attenuation_model('I-131', 'concrete')
model_brick = model_concrete.rescale_density(1.2)
model_brick(20.0)
# output: array(1.85511651)
By the way, we can compare it to Raphaël's original excel sheet, which contained some rescaled materials:
model_brick = load_attenuation_model('I-131', 'brick_scaled_from_concrete')
model_brick(20.0)
# output: array(1.85511651)
Indeed the same value again, as expected since both Raphaël and this package rescale the distance by the ratio of densities before calculating the attenuation.
Compare to original data
Load the data on which the splines were fitted like this:
from empirical_attenuation_splines import get_original_empirical_data
data = get_original_empirical_data('Lu-177', 'lead')
data.head()
| d_cm | F | |
|---|---|---|
| 0 | 0.000 | 1.000000 |
| 1 | 0.005 | 1.055309 |
| 2 | 0.010 | 1.116408 |
| 3 | 0.015 | 1.185227 |
| 4 | 0.020 | 1.257593 |
We can now visualize how our spline stands versus the original data
import numpy as np
import matplotlib.pyplot as plt
x_interp = np.logspace(-2.5, np.log10(1.2*np.max(data['d_cm'])), 100)
F_interp = model(x_interp)
plt.figure(figsize=(16,8))
plt.plot(x_interp, F_interp)
plt.loglog(data['d_cm'], data['F'], 'x')
plt.xlabel('depth / cm')
plt.ylabel('Attenuation factor: Lu-177 gamma through lead');
