Startup
This commit is contained in:
24
script/__Lib/diffcalc_old/diffcalc/dc/common.py
Normal file
24
script/__Lib/diffcalc_old/diffcalc/dc/common.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user