Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions libra_toolbox/neutron_detection/activation_foils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
from datetime import datetime


class CheckSource:
nuclide: str
energy: list
intensity: list
activity_date: datetime.date
activity: float
half_life: float

def __init__(
self,
nuclide: str,
energy: list,
intensity: list,
activity_date: datetime.date,
activity: float,
half_life: float,
):
self.nuclide = nuclide
self.energy = energy
self.intensity = intensity
self.activity_date = activity_date
self.activity = activity
self.half_life = half_life

Check warning on line 26 in libra_toolbox/neutron_detection/activation_foils/__init__.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/__init__.py#L21-L26

Added lines #L21 - L26 were not covered by tests


class ActivationFoil:
nuclide: str
mass: float


from . import explicit, settings, calculations
82 changes: 45 additions & 37 deletions libra_toolbox/neutron_detection/activation_foils/calibration.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
import datetime

def get_decay_lines(nuclides:list[str])->dict:
""" Creates dictionary of check source data
given a list of check source nuclides. """
# energy is the gamma energy in units of eV
# intensity is the percentage of decays that result in this energy gamma
all_decay_lines = {'Ba133':{'energy':[80.9979, 276.3989, 302.8508, 356.0129, 383.8485],
'intensity':[0.329, 0.0716, 0.1834, 0.6205, 0.0894],
'half_life':[10.551*365.25*24*3600],
'activity_date':datetime.date(2014, 3, 19),
'activity':1 * 3.7e4},
'Co60':{'energy':[1173.228, 1332.492],
'intensity':[0.9985, 0.999826],
'half_life':[1925.28*24*3600],
'actvity_date':datetime.date(2014, 3, 19),
'activity':0.872 * 3.7e4},
'Na22':{'energy':[511, 1274.537],
'intensity':[1.80, 0.9994],
'half_life':[2.6018*365.25*24*3600],
'actvity_date':datetime.date(2014, 3, 19),
'activity': 5 * 3.7e4},
'Cs137':{'energy':[661.657],
'intensity':[0.851],
'half_life':[30.08*365.25*24*3600],
'actvity_date':datetime.date(2014, 3, 19),
'activity':4.66 * 3.7e4},
'Mn54':{'energy':[834.848],
'intensity':[0.99976],
'half_life':[312.20*24*3600],
'actvity_date':datetime.date(2016, 5, 2),
'activity':6.27 * 3.7e4}}
decay_lines = {}
for nuclide in nuclides:
if nuclide in all_decay_lines.keys():
decay_lines[nuclide] = all_decay_lines[nuclide]
else:
raise ValueError(f'{nuclide} not yet added to get_decay_lines()')
return decay_lines
from libra_toolbox.neutron_detection.activation_foils import CheckSource

Check warning on line 3 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L3

Added line #L3 was not covered by tests

uCi_to_Bq = 3.7e4

Check warning on line 5 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L5

Added line #L5 was not covered by tests

check_source_ba133 = CheckSource(

Check warning on line 7 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L7

Added line #L7 was not covered by tests
nuclide="Ba133",
energy=[80.9979, 276.3989, 302.8508, 356.0129, 383.8485],
intensity=[0.329, 0.0716, 0.1834, 0.6205, 0.0894],
activity_date=datetime.date(2014, 3, 19),
activity=1 * uCi_to_Bq,
half_life=10.551 * 365.25 * 24 * 3600,
)

check_source_co60 = CheckSource(

Check warning on line 16 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L16

Added line #L16 was not covered by tests
nuclide="Co60",
energy=[1173.228, 1332.492],
intensity=[0.9985, 0.999826],
activity_date=datetime.date(2014, 3, 19),
activity=0.872 * uCi_to_Bq,
half_life=1925.28 * 24 * 3600,
)
check_source_na22 = CheckSource(

Check warning on line 24 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L24

Added line #L24 was not covered by tests
nuclide="Na22",
energy=[511, 1274.537],
intensity=[1.80, 0.9994],
activity_date=datetime.date(2014, 3, 19),
activity=5 * uCi_to_Bq,
half_life=2.6018 * 365.25 * 24 * 3600,
)
check_source_cs137 = CheckSource(

Check warning on line 32 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L32

Added line #L32 was not covered by tests
nuclide="Cs137",
energy=[661.657],
intensity=[0.851],
activity_date=datetime.date(2014, 3, 19),
activity=4.66 * uCi_to_Bq,
half_life=30.08 * 365.25 * 24 * 3600,
)
check_source_mn54 = CheckSource(

Check warning on line 40 in libra_toolbox/neutron_detection/activation_foils/calibration.py

View check run for this annotation

Codecov / codecov/patch

libra_toolbox/neutron_detection/activation_foils/calibration.py#L40

Added line #L40 was not covered by tests
nuclide="Mn54",
energy=[834.848],
intensity=[0.99976],
activity_date=datetime.date(2016, 5, 2),
activity=6.27 * uCi_to_Bq,
half_life=312.20 * 24 * 3600,
)
9 changes: 0 additions & 9 deletions test/neutron_detection/test_calibration.py

This file was deleted.

Loading