Skip to main content

Crate use_radiation

Crate use_radiation 

Source
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§

prelude

Structs§

Dose
A simple absorbed dose wrapper in gray.
RadiationBeam
A simple beam characterized by total power and illuminated area.
Shield
A simple slab shield with a linear attenuation coefficient and thickness.

Enums§

RadiationKind
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).