2020-05-08 11:26:05 -05:00
|
|
|
from openmc.data import dose_coefficients
|
|
|
|
|
from pytest import approx, raises
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_dose_coefficients():
|
|
|
|
|
# Spot checks on values from ICRP tables
|
|
|
|
|
energy, dose = dose_coefficients('photon', 'AP')
|
2020-09-14 11:12:36 +08:00
|
|
|
assert energy[0] == approx(0.01e6)
|
2020-05-08 11:26:05 -05:00
|
|
|
assert dose[0] == approx(0.0685)
|
2020-09-14 11:12:36 +08:00
|
|
|
assert energy[-1] == approx(10e9)
|
2020-05-08 11:26:05 -05:00
|
|
|
assert dose[-1] == approx(90.4) # updated in corrigendum
|
|
|
|
|
|
|
|
|
|
energy, dose = dose_coefficients('neutron', 'LLAT')
|
2020-09-14 11:12:36 +08:00
|
|
|
assert energy[0] == approx(1e-3)
|
2020-05-08 11:26:05 -05:00
|
|
|
assert dose[0] == approx(1.04)
|
2020-09-14 11:12:36 +08:00
|
|
|
assert energy[-1] == approx(10e9)
|
2020-05-08 11:26:05 -05:00
|
|
|
assert dose[-1] == approx(1.23e3)
|
|
|
|
|
|
|
|
|
|
energy, dose = dose_coefficients('electron', 'ISO')
|
2020-09-14 11:12:36 +08:00
|
|
|
assert energy[0] == approx(0.01e6)
|
2020-05-08 11:26:05 -05:00
|
|
|
assert dose[0] == approx(0.0188)
|
2020-09-14 11:12:36 +08:00
|
|
|
assert energy[-1] == approx(10e9)
|
2020-05-08 11:26:05 -05:00
|
|
|
assert dose[-1] == approx(699.0)
|
|
|
|
|
|
|
|
|
|
# Invalid particle/geometry should raise an exception
|
|
|
|
|
with raises(ValueError):
|
|
|
|
|
dose_coefficients('slime', 'LAT')
|
|
|
|
|
with raises(ValueError):
|
|
|
|
|
dose_coefficients('neutron', 'ZZ')
|