Coverage for larch/xray/__init__.py: 100%
14 statements
« prev ^ index » next coverage.py v7.6.0, created at 2024-10-16 21:04 +0000
« prev ^ index » next coverage.py v7.6.0, created at 2024-10-16 21:04 +0000
1#
2#
3__DOC__ = """
4Functions for accessing and using data from X-ray Databases and
5Tables. Many of these take an element as an argument -- this
6can be either the atomic symbol or atomic number Z.
8The data and functions here include (but are not limited to):
10member name descrption
11------------ ------------------------------
12materials dictionary of composition of common materials
13chemparse parse a Chemical formula to compositiondictionary.
14atomic_mass return atomic mass for an element
15f0 Thomson X-ray scattering factor
16mu_elam X-ray attenuation coefficients from Elam etal
17mu_chantler X-ray attenuation coefficients from Chantler
18xray_edges X-ray absorption edges for an element
19xray_lines X-ray emission lines for an element
20"""
22from larch.utils.physical_constants import ATOM_SYMS
24from xraydb import (XrayDB, atomic_mass, atomic_number, atomic_symbol,
25 atomic_density, xray_line, xray_lines, xray_edge,
26 xray_edges, ck_probability, f0, f0_ions, mu_elam,
27 mu_chantler, f1_chantler, f2_chantler, core_width,
28 chantler_energies, guess_edge, get_xraydb,
29 xray_delta_beta, coherent_cross_section_elam,
30 incoherent_cross_section_elam, fluor_yield, chemparse)
32from xraydb.xray import XrayLine
33from xraydb.materials import (get_material, add_material, material_mu,
34 material_mu_components, _read_materials_db)
35material_add = add_material
36material_get = get_material
38# from .cromer_liberman import f1f2 as f1f2_cl
39from .background import XrayBackground
41_larch_builtins = {'_xray': dict(chemparse=chemparse,
42 material_get=material_get,
43 material_add=material_add,
44 get_material=material_get,
45 add_material=material_add,
46 material_mu=material_mu,
47 material_mu_components=material_mu_components,
48 # f1f2_cl=f1f2_cl,
49 f0=f0,
50 f0_ions=f0_ions,
51 chantler_energies=chantler_energies,
52 # chantler_data=chantler_data,
53 f1_chantler=f1_chantler,
54 f2_chantler=f2_chantler,
55 mu_chantler=mu_chantler,
56 mu_elam=mu_elam,
57 coherent_xsec=coherent_cross_section_elam,
58 incoherent_xsec=incoherent_cross_section_elam,
59 atomic_number=atomic_number,
60 atomic_symbol=atomic_symbol,
61 atomic_mass= atomic_mass,
62 atomic_density=atomic_density,
63 xray_edges=xray_edges,
64 xray_edge=xray_edge,
65 xray_lines=xray_lines,
66 xray_line=xray_line,
67 fluo_yield=fluor_yield,
68 fluor_yield=fluor_yield,
69 core_width= core_width,
70 guess_edge= guess_edge,
71 ck_probability=ck_probability,
72 xray_delta_beta=xray_delta_beta)}
74def _larch_init(_larch):
75 """initialize xraydb"""
76 setsym = _larch.symtable.set_symbol
77 setsym('_xray._xraydb', XrayDB())
78 setsym('_xray._materials', _read_materials_db())
79 setsym('_xray._atomic_symbols', ATOM_SYMS)