Radiation
fpc.radiation
radiation.py - radiation physics and radiation protection.
The physics every radiology student meets in the first semester: how x-ray intensity falls off with distance, how a beam is attenuated by tissue and shielding, how a radionuclide decays, and how absorbed dose [Gy] is turned into the protection quantities equivalent dose and effective dose [Sv].
All the protection weighting factors come from ICRP Publication 103 (2007), which is the basis of current regulations in most countries.
These are teaching calculations. They are NOT a substitute for a qualified medical physicist, a validated dosimetry system, or your local regulations.
Radiation
Radiation physics, attenuation, decay, and dosimetry calculations.
Source code in fpc/radiation.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
inverse_square_law(*, initial_intensity, initial_distance, new_distance)
Intensity at a new distance from a point source.
Radiation spreads over a sphere whose area grows with r^2, so intensity falls as 1/r^2: I2 = I1 * (d1 / d2)^2. Doubling your distance from the tube cuts your exposure to one quarter - the cheapest protection there is.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_intensity
|
intensity (or exposure / dose rate) at d1, any unit |
required | |
initial_distance
|
original distance d1 (any length unit) |
required | |
new_distance
|
new distance d2 (same unit as d1) |
required |
Returns:
| Type | Description |
|---|---|
|
intensity at d2, in the same unit as |
Source code in fpc/radiation.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
transmitted_intensity(*, initial_intensity, attenuation_coefficient, thickness)
Narrow-beam (Beer-Lambert) attenuation: I = I0 * exp(-mu * x).
Each thin slab of material removes the same FRACTION of the photons that reach it, which is why the curve is exponential, not linear.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_intensity
|
incident intensity I0 (any unit) |
required | |
attenuation_coefficient
|
linear attenuation coefficient mu [1/cm] |
required | |
thickness
|
material thickness x [cm] |
required |
Returns:
| Type | Description |
|---|---|
|
transmitted intensity, same unit as I0 |
Source code in fpc/radiation.py
80 81 82 83 84 85 86 87 88 89 90 91 | |
linear_attenuation_coefficient(*, mass_attenuation_coefficient, density)
Linear coefficient mu [1/cm] from mass coefficient mu/rho [cm^2/g].
Tables (e.g. NIST XCOM) list mu/rho because it does not depend on the material's physical state; multiply by density to get mu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mass_attenuation_coefficient
|
mu/rho [cm^2/g] |
required | |
density
|
rho [g/cm^3] |
required |
Returns:
| Type | Description |
|---|---|
|
mu [1/cm] |
Source code in fpc/radiation.py
93 94 95 96 97 98 99 100 101 102 103 | |
half_value_layer(*, attenuation_coefficient)
Half-value layer HVL = ln(2) / mu.
The thickness that cuts the beam intensity in half. Clinically the HVL (in mm of aluminium) is how beam QUALITY is specified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attenuation_coefficient
|
mu [1/cm] |
required |
Returns:
| Type | Description |
|---|---|
|
HVL [cm] |
Source code in fpc/radiation.py
105 106 107 108 109 110 111 112 113 114 | |
tenth_value_layer(*, attenuation_coefficient)
Tenth-value layer TVL = ln(10) / mu (~3.32 HVLs).
Shielding designers prefer TVLs: each one cuts intensity by 10x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attenuation_coefficient
|
mu [1/cm] |
required |
Returns:
| Type | Description |
|---|---|
|
TVL [cm] |
Source code in fpc/radiation.py
116 117 118 119 120 121 122 123 124 | |
shielding_thickness(*, attenuation_coefficient, transmission)
Thickness needed to let only a given fraction of the beam through.
Solve I/I0 = exp(-mu*x) for x: x = -ln(T) / mu.
Note: real shielding has scatter "build-up", so true broad-beam barriers must be thicker than this narrow-beam estimate (see NCRP Report 147).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attenuation_coefficient
|
mu [1/cm] |
required | |
transmission
|
desired transmitted fraction T, 0 < T <= 1 |
required |
Returns:
| Type | Description |
|---|---|
|
required thickness [cm] |
Source code in fpc/radiation.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
photon_wavelength(*, energy_kev)
Photon wavelength from energy: lambda = h*c / E.
Applied to the tube voltage this gives the Duane-Hunt minimum wavelength: a 100 kVp beam contains no photon above 100 keV, so no wavelength shorter than ~0.0124 nm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
energy_kev
|
photon energy [keV] |
required |
Returns:
| Type | Description |
|---|---|
|
wavelength [nm] |
Source code in fpc/radiation.py
145 146 147 148 149 150 151 152 153 154 155 | |
decay_constant(*, half_life)
Decay constant lambda = ln(2) / T_half.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
half_life
|
physical half-life (any time unit) |
required |
Returns:
| Type | Description |
|---|---|
|
decay constant [1 / that time unit] |
Source code in fpc/radiation.py
160 161 162 163 164 165 166 | |
remaining_activity(*, initial_activity, half_life, elapsed_time)
Activity left after decay: A = A0 * exp(-lambda * t).
Used daily in nuclear medicine to work out how much of a dose is left at injection time (e.g. Tc-99m, T_half = 6.01 h).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_activity
|
A0 (MBq, mCi, ...) |
required | |
half_life
|
half-life (any time unit) |
required | |
elapsed_time
|
elapsed time (same unit as half_life) |
required |
Returns:
| Type | Description |
|---|---|
|
remaining activity, same unit as A0 |
Source code in fpc/radiation.py
168 169 170 171 172 173 174 175 176 177 178 179 180 | |
effective_half_life(*, physical_half_life, biological_half_life)
Effective half-life in the body: 1/Te = 1/Tp + 1/Tb.
A radiopharmaceutical leaves the patient two ways at once - it decays (physical) AND is excreted (biological) - so the rates add, and the effective half-life is always shorter than either one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
physical_half_life
|
Tp (any time unit) |
required | |
biological_half_life
|
Tb (same unit) |
required |
Returns:
| Type | Description |
|---|---|
|
effective half-life Te (same unit) |
Source code in fpc/radiation.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
neutron_weighting_factor(*, energy_mev)
ICRP 103 continuous radiation weighting factor for neutrons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
energy_mev
|
neutron energy [MeV] |
required |
Returns:
| Type | Description |
|---|---|
|
w_R [-] (peaks at ~20 around 1 MeV) |
Source code in fpc/radiation.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
equivalent_dose(*, absorbed_dose, radiation_type)
Equivalent dose H_T = w_R * D_T.
Absorbed dose (Gy = J/kg) says how much energy was deposited; the weighting factor accounts for how biologically damaging that type of radiation is. 1 Gy of alpha harms tissue ~20x more than 1 Gy of x-rays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
absorbed_dose
|
absorbed dose D [Gy] |
required | |
radiation_type
|
key of :attr: |
required |
Returns:
| Type | Description |
|---|---|
|
equivalent dose [Sv] |
Source code in fpc/radiation.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
effective_dose(*, organ_equivalent_doses)
Effective dose E = sum over organs of w_T * H_T.
Lets you compare a chest x-ray with a head CT on one risk-related scale. It is a POPULATION protection quantity - not an individual patient's risk estimate.
Organs you leave out contribute nothing, so this naturally handles a partial-body exposure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
organ_equivalent_doses
|
dict {organ: H_T [Sv]}, organs named as
in :attr: |
required |
Returns:
| Type | Description |
|---|---|
|
effective dose [Sv] |
Source code in fpc/radiation.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |