Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: XPP calc namespace hotfix #390

Merged
merged 10 commits into from
Oct 15, 2024
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