Skip to content

Commit

Permalink
Merge pull request #390 from ZLLentz/enh_xpp_calc_ns
Browse files Browse the repository at this point in the history
ENH: XPP calc namespace hotfix
  • Loading branch information
ZLLentz authored Oct 15, 2024
2 parents 4c37c88 + b57ca20 commit b978c6e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ requirements:
- lightpath >=1.0.1
- matplotlib-base >=3.4.0
- nabs >=1.5.0
- pcdscalc >=0.3.0
- pcdscalc >=0.6.0
- pcdsdaq >=2.3.0
- pcdsdevices >=7.0.0
- pcdsutils >=0.6.0
Expand Down
29 changes: 29 additions & 0 deletions docs/source/upcoming_release_notes/390-enh_xpp_calc_ns.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
390 enh_xpp_calc_ns
###################

API Changes
-----------
- N/A

Features
--------
- Add ``pcdscalc.xray`` to the calc namespace.
- Add top-level shortcuts to some of the most used calcs,
``E2lam``, ``lam2E``, ``bragg_angle``, ``darwin_width``,
and ``transmission``.
``E2lam`` is an alias for ``energy_to_wavelength`` and
``lam2E`` is an alias for ``wavelength_to_energy``
to match scientist expectations.

Bugfixes
--------
- N/A

Maintenance
-----------
- N/A

Contributors
------------
- vespos
- zllentz
10 changes: 10 additions & 0 deletions hutch_python/calc_defaults.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from importlib import import_module

from pcdscalc.common import energy_to_wavelength, wavelength_to_energy
from pcdscalc.diffraction import bragg_angle, darwin_width
from pcdscalc.xray import transmission

from .utils import HelpfulNamespace


Expand Down Expand Up @@ -33,7 +37,13 @@ def collect_functions(modules):


calc_namespace = HelpfulNamespace(
E2lam=energy_to_wavelength,
lam2E=wavelength_to_energy,
bragg_angle=bragg_angle,
darwin_width=darwin_width,
transmission=transmission,
be_lens=collect_functions(['pcdscalc.be_lens_calcs']),
common=collect_functions(['pcdscalc.common']),
diffraction=collect_functions(['pcdscalc.diffraction']),
xray=collect_functions(['pcdscalc.xray']),
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jinja2>=2.11.0
lightpath>=1.0.1
matplotlib>=3.4.0
nabs>=1.5.0
pcdscalc>=0.3.0
pcdscalc>=0.6.0
pcdsdaq>=2.3.0
pcdsdevices>=7.0.0
pcdsutils>=0.5.0
Expand Down

0 comments on commit b978c6e

Please sign in to comment.