printscintfd.py
Go to the documentation of this file.
1 from air import air_composition
2 from scint import scint_composition_early, scint_composition_late
3 from util import (elemlist, zoveramaterial, print_composition)
4 
5 compositions = {
6  'air' : air_composition(),
7  'scint early': scint_composition_early(),
8  'scint late' : scint_composition_late(),
9 }
10 fractions = {
11  # Mix in 300kg of air for the otherwise-unmodeled air bubbles.
12  # Distinct from dissolved gasses!
13  'air' : 300,
14  'scint early': 760497,
15  'scint late' : 7935040,
16 }
17 
18 def tot_weight(compos):
19  weight = 0
20  for element, number in compos.items():
21  weight += number
22  return weight
23 
24 def tot_fractions(fs):
25  tions = 0
26  for material, fraction in fs.items():
27  tions += fraction
28  return tions
29 
30 def elem_frac(compos, elem):
31  if elem in compos:
32  return compos[elem] / tot_weight(compos)
33  else:
34  return 0
35 
36 def elem_frac_total(elem, comps, fs):
37  frac = 0
38  for material, compos in comps.items():
39  frac += elem_frac(compos, elem) * fs[material]
40  return frac / tot_fractions(fs)
41 
43 
44  the_composition = { }
45 
46  for elem in elemlist:
47  the_composition[elem] = elem_frac_total(elem, compositions, fractions)
48  return the_composition
49 
def print_composition(composition)
Definition: util.py:55
def elem_frac(compos, elem)
Definition: printscintfd.py:30
def tot_fractions(fs)
Definition: printscintfd.py:24
def tot_weight(compos)
Definition: printscintfd.py:18
def elem_frac_total(elem, comps, fs)
Definition: printscintfd.py:36
def air_composition()
Definition: air.py:49
def scintfd_composition()
Definition: printscintfd.py:42