rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
29 stars 13 forks source link

Adding methods for interconverting wavelength and energy #58

Closed kmdalton closed 3 years ago

kmdalton commented 3 years ago

This PR will add two new methods to rs.utils, ev2angstroms and angstroms2ev.

codecov-io commented 3 years ago

Codecov Report

Merging #58 (9a96de8) into main (358d229) will decrease coverage by 0.06%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #58      +/-   ##
==========================================
- Coverage   98.78%   98.72%   -0.07%     
==========================================
  Files          36       37       +1     
  Lines        1482     1488       +6     
==========================================
+ Hits         1464     1469       +5     
- Misses         18       19       +1     
Flag Coverage Δ
unittests 98.72% <83.33%> (-0.07%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
reciprocalspaceship/utils/units.py 80.00% <80.00%> (ø)
reciprocalspaceship/utils/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 358d229...9a96de8. Read the comment docs.

wojdyr commented 3 years ago

in gemmi the same is done by multiplying/dividing by gemmi.hc. Checking the exact value of the constant, it's the same up to 9th significant digit: 12398.41984332 12398.41973862 which I suppose is perfectly fine. I calculated the constant with Linux program units:

units -d15 'h * c / eV / angstrom'