-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from SiLab-Bonn/development
v1.1
- Loading branch information
Showing
6 changed files
with
204 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
import unittest | ||
import logging | ||
import math | ||
import irrad_spectroscopy.physics as physics | ||
|
||
|
||
class TestPhysics(unittest.TestCase): | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
|
||
# Reference results from http://www.radprocalculator.com/Gamma.aspx @ 09/08/2022 | ||
cls.isotope_dose_rates = {'65_Zn': {'kwargs': {'distance': 10, # cm | ||
'material': 'air', | ||
'activity': 1e6}, # Bq | ||
'result': 7.32721329726743}, # uSv/h | ||
|
||
'58_Co': {'kwargs': {'distance': 10, # cm | ||
'material': 'air', | ||
'activity': 1e6}, # Bq | ||
'result': 12.7792816179285}, # uSv/h | ||
|
||
'133_Ba': {'kwargs': {'distance': 10, # cm | ||
'material': 'air', | ||
'activity': 1e6}, # Bq | ||
'result': 4.73961723205635}, | ||
|
||
'241_Am': {'kwargs': {'distance': 10, # cm | ||
'material': 'air', | ||
'activity': 1e6}, # Bq | ||
'result': 0.39675657840774}, | ||
|
||
'177_Lu': {'kwargs': {'distance': 10, # cm | ||
'material': 'air', | ||
'activity': 1e6}, # Bq | ||
'result': 0.363019036969211}, | ||
|
||
'40_K': {'kwargs': {'distance': 10, # cm | ||
'material': 'air', | ||
'activity': 1e6}, # Bq | ||
'result': 1.84849188821643}, | ||
# FIXME: 22-Na does not work!? -> function here give ~16 uSv/hr vs. 28 uSv/hr from reference | ||
#'22_Na': {'kwargs': {'distance': 10, # cm | ||
# 'material': 'air', | ||
# 'activity': 1e6}, # Bq | ||
# 'result': 28.0833913452004}, | ||
} | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
pass | ||
|
||
def test_gamma_dose_rate(self): | ||
pass | ||
|
||
def test_isotope_dose_rate(self): | ||
|
||
for isotope, data in self.isotope_dose_rates.items(): | ||
test_result = physics.isotope_dose_rate(isotope=isotope, **data['kwargs'])[isotope] | ||
assert math.isclose(test_result, data['result'], rel_tol=0.20) # Check with 20% tolerance (this is no exact science anyway ;) ) | ||
|
||
def test_fluence_from_activity(self): | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - [%(levelname)-8s] (%(threadName)-10s) %(message)s") | ||
suite = unittest.TestLoader().loadTestsFromTestCase(TestPhysics) | ||
unittest.TextTestRunner(verbosity=2).run(suite) |
Oops, something went wrong.