mirror of
https://github.com/pim-n/pg-rad
synced 2026-03-10 19:48:12 +01:00
add tests for fluence rate and attenuation interpolation
This commit is contained in:
30
tests/test_attenuation_functions.py
Normal file
30
tests/test_attenuation_functions.py
Normal file
@ -0,0 +1,30 @@
|
||||
import pytest
|
||||
|
||||
from pg_rad.physics import get_mass_attenuation_coeff
|
||||
|
||||
|
||||
@pytest.mark.parametrize("energy,mu", [
|
||||
(1.00000E-03, 3.606E+03),
|
||||
(1.00000E-02, 5.120E+00),
|
||||
(1.00000E-01, 1.541E-01),
|
||||
(1.00000E+00, 6.358E-02),
|
||||
(1.00000E+01, 2.045E-02)
|
||||
])
|
||||
def test_exact_attenuation_retrieval(energy, mu):
|
||||
"""
|
||||
Test if retrieval of values that are exactly in the table is correct.
|
||||
"""
|
||||
func_mu = get_mass_attenuation_coeff(energy)
|
||||
assert pytest.approx(func_mu, rel=1E-6) == mu
|
||||
|
||||
|
||||
@pytest.mark.parametrize("energy,mu", [
|
||||
(0.662, 0.0778),
|
||||
(1.25, 0.06)
|
||||
])
|
||||
def test_attenuation_interpolation(energy, mu):
|
||||
"""
|
||||
Test Cs-137 and Co-60 mass attenuation coefficients.
|
||||
"""
|
||||
interp_mu = get_mass_attenuation_coeff(energy)
|
||||
assert pytest.approx(interp_mu, rel=1E-2) == mu
|
||||
Reference in New Issue
Block a user