def test_getSourcePoints(self): my_source = source.LineSource([1, 2, 3], [11, 12, 13]) np.testing.assert_allclose(my_source._get_source_points(), \ [[ 1.5, 2.5, 3.5], \ [ 2.5, 3.5, 4.5], \ [ 3.5, 4.5, 5.5], \ [ 4.5, 5.5, 6.5], \ [ 5.5, 6.5, 7.5], \ [ 6.5, 7.5, 8.5], \ [ 7.5, 8.5, 9.5], \ [ 8.5, 9.5,10.5], \ [ 9.5,10.5,11.5], \ [10.5,11.5,12.5]])
def test_getPhotonEnergyList(self): my_source = source.LineSource([1, 2, 3], [11, 12, 13]) 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() # the following intensities are adjusted for the default 10 # intervals in the line source np.testing.assert_allclose(a, \ [(0.037052, 390000/10), \ (0.0489, 3200/10), \ (0.9876, 314/10), \ (1.29364, 115204088000.0/10), \ (1.677, 60413600/10)])
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 # from the reference, pages 132, 157, and 159, th dose rate is 64.66 mR/hr # Microshield gives 64.74 mR/hr at an air density of 1e-12g/cc myModel = model.Model() mySource = source.LineSource([0, 0, 0], [0, 0, 1000]) mySource.points_per_dimension = 100 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() linearPhotonSource = photonIntensity / 1000 photonFlux = linearPhotonSource / 100 * math.atan( 1000 / 100) # photons/sec/cm2 responseFunction = 1.835E-8 * 1.0 * 2.787E-02 / 4 / math.pi # analyticalDose = photonFlux * responseFunction # R/sec assert result == pytest.approx(analyticalDose * 1000 * 3600) # convert from R/sec to mR/hr
def test_addPhoton(self): my_source = source.LineSource([1, 2, 3], [11, 12, 13]) 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.LineSource([1, 2, 3], [11, 12, 13]) 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()
def test_addIsotopeCuries(self): my_source = source.LineSource([1, 2, 3], [11, 12, 13]) 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()