Blacked
This commit is contained in:
parent
a0a0c1398d
commit
c9abd2a9da
@ -58,7 +58,7 @@ class SpmSim(SpmBase):
|
|||||||
# Define normalized 2D gaussian
|
# Define normalized 2D gaussian
|
||||||
def gaus2d(x=0, y=0, mx=0, my=0, sx=1, sy=1):
|
def gaus2d(x=0, y=0, mx=0, my=0, sx=1, sy=1):
|
||||||
return np.exp(
|
return np.exp(
|
||||||
-((x - mx) ** 2.0 / (2.0 * sx**2.0) + (y - my) ** 2.0 / (2.0 * sy**2.0))
|
-((x - mx) ** 2.0 / (2.0 * sx ** 2.0) + (y - my) ** 2.0 / (2.0 * sy ** 2.0))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generator for dynamic values
|
# Generator for dynamic values
|
||||||
@ -74,10 +74,10 @@ class SpmSim(SpmBase):
|
|||||||
beam = self._simFrame()
|
beam = self._simFrame()
|
||||||
total = np.sum(beam) - np.sum(beam[24:48, :])
|
total = np.sum(beam) - np.sum(beam[24:48, :])
|
||||||
rnge = np.floor(np.log10(total) - 0.0)
|
rnge = np.floor(np.log10(total) - 0.0)
|
||||||
s1 = np.sum(beam[0:16, :]) / 10**rnge
|
s1 = np.sum(beam[0:16, :]) / 10 ** rnge
|
||||||
s2 = np.sum(beam[16:24, :]) / 10**rnge
|
s2 = np.sum(beam[16:24, :]) / 10 ** rnge
|
||||||
s3 = np.sum(beam[40:48, :]) / 10**rnge
|
s3 = np.sum(beam[40:48, :]) / 10 ** rnge
|
||||||
s4 = np.sum(beam[48:64, :]) / 10**rnge
|
s4 = np.sum(beam[48:64, :]) / 10 ** rnge
|
||||||
|
|
||||||
self.s1w.set(s1).wait()
|
self.s1w.set(s1).wait()
|
||||||
self.s2w.set(s2).wait()
|
self.s2w.set(s2).wait()
|
||||||
|
@ -88,7 +88,7 @@ class XbpmSim(XbpmBase):
|
|||||||
# define normalized 2D gaussian
|
# define normalized 2D gaussian
|
||||||
def gaus2d(x=0, y=0, mx=0, my=0, sx=1, sy=1):
|
def gaus2d(x=0, y=0, mx=0, my=0, sx=1, sy=1):
|
||||||
return np.exp(
|
return np.exp(
|
||||||
-((x - mx) ** 2.0 / (2.0 * sx**2.0) + (y - my) ** 2.0 / (2.0 * sy**2.0))
|
-((x - mx) ** 2.0 / (2.0 * sx ** 2.0) + (y - my) ** 2.0 / (2.0 * sy ** 2.0))
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generator for dynamic values
|
# Generator for dynamic values
|
||||||
@ -104,10 +104,10 @@ class XbpmSim(XbpmBase):
|
|||||||
beam = self._simFrame()
|
beam = self._simFrame()
|
||||||
total = np.sum(beam)
|
total = np.sum(beam)
|
||||||
rnge = np.floor(np.log10(total) - 0.0)
|
rnge = np.floor(np.log10(total) - 0.0)
|
||||||
s1 = np.sum(beam[32:64, 32:64]) / 10**rnge
|
s1 = np.sum(beam[32:64, 32:64]) / 10 ** rnge
|
||||||
s2 = np.sum(beam[0:32, 32:64]) / 10**rnge
|
s2 = np.sum(beam[0:32, 32:64]) / 10 ** rnge
|
||||||
s3 = np.sum(beam[32:64, 0:32]) / 10**rnge
|
s3 = np.sum(beam[32:64, 0:32]) / 10 ** rnge
|
||||||
s4 = np.sum(beam[0:32, 0:32]) / 10**rnge
|
s4 = np.sum(beam[0:32, 0:32]) / 10 ** rnge
|
||||||
|
|
||||||
self.s1w.set(s1).wait()
|
self.s1w.set(s1).wait()
|
||||||
self.s2w.set(s2).wait()
|
self.s2w.set(s2).wait()
|
||||||
|
@ -3,7 +3,18 @@ from .slits import SlitH, SlitV
|
|||||||
from .XbpmBase import XbpmBase, XbpmCsaxsOp
|
from .XbpmBase import XbpmBase, XbpmCsaxsOp
|
||||||
from .SpmBase import SpmBase
|
from .SpmBase import SpmBase
|
||||||
from .InsertionDevice import InsertionDevice
|
from .InsertionDevice import InsertionDevice
|
||||||
from .specMotors import PmMonoBender, PmDetectorRotation, GirderMotorX1, GirderMotorY1, GirderMotorROLL, GirderMotorYAW, GirderMotorPITCH, MonoTheta1, MonoTheta2, EnergyKev
|
from .specMotors import (
|
||||||
|
PmMonoBender,
|
||||||
|
PmDetectorRotation,
|
||||||
|
GirderMotorX1,
|
||||||
|
GirderMotorY1,
|
||||||
|
GirderMotorROLL,
|
||||||
|
GirderMotorYAW,
|
||||||
|
GirderMotorPITCH,
|
||||||
|
MonoTheta1,
|
||||||
|
MonoTheta2,
|
||||||
|
EnergyKev,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Standard ophyd classes
|
# Standard ophyd classes
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
TABLES_DT_PUSH_DIST_MM = 890
|
TABLES_DT_PUSH_DIST_MM = 890
|
||||||
|
|
||||||
|
|
||||||
@ -21,8 +19,12 @@ class DetectorTableTheta(PseudoPositioner):
|
|||||||
|
|
||||||
@pseudo_position_argument
|
@pseudo_position_argument
|
||||||
def forward(self, pseudo_pos):
|
def forward(self, pseudo_pos):
|
||||||
return self.RealPosition(pusher = tan(pseudo_pos.theta * 3.141592 / 180.0) * TABLES_DT_PUSH_DIST_MM)
|
return self.RealPosition(
|
||||||
|
pusher=tan(pseudo_pos.theta * 3.141592 / 180.0) * TABLES_DT_PUSH_DIST_MM
|
||||||
|
)
|
||||||
|
|
||||||
@real_position_argument
|
@real_position_argument
|
||||||
def inverse(self, real_pos):
|
def inverse(self, real_pos):
|
||||||
return self.PseudoPosition(theta = -180 * atan(real_pos.pusher / TABLES_DT_PUSH_DIST_MM) / 3.141592)
|
return self.PseudoPosition(
|
||||||
|
theta=-180 * atan(real_pos.pusher / TABLES_DT_PUSH_DIST_MM) / 3.141592
|
||||||
|
)
|
||||||
|
@ -97,34 +97,43 @@ class PmDetectorRotation(PseudoPositioner):
|
|||||||
class GirderMotorX1(PVPositioner):
|
class GirderMotorX1(PVPositioner):
|
||||||
"""Girder X translation pseudo motor
|
"""Girder X translation pseudo motor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setpoint = Component(EpicsSignal, ":X_SET", name="sp")
|
setpoint = Component(EpicsSignal, ":X_SET", name="sp")
|
||||||
readback = Component(EpicsSignalRO, ":X1", name="rbv")
|
readback = Component(EpicsSignalRO, ":X1", name="rbv")
|
||||||
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
class GirderMotorY1(PVPositioner):
|
class GirderMotorY1(PVPositioner):
|
||||||
"""Girder Y translation pseudo motor
|
"""Girder Y translation pseudo motor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setpoint = Component(EpicsSignal, ":Y_SET", name="sp")
|
setpoint = Component(EpicsSignal, ":Y_SET", name="sp")
|
||||||
readback = Component(EpicsSignalRO, ":Y1", name="rbv")
|
readback = Component(EpicsSignalRO, ":Y1", name="rbv")
|
||||||
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
class GirderMotorYAW(PVPositioner):
|
class GirderMotorYAW(PVPositioner):
|
||||||
"""Girder YAW pseudo motor
|
"""Girder YAW pseudo motor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setpoint = Component(EpicsSignal, ":YAW_SET", name="sp")
|
setpoint = Component(EpicsSignal, ":YAW_SET", name="sp")
|
||||||
readback = Component(EpicsSignalRO, ":YAW1", name="rbv")
|
readback = Component(EpicsSignalRO, ":YAW1", name="rbv")
|
||||||
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
class GirderMotorROLL(PVPositioner):
|
class GirderMotorROLL(PVPositioner):
|
||||||
"""Girder ROLL pseudo motor
|
"""Girder ROLL pseudo motor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setpoint = Component(EpicsSignal, ":ROLL_SET", name="sp")
|
setpoint = Component(EpicsSignal, ":ROLL_SET", name="sp")
|
||||||
readback = Component(EpicsSignalRO, ":ROLL1", name="rbv")
|
readback = Component(EpicsSignalRO, ":ROLL1", name="rbv")
|
||||||
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
|
|
||||||
|
|
||||||
class GirderMotorPITCH(PVPositioner):
|
class GirderMotorPITCH(PVPositioner):
|
||||||
"""Girder YAW pseudo motor
|
"""Girder YAW pseudo motor
|
||||||
"""
|
"""
|
||||||
|
|
||||||
setpoint = Component(EpicsSignal, ":PITCH_SET", name="sp")
|
setpoint = Component(EpicsSignal, ":PITCH_SET", name="sp")
|
||||||
readback = Component(EpicsSignalRO, ":PITCH1", name="rbv")
|
readback = Component(EpicsSignalRO, ":PITCH1", name="rbv")
|
||||||
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
done = Component(EpicsSignal, ":M-DMOV", name="dmov")
|
||||||
@ -134,6 +143,7 @@ class VirtualEpicsSignalRO(EpicsSignalRO):
|
|||||||
"""This is a test class to create derives signals from one or
|
"""This is a test class to create derives signals from one or
|
||||||
multiple original signals...
|
multiple original signals...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def calc(self, val):
|
def calc(self, val):
|
||||||
return val
|
return val
|
||||||
|
|
||||||
@ -141,27 +151,34 @@ class VirtualEpicsSignalRO(EpicsSignalRO):
|
|||||||
raw = super().get(*args, **kwargs)
|
raw = super().get(*args, **kwargs)
|
||||||
return self.calc(raw)
|
return self.calc(raw)
|
||||||
|
|
||||||
#def describe(self):
|
# def describe(self):
|
||||||
# val = self.get()
|
# val = self.get()
|
||||||
# d = super().describe()
|
# d = super().describe()
|
||||||
# d[self.name]["dtype"] = data_type(val)
|
# d[self.name]["dtype"] = data_type(val)
|
||||||
# return d
|
# return d
|
||||||
|
|
||||||
|
|
||||||
class MonoTheta1(VirtualEpicsSignalRO):
|
class MonoTheta1(VirtualEpicsSignalRO):
|
||||||
"""Converts the pusher motor position to theta angle
|
"""Converts the pusher motor position to theta angle
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_mono_a0_enc_scale1 = -1.0
|
_mono_a0_enc_scale1 = -1.0
|
||||||
_mono_a1_lever_length1 = 206.706
|
_mono_a1_lever_length1 = 206.706
|
||||||
_mono_a2_pusher_offs1 = 6.85858
|
_mono_a2_pusher_offs1 = 6.85858
|
||||||
_mono_a3_enc_offs1 = -16.9731
|
_mono_a3_enc_offs1 = -16.9731
|
||||||
|
|
||||||
def calc(self, val):
|
def calc(self, val):
|
||||||
asin_arg = (val - self._mono_a2_pusher_offs1) / self._mono_a1_lever_length1
|
asin_arg = (val - self._mono_a2_pusher_offs1) / self._mono_a1_lever_length1
|
||||||
theta1 = self._mono_a0_enc_scale1 * asin( asin_arg ) / 3.141592 * 180.0 + self._mono_a3_enc_offs1
|
theta1 = (
|
||||||
|
self._mono_a0_enc_scale1 * asin(asin_arg) / 3.141592 * 180.0 + self._mono_a3_enc_offs1
|
||||||
|
)
|
||||||
return theta1
|
return theta1
|
||||||
|
|
||||||
|
|
||||||
class MonoTheta2(VirtualEpicsSignalRO):
|
class MonoTheta2(VirtualEpicsSignalRO):
|
||||||
"""Converts the pusher motor position to theta angle
|
"""Converts the pusher motor position to theta angle
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_mono_a3_enc_offs2 = -19.7072
|
_mono_a3_enc_offs2 = -19.7072
|
||||||
_mono_a2_pusher_offs2 = 5.93905
|
_mono_a2_pusher_offs2 = 5.93905
|
||||||
_mono_a1_lever_length2 = 206.572
|
_mono_a1_lever_length2 = 206.572
|
||||||
@ -169,37 +186,27 @@ class MonoTheta2(VirtualEpicsSignalRO):
|
|||||||
|
|
||||||
def calc(self, val):
|
def calc(self, val):
|
||||||
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
||||||
theta2 = self._mono_a0_enc_scale2 * asin( asin_arg ) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
|
theta2 = (
|
||||||
|
self._mono_a0_enc_scale2 * asin(asin_arg) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
|
||||||
|
)
|
||||||
return theta2
|
return theta2
|
||||||
|
|
||||||
|
|
||||||
class EnergyKev(VirtualEpicsSignalRO):
|
class EnergyKev(VirtualEpicsSignalRO):
|
||||||
"""Converts the pusher motor position to energy in keV
|
"""Converts the pusher motor position to energy in keV
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_mono_a3_enc_offs2 = -19.7072
|
_mono_a3_enc_offs2 = -19.7072
|
||||||
_mono_a2_pusher_offs2 = 5.93905
|
_mono_a2_pusher_offs2 = 5.93905
|
||||||
_mono_a1_lever_length2 = 206.572
|
_mono_a1_lever_length2 = 206.572
|
||||||
_mono_a0_enc_scale2 = -1.0
|
_mono_a0_enc_scale2 = -1.0
|
||||||
_mono_hce = 12.39852066
|
_mono_hce = 12.39852066
|
||||||
_mono_2d2 = 2*5.43102/sqrt(3)
|
_mono_2d2 = 2 * 5.43102 / sqrt(3)
|
||||||
|
|
||||||
def calc(self, val):
|
def calc(self, val):
|
||||||
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
asin_arg = (val - self._mono_a2_pusher_offs2) / self._mono_a1_lever_length2
|
||||||
theta2_deg = self._mono_a0_enc_scale2 * asin( asin_arg ) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
|
theta2_deg = (
|
||||||
E_keV = -self._mono_hce / self._mono_2d2 / sin(theta2_deg/180.0*3.14152)
|
self._mono_a0_enc_scale2 * asin(asin_arg) / 3.141592 * 180.0 + self._mono_a3_enc_offs2
|
||||||
|
)
|
||||||
|
E_keV = -self._mono_hce / self._mono_2d2 / sin(theta2_deg / 180.0 * 3.14152)
|
||||||
return E_keV
|
return E_keV
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user