Skip to content

Commit

Permalink
Fix exspy.material.elements docstring and add it to the API reference
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpre committed Jun 16, 2024
1 parent 73322c7 commit c9f888c
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 2 deletions.
52 changes: 50 additions & 2 deletions doc/reference/material.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,58 @@
.. autosummary::

atomic_to_weight
weight_to_atomic
density_of_mixture
elements
mass_absorption_coefficient
mass_absorption_mixture
weight_to_atomic

.. automodule:: exspy.material
:members:
:members:

.. autoattribute:: exspy.material.elements
:annotation:

Database of elements that contains the following properties:

.. code::
├── Atomic_properties
│ ├── Binding_energies
│ └── Xray_lines
├── General_properties
│ ├── Z
│ ├── atomic_weight
│ └── name
└── Physical_properties
└── density_gcm3
Examples:

.. code::
>>> exspy.material.elements.Fe.General_properties
├── Z = 26
├── atomic_weight = 55.845
└── name = iron
>>> exspy.material.elements.Fe.Physical_properties
└── density (g/cm^3) = 7.874
>>> exspy.material.elements.Fe.Atomic_properties.Xray_lines
├── Ka
│ ├── energy (keV) = 6.404
│ └── weight = 1.0
├── Kb
│ ├── energy (keV) = 7.0568
│ └── weight = 0.1272
├── La
│ ├── energy (keV) = 0.705
│ └── weight = 1.0
├── Lb3
│ ├── energy (keV) = 0.792
│ └── weight = 0.02448
├── Ll
│ ├── energy (keV) = 0.615
│ └── weight = 0.3086
└── Ln
├── energy (keV) = 0.62799
└── weight = 0.12525
43 changes: 43 additions & 0 deletions exspy/_misc/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -4979,6 +4979,49 @@
}

elements_db = DictionaryTreeBrowser(elements)
elements_db.__doc__ = """
Database of elements that contains the following properties:
.. code::
├── Atomic_properties
│ ├── Binding_energies
│ └── Xray_lines
├── General_properties
│ ├── Z
│ ├── atomic_weight
│ └── name
└── Physical_properties
└── density_gcm3
Examples
--------
>>> exspy.material.elements.Fe.General_properties
├── Z = 26
├── atomic_weight = 55.845
└── name = iron
>>> exspy.material.elements.Fe.Physical_properties
└── density (g/cm^3) = 7.874
>>> exspy.material.elements.Fe.Atomic_properties.Xray_lines
├── Ka
│ ├── energy (keV) = 6.404
│ └── weight = 1.0
├── Kb
│ ├── energy (keV) = 7.0568
│ └── weight = 0.1272
├── La
│ ├── energy (keV) = 0.705
│ └── weight = 1.0
├── Lb3
│ ├── energy (keV) = 0.792
│ └── weight = 0.02448
├── Ll
│ ├── energy (keV) = 0.615
│ └── weight = 0.3086
└── Ln
├── energy (keV) = 0.62799
└── weight = 0.12525
"""

# read dictionary of atomic numbers from eXSpy, and add the elements that
# do not currently exist in the database (in case anyone is doing EDS on
Expand Down

0 comments on commit c9f888c

Please sign in to comment.