Skip to content

Commit

Permalink
Tidy up documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpre committed Jun 16, 2024
1 parent dc96da4 commit d11d075
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 27 deletions.
15 changes: 8 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,14 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

import hyperspy.api as hs
import numpydoc
from packaging.version import Version


# Set logging level to `ERROR` to avoid exspy warning in documentation
hs.set_log_level("ERROR")


# -- Project information -----------------------------------------------------

project = "eXSpy"
copyright = "2023, eSpy Developers"
copyright = "2024, eXSpy Developers"
author = "eXSpy Developers"


Expand Down Expand Up @@ -61,7 +56,7 @@

intersphinx_mapping = {
"dask": ("https://docs.dask.org/en/latest", None),
"hyperspy": ("https://hyperspy.org/hyperspy-doc/dev", None),
"hyperspy": ("https://hyperspy.org/hyperspy-doc/current", None),
"kikuchipy": ("https://kikuchipy.org/en/latest/", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
Expand Down Expand Up @@ -156,3 +151,9 @@
towncrier_draft_autoversion_mode = "draft"
towncrier_draft_include_empty = False
towncrier_draft_working_directory = ".."

doctest_global_setup = """
import hyperspy.api as hs
import exspy
import numpy as np
"""
60 changes: 40 additions & 20 deletions exspy/_misc/eds/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,13 @@ def get_xray_lines_near_energy(energy, width=0.2, only_lines=None):
width : float
Window width in keV around energy in which to find nearby energies,
i.e. a value of 0.2 keV (the default) means to search +/- 0.1 keV.
only_lines :
only_lines : str or None
If not None, only the given lines will be added (eg. ('a','Kb')).
Returns
-------
List of xray-lines sorted by energy difference to given energy.
xray_lines : numpy.ndarray
List of xray-lines sorted by energy difference to the given energy.
"""
only_lines = _parse_only_lines(only_lines)
valid_lines = []
Expand Down Expand Up @@ -140,7 +141,8 @@ def get_FWHM_at_Energy(energy_resolution_MnKa, E):
Returns
-------
float : FWHM of the peak in keV
FWHM : float
FWHM of the peak in keV
Notes
-----
Expand Down Expand Up @@ -168,17 +170,22 @@ def xray_range(xray_line, beam_energy, density="auto"):
Parameters
----------
xray_line: str
xray_line : str
The X-ray line, e.g. 'Al_Ka'
beam_energy: float
beam_energy : float
The energy of the beam in kV.
density: {float, 'auto'}
density : {float, 'auto'}
The density of the material in g/cm3. If 'auto', the density
of the pure element is used.
Returns
-------
X-ray range in micrometer.
xray_range : float
The X-ray range in micrometer.
See Also
--------
exspy.utils.eds.electron_range
Examples
--------
Expand Down Expand Up @@ -216,19 +223,24 @@ def electron_range(element, beam_energy, density="auto", tilt=0):
Parameters
----------
element: str
element : str
The element symbol, e.g. 'Al'.
beam_energy: float
beam_energy : float
The energy of the beam in keV.
density: {float, 'auto'}
density : float or str (``'auto'``)
The density of the material in g/cm3. If 'auto', the density of
the pure element is used.
tilt: float.
tilt : float
The tilt of the sample in degrees.
Returns
-------
Electron range in micrometers.
electron_range : float
Electron range in micrometers.
See Also
--------
exspy.utils.eds.xray_range
Examples
--------
Expand Down Expand Up @@ -269,22 +281,22 @@ def take_off_angle(tilt_stage, azimuth_angle, elevation_angle, beta_tilt=0.0):
Parameters
----------
alpha_tilt: float
alpha_tilt : float
The alpha-tilt of the stage in degrees. The sample is facing the detector
when positively tilted.
azimuth_angle: float
azimuth_angle : float
The azimuth of the detector in degrees. 0 is perpendicular to the alpha
tilt axis.
elevation_angle: float
elevation_angle : float
The elevation of the detector in degrees.
beta_tilt: float
beta_tilt : float
The beta-tilt of the stage in degrees. The sample is facing positive 90
in the azimuthal direction when positively tilted.
Returns
-------
take_off_angle: float.
In degrees.
take_off_angle : float
The take off angle in degrees.
Examples
--------
Expand Down Expand Up @@ -710,7 +722,11 @@ def edx_cross_section_to_zeta(cross_sections, elements):
Returns
-------
zeta_factors : list of float
zeta_factors with units kg/m^2.
The zeta factors with units kg/m^2.
See Also
--------
exspy.utils.eds.zeta_to_edx_cross_section
"""
if len(elements) != len(cross_sections):
Expand Down Expand Up @@ -739,7 +755,11 @@ def zeta_to_edx_cross_section(zfactors, elements):
Returns
-------
cross_sections : list of float
cross_sections with units in barns.
The cross sections with units in barns.
See Also
--------
exspy.utils.eds.edx_cross_section_to_zeta
"""
if len(elements) != len(zfactors):
Expand Down

0 comments on commit d11d075

Please sign in to comment.