Files
dev/script/__Lib/diffcalc-2.1/diffcalc/dc/common.py
2019-03-20 13:52:00 +01:00

24 lines
654 B
Python
Executable File

from diffcalc.util import allnum, command, DiffcalcException
def sim(scn, hkl):
"""sim hkl scn -- simulates moving scannable (not all)
"""
if not isinstance(hkl, (tuple, list)):
raise TypeError()
if not allnum(hkl):
raise TypeError()
try:
print scn.simulateMoveTo(hkl)
except AttributeError:
raise TypeError(
"The first argument does not support simulated moves")
def energy_to_wavelength(energy):
try:
return 12.39842 / energy
except ZeroDivisionError:
raise DiffcalcException(
"Cannot calculate hkl position as Energy is set to 0")