Files
x04sa-es3/script/test/TestFourcvTiny.py
2018-08-22 15:07:38 +02:00

120 lines
3.8 KiB
Python

run("diffutils")
###################################################################################################\
#Setup
###################################################################################################
class FourCircleX04SA_V(YouGeometry):
"""For a diffractometer with angles:
mu, delta, nu, eta
alpha delta gamma omegaV
"""
def __init__(self):
YouGeometry.__init__(self, 'fourcv', {'phi': 0, 'chi': 0,})
#diffcalc.hkl.you.constraints.NUNAME = 'gam'
def physical_angles_to_internal_position(self, physical_angle_tuple):
# mu, delta, nu, eta, chi, phi
mu, delta, nu, eta = physical_angle_tuple
return YouPosition(mu, delta, nu, eta, 0, 0)
def internal_position_to_physical_angles(self, internal_position):
mu, delta, nu, eta, _, _ = internal_position.totuple()
return mu, delta, nu, eta
###################################################################################################\
#Setup
###################################################################################################
#alpha, delta, gamma, omegaV
setup_diff(fourcv, energy, FourCircleX04SA_V(), ("mu", "delta", "gam", "eta"))
print_axis_setup()
"""
setup_axis('alpha', alpha.getMinValue(), alpha.getMaxValue())
setup_axis('delta', delta.getMinValue(), 90) #delta.getMaxValue())
setup_axis('gamma', gamma.getMinValue(), gamma.getMaxValue())
setup_axis('omegaV', omegaV.getMinValue(), omegaV.getMaxValue())
"""
"""
setup_axis('alpha', alpha.getMinValue(), alpha.getMaxValue())
setup_axis('delta', delta.getMinValue(), 90) #delta.getMaxValue())
setup_axis('gamma', gamma.getMinValue(), gamma.getMaxValue())
setup_axis('omegaV', omegaV.getMinValue(), omegaV.getMaxValue())
"""
setup_axis(alpha, alpha.getMinValue(), alpha.getMaxValue())
setup_axis(delta, delta.getMinValue(), 90) #delta.getMaxValue())
setup_axis(gamma, gamma.getMinValue(), gamma.getMaxValue())
setup_axis(omegaV, omegaV.getMinValue(), omegaV.getMaxValue())
#for m in alpha, delta, gamma, omegaV:
# setup_axis(m.name, m.getMinValue(), m.getMaxValue())
###################################################################################################\
#Orientation
###################################################################################################
help(ub.ub)
ub.listub()
# Create a new ub calculation and set lattice parameters
ub.newub('test')
#ub.setlat('cubic', 5.8361, 5.114, 11.058, 90, 90, 90)
ub.setlat('cubic', 11.058, 5.8361, 5.114, 90, 90, 90)
"""
# Add 1st reflection (demonstrating the hardware adapter)
settings.hardware.wavelength = 1
ub.c2th([1, 0, 0]) # energy from hardware
settings.hardware.position = 0, 45, 0, 0
ub.addref([1, 0, 0])# energy and position from hardware
# Add 2nd reflection (this time without the harware adapter)
ub.c2th([0, 1, 0], 12.39842)
ub.addref([0, 1, 0], [60, 30, 0, 90], 12.39842)
"""
#alpha delta gamma omegaV
en = 1.5498
en=8
ub.c2th([0, 0, 4], en)
ub.addref([0, 0, 4], [16.2785, 0.0, 32.5568, 0.0], en)
#ub.c2th([2, 0, 12], en)
#ub.addref([2, 0, 12], [71.8285, 37.3082, 138.7440, 0.0], en)
ub.c2th([1, -4, 10], en)
ub.addref([1, -4, 10], [27.7185, 17.6408 , 128.4220, 0.0], en)
#ub.setub([[1.07663,0.00000,0.00000], [-0.00000,1.22862,0.00000], [-0.00000,-0.00000,0.56820]])
# check the state
ub.ub()
ub.checkub()
###################################################################################################\
#Constraints
###################################################################################################
help(hkl.con)
#hkl.con('a_eq_b')
hkl.con('eta')
###################################################################################################\
#Motion
###################################################################################################
print angles_to_hkl((0, 73.72, 0, 32.56))
hkl_to_angles(0, -1, 12)