def test_getPhotonEnergyList(self): my_source = source.PointSource(1, 2, 3) my_source.add_isotope_curies('Ar-41', 3.14) my_source.add_isotope_bq('Br-80m', 1E6) my_source.add_photon(0.9876, 3.14E2) a = my_source._get_photon_source_list() np.testing.assert_allclose(a, \ [(0.037052, 390000), \ (0.0489, 3200), \ (0.9876, 314), \ (1.29364, 115204088000.0), \ (1.677, 60413600)])
def test_Case2(self): # a point source with infinite yz shields myModel = model.Model() mySource = source.PointSource(0, 0, 0) mySource.add_photon(1.0, 3e10) myModel.add_source(mySource) myModel.add_shield( shield.SemiInfiniteXSlab(material_name="iron", x_start=10, x_end=20)) myModel.add_detector(detector.Detector(100, 0, 0)) myModel.set_buildup_factor_material(material.Material('iron')) result = myModel.calculate_exposure() assert result == pytest.approx(7.057332942044014e-06 * 1000 * 3600) # convert from R/sec to mR/hr
def test_Case0(self): # point source with no shielding # reference dose calculated from Principles of Radiation Shielding, A. B. Chilton, J. K. Shultis, R. E. Faw myModel = model.Model() mySource = source.PointSource(0, 0, 0) photonEnergy = 1.0 # MeV photonIntensity = 3E10 # photons/sec mySource.add_photon(photonEnergy, photonIntensity) myModel.add_source(mySource) myModel.add_detector(detector.Detector(100, 0, 0)) result = myModel.calculate_exposure() photonFlux = photonIntensity / (4 * math.pi * 100**2 ) # photons/sec/cm2 responseFunction = 1.835E-8 * 1.0 * 2.787E-02 # analyticalDose = photonFlux * responseFunction # R/sec # the "other code" gives 440.1 mR/hr at an air density of 1e-12g/cc assert result == pytest.approx(analyticalDose * 1000 * 3600) # convert from R/sec to mR/hr
def test_Case4(self): # a point source with infinite yz shields myModel = model.Model() mySource = source.PointSource(1, 2, 3) mySource.add_isotope_curies('Co-60', 3) myModel.add_source(mySource) myModel.add_shield( shield.SemiInfiniteXSlab(material_name="iron", x_start=10, x_end=20)) myModel.add_shield( shield.SemiInfiniteXSlab(material_name="concrete", x_start=30, x_end=40)) myModel.add_detector(detector.Detector(80, 90, 100)) myModel.set_buildup_factor_material(material.Material('iron')) result = myModel.calculate_exposure() assert result == pytest.approx( 0.6090081012193129) # convert from R/sec to mR/hr
def test_Case3(self): # a point source with infinite yz shields myModel = model.Model() mySource = source.PointSource(0, 0, 0) mySource.add_isotope_bq('Ar-41', 3e10) myModel.add_source(mySource) myModel.add_shield( shield.SemiInfiniteXSlab(material_name="iron", x_start=10, x_end=20)) myModel.add_shield( shield.SemiInfiniteXSlab(material_name="concrete", x_start=30, x_end=40)) myModel.add_detector(detector.Detector(100, 0, 0)) myModel.set_buildup_factor_material(material.Material('iron')) result = myModel.calculate_exposure() assert result == pytest.approx(4.3979088503738596e-06 * 1000 * 3600) # convert from R/sec to mR/hr
def test_benchmark_0(): my_model = model.Model() my_source = source.PointSource(0, 0, 0) my_source.add_photon(6.2, 1) my_model.add_source(my_source) my_model.set_filler_material('air', density=0.00122) my_model.set_buildup_factor_material(material.Material('air')) print("") print('test_benchmark_0') results = [] for case in [[200, 1.194e-11], [1000, 3.332e-13], [3000, 9.096e-15], [5000, 6.977e-16]]: distance = case[0] expected_dose_rate = case[1] my_model.add_detector( detector.Detector(distance * 12 * 2.54, 0, 57 * 12 * 2.54)) result = my_model.calculate_exposure() diff = (result - expected_dose_rate) / expected_dose_rate * 100 results.append([result, expected_dose_rate]) print("At ", distance, " ft, dose = ", result, " mR/hr, ", diff, "%") assert True
def test_addIsotopeCuries(self): my_source = source.PointSource(1, 2, 3) my_source.add_isotope_curies('Co-60', 3.14) my_source.add_isotope_curies('Cu-11', 8) my_list = [('Co-60', 3.14 * 3.7E10), ('Cu-11', 8 * 3.7E10)] assert my_list == my_source.list_isotopes()
def test_getSourcePoints(self): my_source = source.PointSource(1, 2, 3) np.testing.assert_allclose(my_source._get_source_points(), \ [(1,2,3)])
def test_addPhoton(self): my_source = source.PointSource(1, 2, 3) my_source.add_photon(0.9876, 3.14E2) my_source.add_photon(0.02, 5) my_list = [(0.9876, 3.14E2), (0.02, 5)] assert my_list == my_source.list_discrete_photons()
def test_addIsotopeBq(self): my_source = source.PointSource(1, 2, 3) my_source.add_isotope_bq('Co-60', 3.14E9) my_source.add_isotope_bq('Cs-137', 1E6) my_list = [('Co-60', 3.14E9), ('Cs-137', 1E6)] assert my_list == my_source.list_isotopes()