Skip to content
Snippets Groups Projects
Commit 353c7ee5 authored by 29iduser's avatar 29iduser
Browse files

debug

parent 5bc9af95
No related branches found
No related tags found
No related merge requests found
......@@ -74,10 +74,10 @@ def _euler_to_kappa(e_theta,e_chi,e_phi,**kwargs):
kth,kap,kphi=0,0,0
else:
k_ang = k_arm*pi_deg
delta = np.asin( - np.tan(e_chi*pi_deg/2.0) / np.tan(k_ang) )
delta = np.arcsin( - np.tan(e_chi*pi_deg/2.0) / np.tan(k_ang) )
k_theta = e_theta*pi_deg - delta
k_kappa = 2.0 * np.asin( np.sin(e_chi*pi_deg/2.0) / np.sin(k_ang))
k_kappa = 2.0 * np.arcsin( np.sin(e_chi*pi_deg/2.0) / np.sin(k_ang))
k_phi = e_phi*pi_deg - delta
kth = np.round_(k_theta/pi_deg)-(57.045-kth_offset)
......@@ -98,7 +98,7 @@ def _kappa_to_euler(k_theta,k_kappa,k_phi,**kwargs):
k_ang = k_arm*pi_deg
delta = np.atan( np.tan(k_kappa*pi_deg/2.0) * np.cos(k_ang) )
e_theta = k_theta*pi_deg - delta
e_chi = 2.0 * np.asin( np.sin(k_kappa*pi_deg/2.0) * np.sin(k_ang) )
e_chi = 2.0 * np.arcsin( np.sin(k_kappa*pi_deg/2.0) * np.sin(k_ang) )
e_phi = k_phi*pi_deg - delta
theta = np.round_(e_theta/pi_deg,3)+(57.045-kth_offset)
......@@ -159,9 +159,9 @@ def EtoK(e_theta,e_chi,e_phi,k_arm=50):
else:
print(("Calculating Kappa angles using kth0 = "+str(kth_offset)))
k_ang = k_arm*conv
delta = np.asin( - np.tan(e_chi*conv/2.0) / np.tan(k_ang) )
delta = np.arcsin( - np.tan(e_chi*conv/2.0) / np.tan(k_ang) )
k_theta = e_theta*conv - delta
k_kappa = 2.0 * np.asin( np.sin(e_chi*conv/2.0) / np.sin(k_ang))
k_kappa = 2.0 * np.arcsin( np.sin(e_chi*conv/2.0) / np.sin(k_ang))
k_phi = e_phi*conv - delta
#print k_theta, k_kappa,k_phi
kth = rounder(k_theta)-(57.045-kth_offset)
......@@ -180,7 +180,7 @@ def KtoE(k_theta,k_kappa,k_phi,k_arm=50):
k_ang = k_arm*conv
delta = np.atan( np.tan(k_kappa*conv/2.0) * np.cos(k_ang) )
e_theta = k_theta*conv - delta
e_chi = 2.0 * np.asin( np.sin(k_kappa*conv/2.0) * np.sin(k_ang) )
e_chi = 2.0 * np.arcsin( np.sin(k_kappa*conv/2.0) * np.sin(k_ang) )
e_phi = k_phi*conv - delta
#print round(e_theta,1),round(e_phi,1),round(e_chi,1)
theta = rounder(e_theta)+(57.045-kth_offset)
......
......@@ -38,6 +38,58 @@ from iexcode.instruments.VLS_PGM import mono_scan_pvs
import collections
import pyRestTable
# define the 4-circle, based on expecting motor PVs
class FourCircleDiffractometer(SimulatedE4CV):
pass
# create the 4-circle diffractometer object
fourc = FourCircleDiffractometer('', name="fourc")
select_diffractometer(fourc)
# What the available modes with this diffractometer?
print(f"\n{fourc.name} modes: {fourc.engine.modes}")
# Define motors RBVs:
""" kappa_motor_dict = _kappa_motor_dictionary()
tth_rbv = EpicsSignalRO(kappa_motor_dict['tth'][0], name="tth_rbv")
omega_rbv = EpicsSignalRO(kappa_motor_dict['th'][0], name="omega_rbv")
chi_rbv = EpicsSignalRO(kappa_motor_dict['chi'][0], name="chi_rbv")
phi_rbv = EpicsSignalRO(kappa_motor_dict['phi'][0], name="phi_rbv")
kth_rbv = EpicsSignalRO(kappa_motor_dict['kth'][0], name="kth_rbv")
kap_rbv = EpicsSignalRO(kappa_motor_dict['kap'][0], name="kap_rbv")
kphi_rbv =EpicsSignalRO(kappa_motor_dict['kphi'][0], name="phi_rbv") """
print('We are here')
tth_rbv = EpicsSignalRO('29idKappa:m9.RBV', name="tth_rbv")
omega_rbv = EpicsSignalRO('29idKappa:Euler_ThetaRBV', name="omega_rbv")
chi_rbv = EpicsSignalRO('29idKappa:Euler_ChiRBV', name="chi_rbv")
phi_rbv = EpicsSignalRO('29idKappa:Euler_PhiRBV', name="phi_rbv")
kth_rbv = EpicsSignalRO('29idKappa:m8.RBV', name="kth_rbv")
kap_rbv = EpicsSignalRO('29idKappa:m7.RBV', name="kap_rbv")
kphi_rbv =EpicsSignalRO('29idKappa:m1.RBV', name="tth_rbv")
# SPEC equivalent of setmode.
# The planned experiment could use contant phi
fourc.calc.engine.mode = "constant_phi"
print(f"\nselected mode: {fourc.calc.engine.mode}\n")
# Setup cut point / soft limits:
diffractometer_constraints = {
# axis: Constraint(lo_limit, hi_limit, value, fit)
"omega": Constraint(-20, 150, 0, True),
"chi": Constraint(-30, 100, 0, True),
# "phi": Constraint(0, 0, 0, False),
"tth": Constraint(0, 180, 0, True),
}
fourc.apply_constraints(diffractometer_constraints)
fourc.show_constraints()
print('\nWARNING: wavelength set to {:.3f} A = {:.2f} eV'.format(fourc.calc.wavelength,fourc.calc.energy*1e3))
def hkl_detNum(hkl):
"""
returns the detector number for hkl = 'h','k','l'
......@@ -107,45 +159,6 @@ def UB_update_wavelength():
UB_put('UBenergy',Lambda2eV(fourc.calc.wavelength))
UB_put('UBlambda',fourc.calc.wavelength)
# define the 4-circle, based on expecting motor PVs
class FourCircleDiffractometer(SimulatedE4CV):
pass
# create the 4-circle diffractometer object
fourc = FourCircleDiffractometer('', name="fourc")
select_diffractometer(fourc)
# What the available modes with this diffractometer?
print(f"\n{fourc.name} modes: {fourc.engine.modes}")
# Define motors RBVs:
kappa_motor_dict = _kappa_motor_dictionary()
tth_rbv = EpicsSignalRO(kappa_motor_dict['tth'][0], name="tth_rbv")
omega_rbv = EpicsSignalRO(kappa_motor_dict['th'][0], name="omega_rbv")
chi_rbv = EpicsSignalRO(kappa_motor_dict['chi'][0], name="chi_rbv")
phi_rbv = EpicsSignalRO(kappa_motor_dict['phi'][0], name="phi_rbv")
kth_rbv = EpicsSignalRO(kappa_motor_dict['kth'][0], name="kth_rbv")
kap_rbv = EpicsSignalRO(kappa_motor_dict['kap'][0], name="kap_rbv")
kphi_rbv =EpicsSignalRO(kappa_motor_dict['kphi'][0], name="phi_rbv")
# SPEC equivalent of setmode.
# The planned experiment could use contant phi
fourc.calc.engine.mode = "constant_phi"
print(f"\nselected mode: {fourc.calc.engine.mode}\n")
# Setup cut point / soft limits:
diffractometer_constraints = {
# axis: Constraint(lo_limit, hi_limit, value, fit)
"omega": Constraint(-20, 150, 0, True),
"chi": Constraint(-30, 100, 0, True),
# "phi": Constraint(0, 0, 0, False),
"tth": Constraint(0, 180, 0, True),
}
fourc.apply_constraints(diffractometer_constraints)
fourc.show_constraints()
print('\nWARNING: wavelength set to {:.3f} A = {:.2f} eV'.format(fourc.calc.wavelength,fourc.calc.energy*1e3))
UB_update_wavelength()
......
matplotlib
numpy
scipy
#matplotlib
#numpy
#scipy
h5py
#h5py
netCDF4
pyepics
#pyepics
playsound
iexplot
#iexplot
#pygobject
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment