Skip to content

Commit

Permalink
Merge pull request #206 from bluesky/172-A_KEV-precision
Browse files Browse the repository at this point in the history
Increase precision of A_KEV constant
  • Loading branch information
prjemian authored Sep 16, 2021
2 parents 1b5d1a8 + 62f52d9 commit d7bf020
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
11 changes: 11 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Release History
Deprecations
Contributors
v1.0.1 (2021-09-20 or thereabouts)
==================================

Maintenance release.

Maintenance
-----------

* Increase precision of ``A_KEV`` constant to match 2018 CODATA value.
* Provide project description for PyPI packaging.

v1.0.0 (2021-09-13)
======================

Expand Down
3 changes: 1 addition & 2 deletions hkl/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@

# per NIST publication of CODATA Fundamental Physical Constants
# https://www.nist.gov/programs-projects/codata-values-fundamental-physical-constants
A_KEV = 12.3984198 # 1 Angstrom ~= 12.39842 keV
# A_KEV = 12.39842 # 1 Angstrom ~= 12.39842 keV
A_KEV = 12.39841984 # 1 Angstrom ~= 12.39842 keV
NM_KEV = A_KEV * 0.1 # 1 nm ~= 1.239842 keV
# Note: NM_KEV is not used by hklpy now, remains here as legacy

Expand Down
6 changes: 6 additions & 0 deletions hkl/tests/test_diffract.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ def test_forward_solutions_table(fourc):
assert pytest.approx(sol.phi, 1e-5) == -90
assert pytest.approx(sol.tth, 1e-5) == -60

fourc.apply_constraints(
{
"tth": Constraint(0, 180, 0, True),
}
)

tbl = fourc.forward_solutions_table(
# fmt: off
[
Expand Down
4 changes: 2 additions & 2 deletions hkl/tests/test_save_restore_UB.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_basic_setup(fourc, kappa):
assert fourc != kappa
assert fourc._reals != kappa._reals

assert fourc.calc.wavelength == 1.54
assert round(fourc.calc.wavelength, 2) == 1.54
assert fourc.calc.wavelength == kappa.calc.wavelength


Expand Down Expand Up @@ -140,7 +140,7 @@ def test_fourc_run_orientation_info(cat, RE, fourc):
refls = fourc_orient["reflections_details"]
assert len(refls) == 2
assert "wavelength" in refls[0]
assert refls[0]["wavelength"] == 1.54
assert round(refls[0]["wavelength"], 2) == 1.54


def test_list_orientation_runs(cat, RE, fourc, kappa):
Expand Down

0 comments on commit d7bf020

Please sign in to comment.