MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / validate_element_str

Function validate_element_str

pyxrf/core/xrf_utils.py:38–62  ·  view source on GitHub ↗

r""" Checks if ``element_str`` is valid representation of an element according to standard notation for chemical formulas. Valid representation of elements can be processed by ``xraylib`` tools. This functions attempts to find the atomic number for the element and returns ``True`` if

(element_str)

Source from the content-addressed store, hash-verified

36
37
38def validate_element_str(element_str):
39 r"""
40 Checks if ``element_str`` is valid representation of an element according to
41 standard notation for chemical formulas. Valid representation of elements can
42 be processed by ``xraylib`` tools. This functions attempts to find the atomic
43 number for the element and returns ``True`` if it succeeds and ``False`` if
44 it fails.
45
46 Parameters
47 ----------
48
49 element_str: str
50 sybmolic representation of an element
51
52 Returns
53 -------
54
55 ``True`` if ``element_str`` is valid representation of an element and ``False``
56 otherwise.
57 """
58
59 if get_element_atomic_number(element_str):
60 return True
61 else:
62 return False
63
64
65def parse_compound_formula(compound_formula):

Calls 1

Tested by 2