Commit b234da94 authored by bliss administrator's avatar bliss administrator
Browse files

Tested motor movements

parent b5652d71
......@@ -20,6 +20,7 @@ class MonoMode(Enum):
LL50 = 2
LL24 = 3
OUT = 4
MM = 5
class Id19Mono(MonochromatorBase):
......@@ -201,7 +202,7 @@ class Id19Mono(MonochromatorBase):
#
###############################################################################
def we(self):
theta_angle = self.THY1.position
theta_angle = self.get_theta()
if self.is_aprox(theta_angle, 0 , 0.01):
print ("Theta angle < 0.01, cannot calculte energy!")
......@@ -210,7 +211,7 @@ class Id19Mono(MonochromatorBase):
print ("The monochromator is at %g keV \n\n" % energy)
def wl(self):
theta_angle = self.THY1.position
theta_angle = self.get_theta()
if self.is_aprox(theta_angle, 0 , 0.01):
print ("Theta angle < 0.01, cannot calculte lambda!")
......@@ -236,6 +237,9 @@ class Id19Mono(MonochromatorBase):
self.check_mode()
if self.mode == MonoMode.UNDEFINED or self.mode == MonoMode.OUT:
raise RuntimeError("No operation mode applied. The monochromator is not pre-positioned")
if self.mode == MonoMode.MM:
raise RuntimeError("The multilayer mode is not yet implemented")
# check energy range
e_min = self.modes[self.mode]['min_energy']
......@@ -243,14 +247,6 @@ class Id19Mono(MonochromatorBase):
if energy < e_min or energy > e_max:
raise RuntimeError("Target energy %g keV is outside range [%g keV ;%g keV]" % (energy, e_min, e_max) )
## Check the current positions, do we need to move the crystals to 0?
#if self.X2.position >= self.X2_safe_position or relative == True:
#crystals_to_be_moved = False
#else:
#if is_aprox(self.THY1.position, 0 , 0.01) and
#is_aprox(self.THY2.position, 0 , 0.01):
#crystals_to_be_moved = False
# calculate X2 pos
#### Towers distance and calculated Bragg angle theta ####
......@@ -426,7 +422,19 @@ class Id19Mono(MonochromatorBase):
def mvre(self, delta_energy):
pass
if math.fabs(delta_energy) > 2000:
raise ValueError("Delta energy (eV) is too large! Has to be smaller than 2000eV!")
if math.fabs(delta_energy) < 0.01:
raise ValueError("Delta energy (eV) is too small! Has to be bigger than 0.01eV!")
theta_angle = self.get_theta()
old_e = self.bragg2energy(theta_angle) * 1000 # conversion to eV
new_e = (old_e + delta_energy) / 1000 # in keV
print ("Old energy = %g \t new energy = %g" % (old_e, new_e) )
self.mve(new_e, relative = True)
#
# rocking curve scans
......@@ -572,7 +580,13 @@ class Id19Mono(MonochromatorBase):
#def get_calculated_dspacing(self):
#hc_over_e = 12.398420
#return 1/(2*3.1356/hc_over_e)
def get_theta (self):
if self.mode == MonoMode.LL50 or self.mode == MonoMode.LL24:
theta_angle = self.THY1.position - self.laue_THY1_offset
else:
theta_angle = self.THY1.position
return theta_angle
def is_aprox(self, x, y, tol):
if math.fabs(x - y) <= tol:
......
......@@ -37,7 +37,7 @@
# mode parameters
bragg_mode:
- description: 'Crystal1: Bragg - Crystal2: Bragg (E: 10-99 offset: 50 mm)'
- description: 'Crystal1: Bragg - Crystal2: Bragg (E: 10-99 offset: 50 mm)'
min_energy: 10
max_energy: 99
beam_offset: 50
......@@ -45,7 +45,7 @@
Y2_pos: 0
laue_mode_50:
- description: 'Crystal1: Laue - Crystal2: Laue (E: 25-99 offset: 50 mm)'
- description: 'Crystal1: Laue - Crystal2: Laue (E: 25-99 offset: 50 mm)'
min_energy: 25
max_energy: 99
beam_offset: 50
......@@ -53,12 +53,20 @@
Y2_pos: 186.0
laue_mode_24:
- description: 'Crystal1: Laue - Crystal2: Laue (E: 55-200 offset: 24 mm)'
- description: 'Crystal1: Laue - Crystal2: Laue (E: 55-200 offset: 24 mm)'
min_energy: 55
max_energy: 200
beam_offset: 24
Y1_pos: 186.0
Y2_pos: 186.0
multilayer:
- description: 'Crystal1: Multilayer - Crystal2: Multilayer (E: ??-?? offset: ?? mm)'
min_energy: 30
max_energy: 99
beam_offset: 50
Y1_pos: 82.0
Y2_pos: 82.0
white_beam:
- description: 'Monochromator removed, parked in safe position'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment