Expand description
§use-radiation
Small radiation physics scalar helpers for RustUse.
§Install
[dependencies]
use-radiation = "0.0.1"§Foundation
use-radiation provides small scalar helpers for radiation intensity, fluence,
absorbed dose, equivalent and effective dose, attenuation, half-value layers,
photon flux, and simple radiation-type classification.
It is not a radiation safety tool, medical dosimetry package, shielding certification tool, transport solver, Monte Carlo engine, or regulatory compliance library.
Inputs are expected to be SI-style numeric values:
- watts for power
- square meters for area
- joules for energy
- kilograms for mass
- gray for absorbed dose
- sieverts for equivalent and effective dose
- seconds for time
- meters for distance and thickness
- inverse meters for linear attenuation coefficient
- square meters per kilogram for mass attenuation coefficient
- kilograms per cubic meter for density
General constants belong in the top-level use-constants set.
Unit abstractions belong in the top-level use-units set.
Broader photon quantum relations belong in use-quantum.
Radioactive decay helpers belong in use-nuclear.
§Example
use use_radiation::{
Dose, RadiationBeam, RadiationKind, Shield, default_radiation_weighting_factor,
};
let beam = RadiationBeam::new(10.0, 2.0).ok_or("expected beam")?;
let shield = Shield::new(core::f64::consts::LN_2, 1.0).ok_or("expected shield")?;
let dose = Dose::new(2.0).ok_or("expected dose")?;
let weighting = default_radiation_weighting_factor(RadiationKind::Gamma)
.ok_or("expected weighting")?;
assert_eq!(beam.intensity(), Some(5.0));
assert!((shield.attenuated_intensity(100.0).ok_or("expected attenuation")? - 50.0).abs() < 1.0e-12);
assert_eq!(dose.equivalent(weighting), Some(2.0));§When to use directly
Choose use-radiation when you only need reusable scalar radiation formulas.
§Scope
- APIs stay
f64-first and dependency-free. - The crate focuses on compact scalar helpers instead of transport or safety workflows.
- Decay chains, isotope catalogs, neutron energy weighting models, and unit systems are out of scope.
§Status
use-radiation is a pre-1.0 crate with a deliberately small API.
Small scalar helpers for radiation physics calculations.
Modules§
Structs§
- Dose
- A simple absorbed dose wrapper in gray.
- Radiation
Beam - A simple beam characterized by total power and illuminated area.
- Shield
- A simple slab shield with a linear attenuation coefficient and thickness.
Enums§
- Radiation
Kind - Simple radiation categories for scalar helper selection.
Constants§
- ELEMENTARY_
CHARGE - Elementary charge in coulombs.
- JOULES_
PER_ MEV - Joules in one mega-electron-volt.
- PLANCK_
CONSTANT - Planck’s constant in joule-seconds.
- SPEED_
OF_ LIGHT - Speed of light in vacuum, in meters per second.
Functions§
- absorbed_
dose - Computes absorbed dose with
D = E / m. - absorbed_
energy_ from_ dose - Computes absorbed energy from dose with
E = D * m. - accumulated_
dose - Computes accumulated dose with
D = dose_rate * t. - attenuated_
intensity - Computes attenuated intensity with
I = I0 * e^(-mu * x). - default_
radiation_ weighting_ factor - Returns a simple conventional radiation weighting factor for the given kind.
- dose_
rate - Computes dose rate with
dose_rate = D / t. - effective_
dose - Computes effective dose with
E = H * w_T. - energy_
fluence - Computes energy fluence with
Psi = E / A. - equivalent_
dose - Computes equivalent dose with
H = D * w_R. - fluence
- Computes fluence with
F = N / A. - fluence_
rate - Computes fluence rate with
fluence_rate = F / t. - half_
value_ layer - Computes half-value layer with
HVL = ln(2) / mu. - intensity
- Computes intensity from power and area with
I = P / A. - inverse_
square_ intensity - Computes inverse-square intensity from a reference value.
- is_
ionizing - Returns whether the listed radiation kind is ionizing in this simple crate.
- is_
particle_ radiation - Returns whether the listed radiation kind is particle radiation.
- is_
photon_ radiation - Returns whether the listed radiation kind is photon radiation.
- isotropic_
intensity - Computes isotropic intensity from power and distance with
I = P / (4 * pi * r^2). - linear_
attenuation_ from_ mass_ attenuation - Computes linear attenuation coefficient from mass attenuation and density.
- mass_
attenuation_ from_ linear_ attenuation - Computes mass attenuation coefficient from linear attenuation and density.
- photon_
energy_ from_ frequency - Computes photon energy from frequency with
E = h * f. - photon_
energy_ from_ wavelength - Computes photon energy from wavelength with
E = h * c / lambda. - photon_
flux_ density - Computes photon flux density with
phi = Phi / A. - photon_
flux_ from_ power - Computes photon flux from power with
Phi = P / E_photon. - required_
shield_ thickness - Computes required shield thickness with
x = ln(I0 / I) / mu. - tenth_
value_ layer - Computes tenth-value layer with
TVL = ln(10) / mu. - total_
effective_ dose - Sums pre-weighted equivalent doses into a total effective dose.
- transmitted_
fraction - Computes transmitted fraction with
T = e^(-mu * x).