switched from MotorRecord (old and new) to Motor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from slic.devices.general.motors import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from epics import PV
|
||||
|
||||
class table:
|
||||
@@ -6,21 +6,21 @@ class table:
|
||||
self.Id = Id
|
||||
|
||||
### ADC optical table ###
|
||||
self.x1 = MotorRecord(Id+':MOTOR_X1')
|
||||
self.x2 = MotorRecord(Id+':MOTOR_X2')
|
||||
self.y1 = MotorRecord(Id+':MOTOR_Y1')
|
||||
self.y2 = MotorRecord(Id+':MOTOR_Y2')
|
||||
self.y3 = MotorRecord(Id+':MOTOR_Y3')
|
||||
self.z = MotorRecord(Id+':MOTOR_Z')
|
||||
self.x = MotorRecord(Id+':W_X')
|
||||
self.y = MotorRecord(Id+':W_Y')
|
||||
self.z = MotorRecord(Id+':W_Z')
|
||||
self.pitch = MotorRecord(Id+':W_RX')
|
||||
self.yaw = MotorRecord(Id+':W_RY')
|
||||
self.roll = MotorRecord(Id+':W_RZ')
|
||||
self.modeSP = PV(Id+':MODE_SP')
|
||||
self.status = PV(Id+':SS_STATUS')
|
||||
|
||||
self.x1 = Motor(Id + ':MOTOR_X1')
|
||||
self.x2 = Motor(Id + ':MOTOR_X2')
|
||||
self.y1 = Motor(Id + ':MOTOR_Y1')
|
||||
self.y2 = Motor(Id + ':MOTOR_Y2')
|
||||
self.y3 = Motor(Id + ':MOTOR_Y3')
|
||||
self.z = Motor(Id + ':MOTOR_Z')
|
||||
self.x = Motor(Id + ':W_X')
|
||||
self.y = Motor(Id + ':W_Y')
|
||||
self.z = Motor(Id + ':W_Z')
|
||||
self.pitch = Motor(Id + ':W_RX')
|
||||
self.yaw = Motor(Id + ':W_RY')
|
||||
self.roll = Motor(Id + ':W_RZ')
|
||||
self.modeSP = PV(Id + ':MODE_SP')
|
||||
self.status = PV(Id + ':SS_STATUS')
|
||||
|
||||
def __str__(self):
|
||||
return "Prime Table position\nx: %s mm\ny: %s mm\nz: %s\npitch: %s mrad\nyaw: %s mrad\nmode SP: %s \nstatus: %s" \
|
||||
% (self.x.wm(),self.y.wm(),self.z.wm(),self.pitch.wm(),self.yaw.wm(),self.modeSP.get(as_string=True),self.status.get())
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
from ..general.motors import MotorRecord
|
||||
from ..general.smaract import SmarActRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..general.smaract import SmarActRecord
|
||||
|
||||
|
||||
class Huber:
|
||||
def __init__(self, Id, alias_namespace=None, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
|
||||
### Huber sample stages ###
|
||||
self.x = MotorRecord(Id+':MOTOR_X1')
|
||||
self.y = MotorRecord(Id+':MOTOR_Y1')
|
||||
self.z = MotorRecord(Id+':MOTOR_Z1')
|
||||
self.x = Motor(Id + ':MOTOR_X1')
|
||||
self.y = Motor(Id + ':MOTOR_Y1')
|
||||
self.z = Motor(Id + ':MOTOR_Z1')
|
||||
|
||||
def __str__(self):
|
||||
return "Huber Sample Stage %s\nx: %s mm\ny: %s mm\nz: %s mm" \
|
||||
@@ -25,8 +24,8 @@ class VonHamosBragg:
|
||||
self.Id = Id
|
||||
|
||||
### Owis linear stages ###
|
||||
self.cry1 = MotorRecord(Id+':CRY_1')
|
||||
self.cry2 = MotorRecord(Id+':CRY_2')
|
||||
self.cry1 = Motor(Id + ':CRY_1')
|
||||
self.cry2 = Motor(Id + ':CRY_2')
|
||||
|
||||
def __str__(self):
|
||||
return "von Hamos positions\nCrystal 1: %s mm\nCrystal 2: %s mm" \
|
||||
@@ -40,21 +39,21 @@ class Table:
|
||||
self.Id = Id
|
||||
|
||||
### ADC optical table ###
|
||||
self.x1 = MotorRecord(Id+':MOTOR_X1')
|
||||
self.y1 = MotorRecord(Id+':MOTOR_Y1')
|
||||
self.y2 = MotorRecord(Id+':MOTOR_Y2')
|
||||
self.y3 = MotorRecord(Id+':MOTOR_Y3')
|
||||
self.z1 = MotorRecord(Id+':MOTOR_Z1')
|
||||
self.z2 = MotorRecord(Id+':MOTOR_Z2')
|
||||
self.x = MotorRecord(Id+':W_X')
|
||||
self.y = MotorRecord(Id+':W_Y')
|
||||
self.z = MotorRecord(Id+':W_Z')
|
||||
self.pitch = MotorRecord(Id+':W_RX')
|
||||
self.yaw = MotorRecord(Id+':W_RY')
|
||||
self.roll = MotorRecord(Id+':W_RZ')
|
||||
self.modeSP = PV(Id+':MODE_SP')
|
||||
self.status = PV(Id+':SS_STATUS')
|
||||
|
||||
self.x1 = Motor(Id + ':MOTOR_X1')
|
||||
self.y1 = Motor(Id + ':MOTOR_Y1')
|
||||
self.y2 = Motor(Id + ':MOTOR_Y2')
|
||||
self.y3 = Motor(Id + ':MOTOR_Y3')
|
||||
self.z1 = Motor(Id + ':MOTOR_Z1')
|
||||
self.z2 = Motor(Id + ':MOTOR_Z2')
|
||||
self.x = Motor(Id + ':W_X')
|
||||
self.y = Motor(Id + ':W_Y')
|
||||
self.z = Motor(Id + ':W_Z')
|
||||
self.pitch = Motor(Id + ':W_RX')
|
||||
self.yaw = Motor(Id + ':W_RY')
|
||||
self.roll = Motor(Id + ':W_RZ')
|
||||
self.modeSP = PV(Id + ':MODE_SP')
|
||||
self.status = PV(Id + ':SS_STATUS')
|
||||
|
||||
def __str__(self):
|
||||
return "Prime Table position\nx: %s mm\ny: %s mm\nz: %s\npitch: %s mrad\nyaw: %s mrad\nmode SP: %s \nstatus: %s" \
|
||||
% (self.x.wm(),self.y.wm(),self.z.wm(),self.pitch.wm(),self.yaw.wm(),self.modeSP.get(as_string=True),self.status.get())
|
||||
@@ -68,8 +67,8 @@ class Microscope:
|
||||
self.Id = Id
|
||||
|
||||
### Microscope motors ###
|
||||
self.focus = MotorRecord(Id+':FOCUS')
|
||||
self.zoom = MotorRecord(Id+':ZOOM')
|
||||
self.focus = Motor(Id + ':FOCUS')
|
||||
self.zoom = Motor(Id + ':ZOOM')
|
||||
# self._smaractaxes = {
|
||||
# 'gonio': '_xmic_gon', # will become self.gonio
|
||||
# 'rot': '_xmic_rot'} # """ self.rot
|
||||
@@ -79,54 +78,56 @@ class Microscope:
|
||||
def __str__(self):
|
||||
return "Microscope positions\nfocus: %s\nzoom: %s\ngonio: %s\nrot: %s"\
|
||||
% (self.focus.wm(),self.zoom.wm(),self.gonio.wm(),self.rot.wm())
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return "{'Focus': %s, 'Zoom': %s, 'Gonio': %s, 'Rot': %s}"\
|
||||
% (self.focus.wm(),self.zoom.wm(),self.gonio.wm(),self.rot.wm())
|
||||
|
||||
|
||||
# prism (as a SmarAct-only stage) is defined purely in ../aliases/alvra.py
|
||||
|
||||
|
||||
class Vacuum:
|
||||
def __init__(self, Id, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
|
||||
# Vacuum PVs for Prime chamber
|
||||
self.spectrometerP = PV(Id + 'MFR125-600:PRESSURE')
|
||||
self.intermediateP = PV(Id + 'MCP125-510:PRESSURE')
|
||||
self.sampleP = PV(Id + 'MCP125-410:PRESSURE')
|
||||
self.pDiff = PV('SARES11-EVSP-010:DIFFERENT')
|
||||
self.regulationStatus = PV('SARES11-EVGA-STM010:ACTIV_MODE')
|
||||
self.spectrometerTurbo = PV(Id + 'PTM125-600:HZ')
|
||||
self.intermediateTurbo = PV(Id + 'PTM125-500:HZ')
|
||||
self.sampleTurbo = PV(Id + 'PTM125-400:HZ')
|
||||
self.KBvalve = PV(Id + 'VPG124-230:PLC_OPEN')
|
||||
|
||||
def __str__(self):
|
||||
valve = self.KBvalve.get()
|
||||
if valve == 0:
|
||||
valveStr = "KB valve closed"
|
||||
else:
|
||||
valveStr = "KB valve open"
|
||||
currSpecP = self.spectrometerP.get()
|
||||
currInterP = self.intermediateP.get()
|
||||
currSamP = self.sampleP.get()
|
||||
currPDiff = self.pDiff.get()
|
||||
regStatusStr = self.regulationStatus.get(as_string=True)
|
||||
currSpecTurbo = self.spectrometerTurbo.get()
|
||||
currInterTurbo = self.intermediateTurbo.get()
|
||||
currSamTurbo = self.sampleTurbo.get()
|
||||
|
||||
s = '**Prime chamber vacuum status**\n\n'
|
||||
s += 'Regulation mode: %s\n'%regStatusStr
|
||||
s += '%s\n'%valveStr
|
||||
s += 'Spectrometer pressure: %.3g mbar\n'%currSpecP
|
||||
s += 'Spectrometer Turbo pump: %s Hz\n'%currSpecTurbo
|
||||
s += 'Intermediate pressure: %.3g mbar\n'%currInterP
|
||||
s += 'Intermediate Turbo pump: %s Hz\n'%currInterTurbo
|
||||
s += 'Sample pressure: %.3g mbar\n'%currSamP
|
||||
s += 'Sample Turbo pump: %s Hz\n'%currSamTurbo
|
||||
s += 'Intermediate/Sample pressure difference: %.3g mbar\n'%currPDiff
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
def __init__(self, Id, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
|
||||
# Vacuum PVs for Prime chamber
|
||||
self.spectrometerP = PV(Id + 'MFR125-600:PRESSURE')
|
||||
self.intermediateP = PV(Id + 'MCP125-510:PRESSURE')
|
||||
self.sampleP = PV(Id + 'MCP125-410:PRESSURE')
|
||||
self.pDiff = PV('SARES11-EVSP-010:DIFFERENT')
|
||||
self.regulationStatus = PV('SARES11-EVGA-STM010:ACTIV_MODE')
|
||||
self.spectrometerTurbo = PV(Id + 'PTM125-600:HZ')
|
||||
self.intermediateTurbo = PV(Id + 'PTM125-500:HZ')
|
||||
self.sampleTurbo = PV(Id + 'PTM125-400:HZ')
|
||||
self.KBvalve = PV(Id + 'VPG124-230:PLC_OPEN')
|
||||
|
||||
def __str__(self):
|
||||
valve = self.KBvalve.get()
|
||||
if valve == 0:
|
||||
valveStr = "KB valve closed"
|
||||
else:
|
||||
valveStr = "KB valve open"
|
||||
currSpecP = self.spectrometerP.get()
|
||||
currInterP = self.intermediateP.get()
|
||||
currSamP = self.sampleP.get()
|
||||
currPDiff = self.pDiff.get()
|
||||
regStatusStr = self.regulationStatus.get(as_string=True)
|
||||
currSpecTurbo = self.spectrometerTurbo.get()
|
||||
currInterTurbo = self.intermediateTurbo.get()
|
||||
currSamTurbo = self.sampleTurbo.get()
|
||||
|
||||
s = '**Prime chamber vacuum status**\n\n'
|
||||
s += 'Regulation mode: %s\n'%regStatusStr
|
||||
s += '%s\n'%valveStr
|
||||
s += 'Spectrometer pressure: %.3g mbar\n'%currSpecP
|
||||
s += 'Spectrometer Turbo pump: %s Hz\n'%currSpecTurbo
|
||||
s += 'Intermediate pressure: %.3g mbar\n'%currInterP
|
||||
s += 'Intermediate Turbo pump: %s Hz\n'%currInterTurbo
|
||||
s += 'Sample pressure: %.3g mbar\n'%currSamP
|
||||
s += 'Sample Turbo pump: %s Hz\n'%currSamTurbo
|
||||
s += 'Intermediate/Sample pressure difference: %.3g mbar\n'%currPDiff
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..general.detectors import CameraCA, CameraBS
|
||||
from slic.core.adjustable import PVAdjustable
|
||||
from slic.utils.eco_components.aliases import Alias, append_object_to_object
|
||||
@@ -8,8 +8,8 @@ from epics import PV
|
||||
from slic.utils.eco_epics.utilities_epics import EnumWrapper
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, Id=None, name=None):
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
def addMotorToSelf(self, Id=None, name=None):
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
|
||||
|
||||
@@ -79,10 +79,10 @@ class Qioptiq:
|
||||
self.name = name
|
||||
|
||||
if zoomstage_pv:
|
||||
append_object_to_object(self, MotorRecord, zoomstage_pv, name="zoom")
|
||||
append_object_to_object(self, Motor, zoomstage_pv, name="zoom")
|
||||
|
||||
try:
|
||||
addMotorRecordToSelf(self, Id="SARES20-EXP:MOT_QIOPT_F", name="focus")
|
||||
addMotorToSelf(self, Id="SARES20-EXP:MOT_QIOPT_F", name="focus")
|
||||
|
||||
except:
|
||||
print("Qioptic focus motor not found")
|
||||
@@ -107,3 +107,6 @@ class Qioptiq:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.core.adjustable import PVAdjustable
|
||||
|
||||
from epics import PV
|
||||
from slic.utils.eco_components.aliases import Alias, append_object_to_object
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, name=None, Id=None):
|
||||
def addMotorToSelf(self, name=None, Id=None):
|
||||
try:
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
except:
|
||||
print(f"Warning! Could not find motor {name} (Id:{Id})")
|
||||
@@ -24,27 +24,27 @@ class GPS:
|
||||
|
||||
if "base" in self.configuration:
|
||||
### motors base platform ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TX", name="xbase")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TY", name="ybase")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_RX", name="rxbase")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_MY_RYTH", name="alpha")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TX", name="xbase")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TY", name="ybase")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_RX", name="rxbase")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_MY_RYTH", name="alpha")
|
||||
|
||||
### motors XRD detector arm ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_NY_RY2TH", name="gamma")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_NY_RY2TH", name="gamma")
|
||||
|
||||
if "phi_table" in self.configuration:
|
||||
### motors phi table ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_RX", name="phi")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_TX", name="tphi")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_HEX_RX", name="phi")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_HEX_TX", name="tphi")
|
||||
|
||||
if "phi_hex" in self.configuration:
|
||||
### motors PI hexapod ###
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-X",pvname_readback="SARES20-HEX_PI:POSI-X",name='xhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-Y",pvname_readback="SARES20-HEX_PI:POSI-Y",name='yhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-Z",pvname_readback="SARES20-HEX_PI:POSI-Z",name='zhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-U",pvname_readback="SARES20-HEX_PI:POSI-U",name='uhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-V",pvname_readback="SARES20-HEX_PI:POSI-V",name='vhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-W",pvname_readback="SARES20-HEX_PI:POSI-W",name='whex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-X", pvname_readback="SARES20-HEX_PI:POSI-X", name='xhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-Y", pvname_readback="SARES20-HEX_PI:POSI-Y", name='yhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-Z", pvname_readback="SARES20-HEX_PI:POSI-Z", name='zhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-U", pvname_readback="SARES20-HEX_PI:POSI-U", name='uhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-V", pvname_readback="SARES20-HEX_PI:POSI-V", name='vhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-W", pvname_readback="SARES20-HEX_PI:POSI-W", name='whex')
|
||||
# self.hex_x = PV("SARES20-HEX_PI:POSI-X")
|
||||
# self.hex_y = PV("SARES20-HEX_PI:POSI-Y")
|
||||
# self.hex_z = PV("SARES20-HEX_PI:POSI-Z")
|
||||
@@ -54,16 +54,16 @@ class GPS:
|
||||
|
||||
if "hlxz" in self.configuration:
|
||||
### motors heavy load goniometer ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TX", name="xhl")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TZ", name="zhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_TX", name="xhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_TZ", name="zhl")
|
||||
|
||||
if "hly" in self.configuration:
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TY", name="yhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_TY", name="yhl")
|
||||
|
||||
if "hlrxrz" in self.configuration:
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RX", name="rxhl")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RZ", name="rzhl")
|
||||
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_RX", name="rxhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_RZ", name="rzhl")
|
||||
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
ostr = "*****GPS motor positions******\n"
|
||||
@@ -91,64 +91,64 @@ class XRD:
|
||||
if "base" in self.configuration:
|
||||
### motors base platform ###
|
||||
### motors base platform ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TX", name="xbase")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TY", name="ybase")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_RX", name="rxbase")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_MY_RYTH", name="alpha")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TX", name="xbase")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TY", name="ybase")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_RX", name="rxbase")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_MY_RYTH", name="alpha")
|
||||
|
||||
if "arm" in self.configuration:
|
||||
### motors XRD detector arm ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_NY_RY2TH", name="gamma")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_DT_RX2TH", name="delta")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_NY_RY2TH", name="gamma")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_DT_RX2TH", name="delta")
|
||||
### motors XRD area detector branch ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_D_T", name="tdet")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_D_T", name="tdet")
|
||||
|
||||
### motors XRD polarisation analyzer branch ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_P_T", name="tpol")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_P_T", name="tpol")
|
||||
# missing: slits of flight tube
|
||||
|
||||
if "hlxz" in self.configuration:
|
||||
### motors heavy load goniometer ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TX", name="xhl")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TZ", name="zhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_TX", name="xhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_TZ", name="zhl")
|
||||
if "hly" in self.configuration:
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_TY", name="yhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_TY", name="yhl")
|
||||
|
||||
if "hlrxrz" in self.configuration:
|
||||
try:
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RX", name="rxhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_RX", name="rxhl")
|
||||
except:
|
||||
print("XRD.rxhl not found")
|
||||
pass
|
||||
try:
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_TBL_RY", name="rzhl")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_TBL_RY", name="rzhl")
|
||||
except:
|
||||
print("XRD.rzhl not found")
|
||||
pass
|
||||
|
||||
if "phi_table" in self.configuration:
|
||||
### motors nu table ###
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_TX", name="tphi")
|
||||
addMotorRecordToSelf(self, Id=Id + ":MOT_HEX_RX", name="phi")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_HEX_TX", name="tphi")
|
||||
addMotorToSelf(self, Id=Id + ":MOT_HEX_RX", name="phi")
|
||||
|
||||
if "phi_hex" in self.configuration:
|
||||
### motors PI hexapod ###
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-X",pvname_readback="SARES20-HEX_PI:POSI-X",name='xhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-Y",pvname_readback="SARES20-HEX_PI:POSI-Y",name='yhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-Z",pvname_readback="SARES20-HEX_PI:POSI-Z",name='zhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-U",pvname_readback="SARES20-HEX_PI:POSI-U",name='uhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-V",pvname_readback="SARES20-HEX_PI:POSI-V",name='vhex')
|
||||
append_object_to_object(self,PVAdjustable,"SARES20-HEX_PI:SET-POSI-W",pvname_readback="SARES20-HEX_PI:POSI-W",name='whex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-X", pvname_readback="SARES20-HEX_PI:POSI-X", name='xhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-Y", pvname_readback="SARES20-HEX_PI:POSI-Y", name='yhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-Z", pvname_readback="SARES20-HEX_PI:POSI-Z", name='zhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-U", pvname_readback="SARES20-HEX_PI:POSI-U", name='uhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-V", pvname_readback="SARES20-HEX_PI:POSI-V", name='vhex')
|
||||
append_object_to_object(self, PVAdjustable, "SARES20-HEX_PI:SET-POSI-W", pvname_readback="SARES20-HEX_PI:POSI-W", name='whex')
|
||||
|
||||
if "kappa" in self.configuration:
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_KRX",name='eta')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_KAP",name='kappa')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_KPH",name='phi')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_DTY",name='zkap')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_DTX",name='xkap')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_DTZ",name='ykap')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_DRX",name='rxkap')
|
||||
append_object_to_object(self,MotorRecord,"SARES21-XRD:MOT_KAP_DRZ",name='rykap')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_KRX", name='eta')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_KAP", name='kappa')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_KPH", name='phi')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_DTY", name='zkap')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_DTX", name='xkap')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_DTZ", name='ykap')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_DRX", name='rxkap')
|
||||
append_object_to_object(self, Motor, "SARES21-XRD:MOT_KAP_DRZ", name='rykap')
|
||||
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
@@ -162,3 +162,6 @@ class XRD:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
from ..devices_general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class EXP:
|
||||
def __init__(self,Id,alias_namespace=None):
|
||||
self.Id = Id
|
||||
|
||||
|
||||
### motors 1.5M JF Zaber ###
|
||||
#self.det_x = MotorRecord(Id+':MOT_TX')
|
||||
#self.det_y = MotorRecord(Id+':MOT_TY')
|
||||
self.zaber_x = MotorRecord(Id+':MOT_TZ')
|
||||
self.qioptiq_zoom = MotorRecord(Id+':MOT_QIOPT_Z')
|
||||
#self.det_x = Motor(Id + ':MOT_TX')
|
||||
#self.det_y = Motor(Id + ':MOT_TY')
|
||||
self.zaber_x = Motor(Id + ':MOT_TZ')
|
||||
self.qioptiq_zoom = Motor(Id + ':MOT_QIOPT_Z')
|
||||
|
||||
### motors crystal ###
|
||||
#self.c_focus = MotorRecord(Id+':MOT_VT80')
|
||||
#self.c_rot = MotorRecord(Id+':MOT_ROT')
|
||||
#self.c_focus = Motor(Id + ':MOT_VT80')
|
||||
#self.c_rot = Motor(Id + ':MOT_ROT')
|
||||
|
||||
def __repr__(self):
|
||||
s = "**Detector and crystal positions**\n"
|
||||
motors = "zaber_x qioptiq_zoom".split()
|
||||
for motor in motors:
|
||||
s+= " - %s %.4f\n"%(motor,getattr(self,motor).wm())
|
||||
s+= " - %s %.4f\n"%(motor, getattr(self, motor).wm())
|
||||
s+= "\n"
|
||||
|
||||
return s
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +1,33 @@
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
from ..devices_general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class GPS:
|
||||
def __init__(self,Id,alias_namespace=None):
|
||||
def __init__(self, Id, alias_namespace=None):
|
||||
self.Id = Id
|
||||
|
||||
|
||||
### motors heavy load gps table ###
|
||||
self.xhl = MotorRecord(Id+':MOT_TBL_TX')
|
||||
self.zhl = MotorRecord(Id+':MOT_TBL_TZ')
|
||||
self.yhl = MotorRecord(Id+':MOT_TBL_TY')
|
||||
self.th = MotorRecord(Id+':MOT_MY_RYTH')
|
||||
self.xhl = Motor(Id + ':MOT_TBL_TX')
|
||||
self.zhl = Motor(Id + ':MOT_TBL_TZ')
|
||||
self.yhl = Motor(Id + ':MOT_TBL_TY')
|
||||
self.th = Motor(Id + ':MOT_MY_RYTH')
|
||||
try:
|
||||
self.rxhl = MotorRecord(Id+':MOT_TBL_RX')
|
||||
self.rxhl = Motor(Id + ':MOT_TBL_RX')
|
||||
except:
|
||||
print ('GPS.pitch not found')
|
||||
pass
|
||||
try:
|
||||
self.ryhl = MotorRecord(Id+':MOT_TBL_RY')
|
||||
self.ryhl = Motor(Id + ':MOT_TBL_RY')
|
||||
except:
|
||||
print ('GPS.roll not found')
|
||||
pass
|
||||
|
||||
### motors heavy load gonio base ###
|
||||
self.xmu = MotorRecord(Id+':MOT_HEX_TX')
|
||||
self.mu = MotorRecord(Id+':MOT_HEX_RX')
|
||||
self.tth = MotorRecord(Id+':MOT_NY_RY2TH')
|
||||
self.xbase = MotorRecord(Id+':MOT_TX')
|
||||
self.ybase = MotorRecord(Id+':MOT_TY')
|
||||
self.xmu = Motor(Id + ':MOT_HEX_TX')
|
||||
self.mu = Motor(Id + ':MOT_HEX_RX')
|
||||
self.tth = Motor(Id + ':MOT_NY_RY2TH')
|
||||
self.xbase = Motor(Id + ':MOT_TX')
|
||||
self.ybase = Motor(Id + ':MOT_TY')
|
||||
|
||||
self.hex_x = PV("SARES20-HEX_PI:POSI-X")
|
||||
self.hex_y = PV("SARES20-HEX_PI:POSI-Y")
|
||||
@@ -61,4 +59,6 @@ class GPS:
|
||||
for motor in motors:
|
||||
s+= " - hex_%s %.4f\n"%(motor,getattr(self,"hex_"+motor).get())
|
||||
return s
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,36 +1,34 @@
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
from ..devices_general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class XRD:
|
||||
def __init__(self,Id,alias_namespace=None):
|
||||
def __init__(self, Id, alias_namespace=None):
|
||||
self.Id = Id
|
||||
|
||||
|
||||
### motors heavy load table ###
|
||||
self.xhl = MotorRecord(Id+':MOT_TBL_TX')
|
||||
self.zhl = MotorRecord(Id+':MOT_TBL_TZ')
|
||||
self.yhl = MotorRecord(Id+':MOT_TBL_TY')
|
||||
self.th = MotorRecord(Id+':MOT_MY_RYTH')
|
||||
self.zaber_x = MotorRecord('SARES20-EXP'+':MOT_TZ')
|
||||
self.xhl = Motor(Id + ':MOT_TBL_TX')
|
||||
self.zhl = Motor(Id + ':MOT_TBL_TZ')
|
||||
self.yhl = Motor(Id + ':MOT_TBL_TY')
|
||||
self.th = Motor(Id + ':MOT_MY_RYTH')
|
||||
self.zaber_x = Motor('SARES20-EXP' + ':MOT_TZ')
|
||||
try:
|
||||
self.rxhl = MotorRecord(Id+':MOT_TBL_RX')
|
||||
self.rxhl = Motor(Id + ':MOT_TBL_RX')
|
||||
except:
|
||||
print ('GPS.pitch not found')
|
||||
pass
|
||||
try:
|
||||
self.ryhl = MotorRecord(Id+':MOT_TBL_RY')
|
||||
self.ryhl = Motor(Id + ':MOT_TBL_RY')
|
||||
except:
|
||||
print ('GPS.roll not found')
|
||||
pass
|
||||
|
||||
### motors heavy load gonio base ###
|
||||
#self.xmu = MotorRecord(Id+':MOT_HEX_TX')
|
||||
#self.mu = MotorRecord(Id+':MOT_HEX_RX')
|
||||
self.gamma = MotorRecord(Id+':MOT_NY_RY2TH')
|
||||
self.xbase = MotorRecord(Id+':MOT_TX')
|
||||
self.ybase = MotorRecord(Id+':MOT_TY')
|
||||
#self.xmu = Motor(Id + ':MOT_HEX_TX')
|
||||
#self.mu = Motor(Id + ':MOT_HEX_RX')
|
||||
self.gamma = Motor(Id + ':MOT_NY_RY2TH')
|
||||
self.xbase = Motor(Id + ':MOT_TX')
|
||||
self.ybase = Motor(Id + ':MOT_TY')
|
||||
|
||||
#self.hex_x = PV("SARES20-HEX_PI:POSI-X")
|
||||
#self.hex_y = PV("SARES20-HEX_PI:POSI-Y")
|
||||
@@ -39,12 +37,10 @@ class XRD:
|
||||
#self.hex_v = PV("SARES20-HEX_PI:POSI-V")
|
||||
#self.hex_w = PV("SARES20-HEX_PI:POSI-W")
|
||||
|
||||
|
||||
### motors XRD arm ###
|
||||
self.delta = MotorRecord(Id+':MOT_DT_RX2TH')
|
||||
self.det_z = MotorRecord(Id+':MOT_D_T')
|
||||
self.cam_z = MotorRecord(Id+':MOT_P_T')
|
||||
|
||||
self.delta = Motor(Id + ':MOT_DT_RX2TH')
|
||||
self.det_z = Motor(Id + ':MOT_D_T')
|
||||
self.cam_z = Motor(Id + ':MOT_P_T')
|
||||
|
||||
|
||||
|
||||
@@ -66,4 +62,6 @@ class XRD:
|
||||
#for motor in motors:
|
||||
# s+= " - hex_%s %.4f\n"%(motor,getattr(self,"hex_"+motor).get())
|
||||
return s
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import sys
|
||||
|
||||
sys.path.append("..")
|
||||
from ..devices_general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..aliases import Alias
|
||||
|
||||
|
||||
@@ -16,40 +13,40 @@ class XRD:
|
||||
self.alias = Alias(name)
|
||||
|
||||
### motors base platform ###
|
||||
self.xbase = MotorRecord(Id + ":MOT_TX", name="xbase")
|
||||
self.ybase = MotorRecord(Id + ":MOT_TY", name="ybase")
|
||||
self.rxbase = MotorRecord(Id + ":MOT_RX", name="rxbase")
|
||||
self.omega = MotorRecord(Id + ":MOT_MY_RYTH", name="omega")
|
||||
self.xbase = Motor(Id + ":MOT_TX", name="xbase")
|
||||
self.ybase = Motor(Id + ":MOT_TY", name="ybase")
|
||||
self.rxbase = Motor(Id + ":MOT_RX", name="rxbase")
|
||||
self.omega = Motor(Id + ":MOT_MY_RYTH", name="omega")
|
||||
|
||||
### motors XRD detector arm ###
|
||||
self.gamma = MotorRecord(Id + ":MOT_NY_RY2TH", name="gam")
|
||||
self.delta = MotorRecord(Id + ":MOT_DT_RX2TH", name="del")
|
||||
self.gamma = Motor(Id + ":MOT_NY_RY2TH", name="gam")
|
||||
self.delta = Motor(Id + ":MOT_DT_RX2TH", name="del")
|
||||
|
||||
### motors XRD area detector branch ###
|
||||
self.tdet = MotorRecord(Id + ":MOT_D_T", name="tdet")
|
||||
self.tdet = Motor(Id + ":MOT_D_T", name="tdet")
|
||||
|
||||
### motors XRD polarisation analyzer branch ###
|
||||
self.tpol = MotorRecord(Id + ":MOT_P_T", name="tpol")
|
||||
self.tpol = Motor(Id + ":MOT_P_T", name="tpol")
|
||||
# missing: slits of flight tube
|
||||
|
||||
### motors heavy load goniometer ###
|
||||
self.xhl = MotorRecord(Id + ":MOT_TBL_TX", name="xhl")
|
||||
self.zhl = MotorRecord(Id + ":MOT_TBL_TZ", name="zhl")
|
||||
self.yhl = MotorRecord(Id + ":MOT_TBL_TY", name="yhl")
|
||||
self.xhl = Motor(Id + ":MOT_TBL_TX", name="xhl")
|
||||
self.zhl = Motor(Id + ":MOT_TBL_TZ", name="zhl")
|
||||
self.yhl = Motor(Id + ":MOT_TBL_TY", name="yhl")
|
||||
try:
|
||||
self.rxhl = MotorRecord(Id + ":MOT_TBL_RX", name="rxhl")
|
||||
self.rxhl = Motor(Id + ":MOT_TBL_RX", name="rxhl")
|
||||
except:
|
||||
print("GPS.pitch not found")
|
||||
pass
|
||||
try:
|
||||
self.ryhl = MotorRecord(Id + ":MOT_TBL_RY", name="rxhl")
|
||||
self.ryhl = Motor(Id + ":MOT_TBL_RY", name="rxhl")
|
||||
except:
|
||||
print("GPS.roll not found")
|
||||
pass
|
||||
|
||||
### motors nu table ###
|
||||
self.tnu = MotorRecord(Id + ":MOT_HEX_TX", name="tnu")
|
||||
self.nu = MotorRecord(Id + ":MOT_HEX_RX", name="nu")
|
||||
self.tnu = Motor(Id + ":MOT_HEX_TX", name="tnu")
|
||||
self.nu = Motor(Id + ":MOT_HEX_RX", name="nu")
|
||||
|
||||
### motors PI hexapod ###
|
||||
self.hex_x = PV("SARES20-HEX_PI:POSI-X")
|
||||
@@ -82,3 +79,6 @@ class XRD:
|
||||
for motor in motors:
|
||||
s += " - hex_%s %.4f\n" % (motor, getattr(self, "hex_" + motor).get())
|
||||
return s
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
from . import alvra_timing
|
||||
from . import motors
|
||||
from . import motor
|
||||
from . import smaract
|
||||
from . import delay_stage
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from .motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
SPEED_OF_LIGHT = 299792458 # m/s
|
||||
@@ -20,7 +20,7 @@ def pos_to_delay(pos):
|
||||
class DelayStage:
|
||||
|
||||
def __init__(self, channel):
|
||||
self.motor = MotorRecord(channel)
|
||||
self.motor = Motor(channel)
|
||||
self.delay = Delay(self.motor)
|
||||
|
||||
def __repr__(self):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.utils.eco_components.aliases import Alias, append_object_to_object
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, name=None, Id=None):
|
||||
def addMotorToSelf(self, name=None, Id=None):
|
||||
try:
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
except:
|
||||
print(f"Warning! Could not find motor {name} (Id:{Id})")
|
||||
@@ -12,14 +12,14 @@ def addMotorRecordToSelf(self, name=None, Id=None):
|
||||
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self.alias = Alias(name)
|
||||
|
||||
self.alias = Alias(name)
|
||||
|
||||
class stage:
|
||||
def __init__( self, name=None,vonHamos_horiz_pv=None,vonHamos_vert_pv = None ):
|
||||
self.name = name
|
||||
self.alias = Alias(name)
|
||||
addMotorRecordToSelf(self, Id=vonHamos_horiz_pv, name="horiz")
|
||||
addMotorRecordToSelf(self, Id=vonHamos_vert_pv, name="vert")
|
||||
addMotorToSelf(self, Id=vonHamos_horiz_pv, name="horiz")
|
||||
addMotorToSelf(self, Id=vonHamos_vert_pv, name="vert")
|
||||
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
@@ -33,3 +33,6 @@ class stage:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
from slic.core.adjustable import Adjustable
|
||||
from slic.utils.eco_epics.motor import Motor as _Motor
|
||||
import subprocess
|
||||
from epics import PV
|
||||
from slic.core.task import Task
|
||||
|
||||
_MotorRocordStandardProperties = \
|
||||
{}
|
||||
_posTypes = ['user','dial','raw']
|
||||
_guiTypes = ['xdm']
|
||||
|
||||
|
||||
_status_messages = {
|
||||
-13 : 'invalid value (cannot convert to float). Move not attempted.',
|
||||
-12 : 'target value outside soft limits. Move not attempted.',
|
||||
-11 : 'drive PV is not connected: Move not attempted.',
|
||||
-8 : 'move started, but timed-out.',
|
||||
-7 : 'move started, timed-out, but appears done.',
|
||||
-5 : 'move started, unexpected return value from PV.put()',
|
||||
-4 : 'move-with-wait finished, soft limit violation seen',
|
||||
-3 : 'move-with-wait finished, hard limit violation seen',
|
||||
0 : 'move-with-wait finish OK.',
|
||||
0 : 'move-without-wait executed, not confirmed',
|
||||
1 : 'move-without-wait executed, move confirmed' ,
|
||||
3 : 'move-without-wait finished, hard limit violation seen',
|
||||
4 : 'move-without-wait finished, soft limit violation seen',
|
||||
}
|
||||
|
||||
|
||||
def _keywordChecker(kw_key_list_tups):
|
||||
for tkw,tkey,tlist in kw_key_list_tups:
|
||||
assert tkey in tlist, "Keyword %s should be one of %s"%(tkw,tlist)
|
||||
|
||||
class MotorRecord(Adjustable):
|
||||
def __init__(self,pvname, name=None, elog=None):
|
||||
self.Id = pvname
|
||||
self._motor = _Motor(pvname)
|
||||
self._elog = elog
|
||||
self.name = name
|
||||
self._currentChange = None
|
||||
|
||||
|
||||
@property
|
||||
def alias(self):
|
||||
print("fake alias for", self.Id)
|
||||
return self.name
|
||||
|
||||
|
||||
# Conventional methods and properties for all Adjustable objects
|
||||
def set_target_value(self, value, hold=False, check=True):
|
||||
""" Adjustable convention"""
|
||||
|
||||
def changer():
|
||||
self._status = self._motor.move(\
|
||||
value, ignore_limits=(not check),
|
||||
wait=True)
|
||||
self._status_message = _status_messages[self._status]
|
||||
if not self._status==0:
|
||||
print(self._status_message)
|
||||
|
||||
# changer = lambda value: self._motor.move(\
|
||||
# value, ignore_limits=(not check),
|
||||
# wait=True)
|
||||
return Task(changer, hold=hold, stopper=self._motor.stop)
|
||||
|
||||
|
||||
def stop(self):
|
||||
""" Adjustable convention"""
|
||||
try:
|
||||
self._currentChange.stop()
|
||||
except:
|
||||
self._motor.stop()
|
||||
pass
|
||||
|
||||
|
||||
def get_current_value(self,posType='user',readback=True):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([('posType',posType,_posTypes)])
|
||||
if posType == 'user':
|
||||
return self._motor.get_position( readback=readback)
|
||||
if posType == 'dial':
|
||||
return self._motor.get_position( readback=readback, dial=True)
|
||||
if posType == 'raw':
|
||||
return self._motor.get_position( readback=readback, raw=True)
|
||||
|
||||
def set_current_value(self,value,posType='user'):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([('posType',posType,_posTypes)])
|
||||
if posType == 'user':
|
||||
return self._motor.set_position(value)
|
||||
if posType == 'dial':
|
||||
return self._motor.set_position(value,dial=True)
|
||||
if posType == 'raw':
|
||||
return self._motor.set_position(value,raw=True)
|
||||
|
||||
def get_precision(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
def set_precision(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
precision = property(get_precision,set_precision)
|
||||
|
||||
def set_speed(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
def get_speed(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
def set_speedMax(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
def is_moving(self):
|
||||
""" Adjustable convention"""
|
||||
res = PV(str(self.Id + ".DMOV")).value # 0: moving 1: move done
|
||||
return not bool(res)
|
||||
|
||||
def set_limits(self, values, posType='user', relative_to_present=False):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([('posType',posType,_posTypes)])
|
||||
ll_name, hl_name = 'LLM', 'HLM'
|
||||
if posType is 'dial':
|
||||
ll_name, hl_name = 'DLLM', 'DHLM'
|
||||
if relative_to_present:
|
||||
v = self.get_current_value(posType=posType)
|
||||
values = [v+values[0],v+values[1]]
|
||||
self._motor.put(ll_name,values[0])
|
||||
self._motor.put(hl_name,values[1])
|
||||
|
||||
def get_limits(self, posType='user'):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([('posType',posType,_posTypes)])
|
||||
ll_name, hl_name = 'LLM', 'HLM'
|
||||
if posType is 'dial':
|
||||
ll_name, hl_name = 'DLLM', 'DHLM'
|
||||
return self._motor.get(ll_name), self._motor.get(hl_name)
|
||||
|
||||
def gui(self, guiType='xdm'):
|
||||
""" Adjustable convention"""
|
||||
cmd = ['caqtdm','-macro']
|
||||
|
||||
cmd.append('\"P=%s:,M=%s\"'%tuple(self.Id.split(':')))
|
||||
#cmd.append('/sf/common/config/qt/motorx_more.ui')
|
||||
cmd.append('motorx_more.ui')
|
||||
#os.system(' '.join(cmd))
|
||||
return subprocess.Popen(' '.join(cmd),shell=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# epics motor record specific methods
|
||||
|
||||
|
||||
# spec-inspired convenience methods
|
||||
def mv(self,value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
def wm(self,*args,**kwargs):
|
||||
return self.get_current_value(*args,**kwargs)
|
||||
def mvr(self,value,*args,**kwargs):
|
||||
|
||||
if not self.is_moving():
|
||||
startvalue = self.get_current_value(readback=True,*args,**kwargs)
|
||||
else:
|
||||
startvalue = self.get_current_value(readback=False,*args,**kwargs)
|
||||
self._currentChange = self.set_target_value(value+startvalue,*args,**kwargs)
|
||||
def wait(self):
|
||||
self._currentChange.wait()
|
||||
|
||||
|
||||
# return string with motor value as variable representation
|
||||
def __str__(self):
|
||||
return "Motor at %s mm" % self.wm()
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __call__(self,value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
|
||||
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
from slic.utils.eco_epics.motor import Motor as _Motor
|
||||
from slic.utils.eco_epics.utilities_epics import EpicsString
|
||||
import subprocess
|
||||
from epics import PV
|
||||
from slic.core.task import Task
|
||||
from slic.utils.eco_components.aliases import Alias
|
||||
from slic.core.adjustable.convenience import SpecConvenience
|
||||
from .motors_new_helper import update_changes, ValueInRange, AdjustableError
|
||||
import colorama
|
||||
|
||||
_MotorRocordStandardProperties = {}
|
||||
_posTypes = ["user", "dial", "raw"]
|
||||
_guiTypes = ["xdm"]
|
||||
|
||||
|
||||
_status_messages = {
|
||||
-13: "invalid value (cannot convert to float). Move not attempted.",
|
||||
-12: "target value outside soft limits. Move not attempted.",
|
||||
-11: "drive PV is not connected: Move not attempted.",
|
||||
-8: "move started, but timed-out.",
|
||||
-7: "move started, timed-out, but appears done.",
|
||||
-5: "move started, unexpected return value from PV.put()",
|
||||
-4: "move-with-wait finished, soft limit violation seen",
|
||||
-3: "move-with-wait finished, hard limit violation seen",
|
||||
0: "move-with-wait finish OK.",
|
||||
1: "move-without-wait executed, not confirmed",
|
||||
2: "move-without-wait executed, move confirmed",
|
||||
3: "move-without-wait finished, hard limit violation seen",
|
||||
4: "move-without-wait finished, soft limit violation seen",
|
||||
}
|
||||
|
||||
|
||||
def _keywordChecker(kw_key_list_tups):
|
||||
for tkw, tkey, tlist in kw_key_list_tups:
|
||||
assert tkey in tlist, "Keyword %s should be one of %s" % (tkw, tlist)
|
||||
|
||||
|
||||
@update_changes
|
||||
class MotorRecord(SpecConvenience):
|
||||
def __init__(
|
||||
self,
|
||||
pvname,
|
||||
name=None,
|
||||
elog=None,
|
||||
alias_fields={"readback": "RBV", "user_offset": "OFF"},
|
||||
):
|
||||
self.Id = pvname
|
||||
self._motor = _Motor(pvname)
|
||||
self._elog = elog
|
||||
self.name = name
|
||||
self.alias = Alias(name)
|
||||
for an, af in alias_fields.items():
|
||||
self.alias.append(
|
||||
Alias(an, channel=".".join([pvname, af]), channeltype="CA")
|
||||
)
|
||||
self._currentChange = None
|
||||
self.description = EpicsString(pvname+'.DESC')
|
||||
|
||||
# Conventional methods and properties for all Adjustable objects
|
||||
def set_target_value(self, value, hold=False, check=True):
|
||||
""" Adjustable convention"""
|
||||
|
||||
def changer():
|
||||
self._status = self._motor.move(value, ignore_limits=(not check), wait=True)
|
||||
self._status_message = _status_messages[self._status]
|
||||
if self._status < 0:
|
||||
raise AdjustableError(self._status_message)
|
||||
elif self._status > 0:
|
||||
print("\n")
|
||||
print(self._status_message)
|
||||
|
||||
# changer = lambda value: self._motor.move(\
|
||||
# value, ignore_limits=(not check),
|
||||
# wait=True)
|
||||
return Task(changer, hold=hold, stopper=self._motor.stop)
|
||||
|
||||
def stop(self):
|
||||
""" Adjustable convention"""
|
||||
try:
|
||||
self._currentChange.stop()
|
||||
except:
|
||||
self._motor.stop()
|
||||
pass
|
||||
|
||||
def get_current_value(self, posType="user", readback=True):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([("posType", posType, _posTypes)])
|
||||
if posType == "user":
|
||||
return self._motor.get_position(readback=readback)
|
||||
if posType == "dial":
|
||||
return self._motor.get_position(readback=readback, dial=True)
|
||||
if posType == "raw":
|
||||
return self._motor.get_position(readback=readback, raw=True)
|
||||
|
||||
def reset_current_value_to(self, value, posType="user"):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([("posType", posType, _posTypes)])
|
||||
if posType == "user":
|
||||
return self._motor.set_position(value)
|
||||
if posType == "dial":
|
||||
return self._motor.set_position(value, dial=True)
|
||||
if posType == "raw":
|
||||
return self._motor.set_position(value, raw=True)
|
||||
|
||||
def get_precision(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
def set_precision(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
precision = property(get_precision, set_precision)
|
||||
|
||||
def set_speed(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
def get_speed(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
def set_speedMax(self):
|
||||
""" Adjustable convention"""
|
||||
pass
|
||||
|
||||
def is_moving(self):
|
||||
""" Adjustable convention"""
|
||||
res = PV(str(self.Id + ".DMOV")).value # 0: moving 1: move done
|
||||
return not bool(res)
|
||||
|
||||
def set_limits(
|
||||
self, low_limit, high_limit, posType="user", relative_to_present=False
|
||||
):
|
||||
"""
|
||||
set limits. usage: set_limits(low_limit, high_limit)
|
||||
|
||||
"""
|
||||
_keywordChecker([("posType", posType, _posTypes)])
|
||||
ll_name, hl_name = "LLM", "HLM"
|
||||
if posType is "dial":
|
||||
ll_name, hl_name = "DLLM", "DHLM"
|
||||
if relative_to_present:
|
||||
v = self.get_current_value(posType=posType)
|
||||
low_limit = v + low_limit
|
||||
high_limit = v + high_limit
|
||||
self._motor.put(ll_name, low_limit)
|
||||
self._motor.put(hl_name, high_limit)
|
||||
|
||||
def add_value_callback(self, callback, index=None):
|
||||
return self._motor.get_pv("RBV").add_callback(callback=callback, index=index)
|
||||
|
||||
def clear_value_callback(self, index=None):
|
||||
if index:
|
||||
self._motor.get_pv("RBV").remove_callback(index)
|
||||
else:
|
||||
self._motor.get_pv("RBV").clear_callbacks()
|
||||
|
||||
def get_limits(self, posType="user"):
|
||||
""" Adjustable convention"""
|
||||
_keywordChecker([("posType", posType, _posTypes)])
|
||||
ll_name, hl_name = "LLM", "HLM"
|
||||
if posType is "dial":
|
||||
ll_name, hl_name = "DLLM", "DHLM"
|
||||
return self._motor.get(ll_name), self._motor.get(hl_name)
|
||||
|
||||
def gui(self, guiType="xdm"):
|
||||
""" Adjustable convention"""
|
||||
cmd = ["caqtdm", "-macro"]
|
||||
|
||||
cmd.append('"P=%s:,M=%s"' % tuple(self.Id.split(":")))
|
||||
# cmd.append('/sf/common/config/qt/motorx_more.ui')
|
||||
cmd.append("motorx_more.ui")
|
||||
# os.system(' '.join(cmd))
|
||||
return subprocess.Popen(" ".join(cmd), shell=True)
|
||||
|
||||
# return string with motor value as variable representation
|
||||
def __str__(self):
|
||||
# """ return short info for the current motor"""
|
||||
s = f"{self.name}"
|
||||
s += f"\t@ {colorama.Style.BRIGHT}{self.get_current_value():1.6g}{colorama.Style.RESET_ALL} (dial @ {self.get_current_value(posType='dial'):1.6g})"
|
||||
# # s += "\tuser limits (low,high) : {:1.6g},{:1.6g}\n".format(*self.get_limits())
|
||||
s += f"\n{colorama.Style.DIM}low limit {colorama.Style.RESET_ALL}"
|
||||
s += ValueInRange(*self.get_limits()).get_str(self.get_current_value())
|
||||
s += f" {colorama.Style.DIM}high limit{colorama.Style.RESET_ALL}"
|
||||
# # s += "\tuser limits (low,high) : {:1.6g},{1.6g}".format(self.get_limits())
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
print(str(self))
|
||||
return object.__repr__(self)
|
||||
|
||||
def __call__(self, value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
|
||||
|
||||
|
||||
@@ -104,8 +104,3 @@ class ValueInRange:
|
||||
|
||||
|
||||
|
||||
class AdjustableError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from slic.utils.pv import PV
|
||||
from slic.utils.printing import printable_dict
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..basedevice import BaseDevice
|
||||
from ..general.motors import MotorRecord
|
||||
from ..general.delay_stage import DelayStage
|
||||
from ..timing.alvralasertiming import eTiming
|
||||
|
||||
@@ -20,8 +20,8 @@ class LaserExp(BaseDevice):
|
||||
self.darkRate = PV("SIN-TIMAST-TMA:Evt-23-Freq-I")
|
||||
|
||||
# Waveplates
|
||||
self.wpTopas = MotorRecord(Id + "-M442:MOT")
|
||||
self.wpHarmonics = MotorRecord(Id + "-M432:MOT")
|
||||
self.wpTopas = Motor(Id + "-M442:MOT")
|
||||
self.wpHarmonics = Motor(Id + "-M432:MOT")
|
||||
|
||||
# Delay stages
|
||||
self.pumpTopas_delay = DelayStage(Id + "-M451:MOTOR_1")
|
||||
@@ -36,10 +36,10 @@ class LaserExp(BaseDevice):
|
||||
self.psen_delay = DelayStage(Id + "-M424:MOT")
|
||||
|
||||
# Experimental compressor delay stage
|
||||
self.compressorExp_delay = MotorRecord(Id + "-M431:MOT")
|
||||
self.compressorExp_delay = Motor(Id + "-M431:MOT")
|
||||
|
||||
# Experimental compressor delay stage
|
||||
self.compressorDiag_delay = MotorRecord(Id + "-M421:MOT")
|
||||
self.compressorDiag_delay = Motor(Id + "-M421:MOT")
|
||||
|
||||
# Pump A/C delay stage
|
||||
self.pump_autocorr_delay = DelayStage(Id + "-M444:MOT")
|
||||
@@ -48,7 +48,7 @@ class LaserExp(BaseDevice):
|
||||
self.pump_toFEL_delay = DelayStage(Id + "-M441:MOT")
|
||||
|
||||
# Experiment focussing lens position
|
||||
self.pump_lens_focus = MotorRecord(Id + "-M443:MOT")
|
||||
self.pump_lens_focus = Motor(Id + "-M443:MOT")
|
||||
|
||||
# Globi electronic timing PV from Edwin
|
||||
self.eTiming = eTiming(Id + "-eTiming")
|
||||
@@ -57,7 +57,7 @@ class LaserExp(BaseDevice):
|
||||
def __repr__(self):
|
||||
to_print = {}
|
||||
for key, item in self.__dict__.items():
|
||||
if type(item) in (MotorRecord, DelayStage, PV, eTiming):
|
||||
if type(item) in (Motor, DelayStage, PV, eTiming):
|
||||
to_print[key] = item
|
||||
|
||||
head = "Laser motor positions"
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
from slic.utils.eco_components.aliases import Alias
|
||||
from ..general.motors import MotorRecord
|
||||
from ..general.smaract import SmarActRecord
|
||||
|
||||
from epics import PV
|
||||
|
||||
from slic.utils.eco_components.aliases import Alias
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..general.smaract import SmarActRecord
|
||||
from ..general.delay_stage import DelayStage
|
||||
from ..general.adjustable import AdjustableVirtual
|
||||
|
||||
import colorama,datetime
|
||||
import colorama, datetime
|
||||
from pint import UnitRegistry
|
||||
ureg = UnitRegistry()
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, Id=None, name=None):
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
def addMotorToSelf(self, Id=None, name=None):
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
|
||||
|
||||
@@ -116,13 +116,13 @@ class Laser_Exp:
|
||||
|
||||
# Waveplate and Delay stage
|
||||
try:
|
||||
addMotorRecordToSelf(self, self.Id + "-M534:MOT", name="pump_wp")
|
||||
addMotorRecordToSelf(self, self.Id + "-M533:MOT", name="tt_wp")
|
||||
addMotorToSelf(self, self.Id + "-M534:MOT", name="pump_wp")
|
||||
addMotorToSelf(self, self.Id + "-M533:MOT", name="tt_wp")
|
||||
except:
|
||||
print("No wp found")
|
||||
|
||||
try:
|
||||
addMotorRecordToSelf(
|
||||
addMotorToSelf(
|
||||
self, Id=self.Id + "-M521:MOTOR_1", name="_pump_delaystg"
|
||||
)
|
||||
addDelayStageToSelf(
|
||||
@@ -133,7 +133,7 @@ class Laser_Exp:
|
||||
print(expt)
|
||||
|
||||
# try:
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M521:MOTOR_1", name="delay_eos_stg")
|
||||
addMotorToSelf(self, Id=self.Id + "-M521:MOTOR_1", name="delay_eos_stg")
|
||||
self.delay_eos = DelayTime(self.delay_eos_stg, name="delay_eos")
|
||||
self.alias.append(self.delay_eos.alias)
|
||||
self.lxt_eos = DelayTime(self.delay_eos_stg, direction=-1,name="lxt_eos")
|
||||
@@ -143,7 +143,7 @@ class Laser_Exp:
|
||||
# print(expt)
|
||||
|
||||
try:
|
||||
addMotorRecordToSelf(
|
||||
addMotorToSelf(
|
||||
self, Id=self.Id + "-M522:MOTOR_1", name="delay_tt_stg"
|
||||
)
|
||||
self.delay_tt = DelayTime(self.delay_tt_stg, name="delay_tt")
|
||||
@@ -151,7 +151,7 @@ class Laser_Exp:
|
||||
except:
|
||||
print("Problems initializing global delay stage")
|
||||
try:
|
||||
addMotorRecordToSelf(
|
||||
addMotorToSelf(
|
||||
self, Id=self.Id + "-M523:MOTOR_1", name="delay_glob_stg"
|
||||
)
|
||||
self.delay_glob = DelayTime(self.delay_glob_stg, name="delay_glob")
|
||||
@@ -170,8 +170,8 @@ class Laser_Exp:
|
||||
except:
|
||||
print('Problems initializing virtual pump delay stage')
|
||||
# compressor
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M532:MOT", name="compressor")
|
||||
# self.compressor = MotorRecord(Id+'-M532:MOT')
|
||||
addMotorToSelf(self, Id=self.Id + "-M532:MOT", name="compressor")
|
||||
# self.compressor = Motor(Id+'-M532:MOT')
|
||||
|
||||
# LAM delay stages
|
||||
addSmarActRecordToSelf(self, Id="SLAAR21-LMTS-LAM11", name="_lam_delay_smarstg")
|
||||
@@ -181,22 +181,22 @@ class Laser_Exp:
|
||||
# self._lam_delayStg_Smar = SmarActRecord('SLAAR21-LMTS-LAM11')
|
||||
# self.lam_delay_Smar = DelayStage(self._lam_delayStg_Smar)
|
||||
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M548:MOT", name="_lam_delaystg")
|
||||
addMotorToSelf(self, Id=self.Id + "-M548:MOT", name="_lam_delaystg")
|
||||
addDelayStageToSelf(self, self.__dict__["_lam_delaystg"], name="lam_delay")
|
||||
# self._lam_delayStg = MotorRecord(self.Id+'-M548:MOT')
|
||||
# self._lam_delayStg = Motor(self.Id+'-M548:MOT')
|
||||
# self.lam_delay = DelayStage(self._lam_delayStg)
|
||||
|
||||
# PALM delay stages
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M552:MOT", name="_palm_delaystg")
|
||||
addMotorToSelf(self, Id=self.Id + "-M552:MOT", name="_palm_delaystg")
|
||||
addDelayStageToSelf(self, self.__dict__["_palm_delaystg"], name="palm_delay")
|
||||
# self._palm_delayStg = MotorRecord(self.Id+'-M552:MOT')
|
||||
# self._palm_delayStg = Motor(self.Id+'-M552:MOT')
|
||||
# self.palm_delay = DelayStage(self._palm_delayStg)
|
||||
|
||||
# PSEN delay stages
|
||||
# self._psen_delayStg = MotorRecord(self.Id+'')
|
||||
# self._psen_delayStg = Motor(self.Id+'')
|
||||
# self.psen_delay = DelayStage(self._pump_delayStg)
|
||||
try:
|
||||
addMotorRecordToSelf(
|
||||
addMotorToSelf(
|
||||
self, Id=self.Id + "-M561:MOT", name="_psen_delaystg"
|
||||
)
|
||||
addDelayStageToSelf(
|
||||
@@ -250,13 +250,13 @@ class Laser_Exp_old:
|
||||
|
||||
# Waveplate and Delay stage
|
||||
try:
|
||||
addMotorRecordToSelf(self, self.Id + "-M534:MOT", name="pump_wp")
|
||||
addMotorRecordToSelf(self, self.Id + "-M533:MOT", name="tt_wp")
|
||||
addMotorToSelf(self, self.Id + "-M534:MOT", name="pump_wp")
|
||||
addMotorToSelf(self, self.Id + "-M533:MOT", name="tt_wp")
|
||||
except:
|
||||
print("No wp found")
|
||||
|
||||
try:
|
||||
addMotorRecordToSelf(
|
||||
addMotorToSelf(
|
||||
self, Id=self.Id + "-M521:MOTOR_1", name="_pump_delaystg"
|
||||
)
|
||||
addDelayStageToSelf(
|
||||
@@ -266,7 +266,7 @@ class Laser_Exp_old:
|
||||
print("No eos delay stage")
|
||||
pass
|
||||
try:
|
||||
addMotorRecordToSelf(
|
||||
addMotorToSelf(
|
||||
self, Id=self.Id + "-M522:MOTOR_1", name="_tt_delaystg"
|
||||
)
|
||||
addDelayStageToSelf(self, self.__dict__["_tt_delaystg"], name="tt_delay")
|
||||
@@ -276,15 +276,15 @@ class Laser_Exp_old:
|
||||
pass
|
||||
|
||||
try:
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M553:MOT", name="_exp_delaystg")
|
||||
addMotorToSelf(self, Id=self.Id + "-M553:MOT", name="_exp_delaystg")
|
||||
addDelayStageToSelf(self, self.__dict__["_exp_delaystg"], name="exp_delay")
|
||||
# addDelayStageToSelf(self,self.__dict__["_thz_delaystg"], name="thz_delay")
|
||||
except:
|
||||
print("No thz delay stage")
|
||||
pass
|
||||
# compressor
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M532:MOT", name="compressor")
|
||||
# self.compressor = MotorRecord(Id+'-M532:MOT')
|
||||
addMotorToSelf(self, Id=self.Id + "-M532:MOT", name="compressor")
|
||||
# self.compressor = Motor(Id+'-M532:MOT')
|
||||
|
||||
# LAM delay stages
|
||||
addSmarActRecordToSelf(self, Id="SLAAR21-LMTS-LAM11", name="_lam_delay_smarstg")
|
||||
@@ -294,19 +294,19 @@ class Laser_Exp_old:
|
||||
# self._lam_delayStg_Smar = SmarActRecord('SLAAR21-LMTS-LAM11')
|
||||
# self.lam_delay_Smar = DelayStage(self._lam_delayStg_Smar)
|
||||
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M548:MOT", name="_lam_delaystg")
|
||||
addMotorToSelf(self, Id=self.Id + "-M548:MOT", name="_lam_delaystg")
|
||||
addDelayStageToSelf(self, self.__dict__["_lam_delaystg"], name="lam_delay")
|
||||
# self._lam_delayStg = MotorRecord(self.Id+'-M548:MOT')
|
||||
# self._lam_delayStg = Motor(self.Id+'-M548:MOT')
|
||||
# self.lam_delay = DelayStage(self._lam_delayStg)
|
||||
|
||||
# PALM delay stages
|
||||
addMotorRecordToSelf(self, Id=self.Id + "-M552:MOT", name="_palm_delaystg")
|
||||
addMotorToSelf(self, Id=self.Id + "-M552:MOT", name="_palm_delaystg")
|
||||
addDelayStageToSelf(self, self.__dict__["_palm_delaystg"], name="palm_delay")
|
||||
# self._palm_delayStg = MotorRecord(self.Id+'-M552:MOT')
|
||||
# self._palm_delayStg = Motor(self.Id+'-M552:MOT')
|
||||
# self.palm_delay = DelayStage(self._palm_delayStg)
|
||||
|
||||
# PSEN delay stages
|
||||
# self._psen_delayStg = MotorRecord(self.Id+'')
|
||||
# self._psen_delayStg = Motor(self.Id+'')
|
||||
# self.psen_delay = DelayStage(self._pump_delayStg)
|
||||
|
||||
# SmarAct ID
|
||||
@@ -340,3 +340,6 @@ class Laser_Exp_old:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from ...general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class Laser_Exp:
|
||||
@@ -8,12 +8,14 @@ class Laser_Exp:
|
||||
|
||||
### Mirrors used in the expeirment ###
|
||||
try:
|
||||
self.phi = MotorRecord(Id + "-M517:MOT")
|
||||
self.phi = Motor(Id + "-M517:MOT")
|
||||
except:
|
||||
print("No Standa steering phi mirror")
|
||||
pass
|
||||
|
||||
try:
|
||||
self.th = MotorRecord(Id + "-M518:MOT")
|
||||
self.th = Motor(Id + "-M518:MOT")
|
||||
except:
|
||||
print("No Standa steering theta mirror")
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from ...general.motors import MotorRecord
|
||||
from ...general.smaract import SmarActRecord
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ...general.smaract import SmarActRecord
|
||||
from ...general.delay_stage import DelayStage
|
||||
|
||||
|
||||
@@ -8,7 +9,7 @@ class Palm:
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
|
||||
self._delayStg = MotorRecord(self.Id + "-M552:MOT")
|
||||
self._delayStg = Motor(self.Id + "-M552:MOT")
|
||||
self.delay = DelayStage(self._delayStg)
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
@@ -22,3 +23,6 @@ class Palm:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from ...general.motors import MotorRecord
|
||||
from ...general.smaract import SmarActRecord
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ...general.smaract import SmarActRecord
|
||||
from ...general.delay_stage import DelayStage
|
||||
|
||||
|
||||
@@ -8,7 +9,7 @@ class Psen:
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
|
||||
self._delayStg = MotorRecord(self.Id + "-M561:MOT")
|
||||
self._delayStg = Motor(self.Id + "-M561:MOT")
|
||||
self.delay = DelayStage(self._delayStg)
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
@@ -22,3 +23,6 @@ class Psen:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.utils.eco_epics.utilities_epics import EnumWrapper
|
||||
from ..general.detectors import FeDigitizer
|
||||
|
||||
|
||||
class GasDetector:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
|
||||
class SolidTargetDetectorPBPS:
|
||||
def __init__(self, Id, VME_crate=None, link=None,
|
||||
ch_up=12, ch_down=13, ch_left=15, ch_right=14,
|
||||
elog=None, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
self.x_diode = MotorRecord(Id+':MOTOR_X1',elog=elog)
|
||||
self.y_diode = MotorRecord(Id+':MOTOR_Y1',elog=elog)
|
||||
self.y_target = MotorRecord(Id+':MOTOR_PROBE',elog=elog)
|
||||
self.target = EnumWrapper(Id+':PROBE_SP',elog=elog)
|
||||
self.x_diode = Motor(Id + ':MOTOR_X1',elog=elog)
|
||||
self.y_diode = Motor(Id + ':MOTOR_Y1',elog=elog)
|
||||
self.y_target = Motor(Id + ':MOTOR_PROBE',elog=elog)
|
||||
self.target = EnumWrapper(Id + ':PROBE_SP',elog=elog)
|
||||
if VME_crate:
|
||||
self.diode_up = FeDigitizer('%s:Lnk%dCh%d'%(VME_crate,link,ch_up))
|
||||
self.diode_down = FeDigitizer('%s:Lnk%dCh%d'%(VME_crate,link,ch_down))
|
||||
@@ -74,12 +76,7 @@ class SolidTargetDetectorPBPS:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#SAROP21-CVME-PBPS:Lnk10Ch15-WD-gain
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
import numpy as np
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.utils.eco_epics.utilities_epics import EnumWrapper
|
||||
from ..general.detectors_new import FeDigitizer,PvDataStream
|
||||
from ..general.detectors_new import FeDigitizer, PvDataStream
|
||||
from slic.core.adjustable import PVEnumAdjustable
|
||||
from slic.utils.eco_components.aliases import Alias, append_object_to_object
|
||||
from epics import PV
|
||||
import numpy as np
|
||||
|
||||
|
||||
|
||||
|
||||
class GasDetector:
|
||||
@@ -33,10 +36,10 @@ class SolidTargetDetectorPBPS_new:
|
||||
self.name = name
|
||||
self.pvname = pvname
|
||||
self.alias = Alias(name)
|
||||
append_object_to_object(self,MotorRecord,pvname + ":MOTOR_X1", name="x_diodes")
|
||||
append_object_to_object(self,MotorRecord,pvname + ":MOTOR_Y1", name="y_diodes")
|
||||
append_object_to_object(self,MotorRecord,pvname + ":MOTOR_PROBE", name="target_y")
|
||||
append_object_to_object(self,PVEnumAdjustable, pvname + ":PROBE_SP", name="target")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_X1", name="x_diodes")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_Y1", name="y_diodes")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_PROBE", name="target_y")
|
||||
append_object_to_object(self, PVEnumAdjustable, pvname + ":PROBE_SP", name="target")
|
||||
if VME_crate:
|
||||
self.diode_up = FeDigitizer("%s:Lnk%dCh%d" % (VME_crate, link, ch_up))
|
||||
self.diode_down = FeDigitizer("%s:Lnk%dCh%d" % (VME_crate, link, ch_down))
|
||||
@@ -45,17 +48,17 @@ class SolidTargetDetectorPBPS_new:
|
||||
|
||||
|
||||
if channels:
|
||||
append_object_to_object(self,PvDataStream,channels['up'], name="signal_up")
|
||||
append_object_to_object(self,PvDataStream,channels['down'], name="signal_down")
|
||||
append_object_to_object(self,PvDataStream,channels['left'], name="signal_left")
|
||||
append_object_to_object(self,PvDataStream,channels['right'], name="signal_right")
|
||||
append_object_to_object(self, PvDataStream, channels['up'], name="signal_up")
|
||||
append_object_to_object(self, PvDataStream, channels['down'], name="signal_down")
|
||||
append_object_to_object(self, PvDataStream, channels['left'], name="signal_left")
|
||||
append_object_to_object(self, PvDataStream, channels['right'], name="signal_right")
|
||||
|
||||
if calc:
|
||||
append_object_to_object(self,PvDataStream,calc['itot'], name="intensity")
|
||||
append_object_to_object(self,PvDataStream,calc['xpos'], name="xpos")
|
||||
append_object_to_object(self,PvDataStream,calc['ypos'], name="ypos")
|
||||
append_object_to_object(self, PvDataStream, calc['itot'], name="intensity")
|
||||
append_object_to_object(self, PvDataStream, calc['xpos'], name="xpos")
|
||||
append_object_to_object(self, PvDataStream, calc['ypos'], name="ypos")
|
||||
|
||||
def get_calibration_values(self,seconds=5):
|
||||
def get_calibration_values(self, seconds=5):
|
||||
self.x_diodes.set_target_value(0).wait()
|
||||
self.y_diodes.set_target_value(0).wait()
|
||||
ds = [self.signal_up, self.signal_down, self.signal_left, self.signal_right]
|
||||
@@ -66,7 +69,7 @@ class SolidTargetDetectorPBPS_new:
|
||||
norm_diodes = [1/tm/4 for tm in mean]
|
||||
return norm_diodes
|
||||
|
||||
def set_calibration_values(self,norm_diodes):
|
||||
def set_calibration_values(self, norm_diodes):
|
||||
#this is now only for bernina when using the ioxos from sla
|
||||
channels = ['SLAAR21-LTIM01-EVR0:CALCI.INPG','SLAAR21-LTIM01-EVR0:CALCI.INPH','SLAAR21-LTIM01-EVR0:CALCI.INPF','SLAAR21-LTIM01-EVR0:CALCI.INPE']
|
||||
for tc,tv in zip(channels,norm_diodes):
|
||||
@@ -78,7 +81,7 @@ class SolidTargetDetectorPBPS_new:
|
||||
for tc,tv in zip(channels,norm_diodes[0:2]):
|
||||
PV(tc).put(bytes(str(tv),'utf8'))
|
||||
|
||||
def get_calibration_values_position(self,calib_intensities,seconds=5,motion_range=.2):
|
||||
def get_calibration_values_position(self, calib_intensities,seconds=5, motion_range=.2):
|
||||
self.x_diodes.set_limits(-motion_range/2-.1,+motion_range/2+.1)
|
||||
self.y_diodes.set_limits(-motion_range/2-.1,+motion_range/2+.1)
|
||||
self.x_diodes.set_target_value(0).wait()
|
||||
@@ -105,7 +108,7 @@ class SolidTargetDetectorPBPS_new:
|
||||
self.y_diodes.set_target_value(0).wait()
|
||||
return xcalib,ycalib
|
||||
|
||||
def set_calibration_values_position(self,xcalib,ycalib):
|
||||
def set_calibration_values_position(self, xcalib, ycalib):
|
||||
channels = ['SLAAR21-LTIM01-EVR0:CALCX.INPJ','SLAAR21-LTIM01-EVR0:CALCX.INPI']
|
||||
# txcalib = [-1*xcalib[0],-1*xcalib[1]]
|
||||
for tc,tv in zip(channels,xcalib):
|
||||
@@ -206,9 +209,9 @@ class SolidTargetDetectorPBPS:
|
||||
):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self.diode_x = MotorRecord(Id + ":MOTOR_X1", name="diode_x")
|
||||
self.diode_y = MotorRecord(Id + ":MOTOR_Y1", name="diode_y")
|
||||
self.target_pos = MotorRecord(Id + ":MOTOR_PROBE", name="target_pos")
|
||||
self.diode_x = Motor(Id + ":MOTOR_X1", name="diode_x")
|
||||
self.diode_y = Motor(Id + ":MOTOR_Y1", name="diode_y")
|
||||
self.target_pos = Motor(Id + ":MOTOR_PROBE", name="target_pos")
|
||||
self.target = PVEnumAdjustable(Id + ":PROBE_SP", name="target")
|
||||
if VME_crate:
|
||||
self.diode_up = FeDigitizer("%s:Lnk%dCh%d" % (VME_crate, link, ch_up))
|
||||
@@ -288,3 +291,6 @@ class SolidTargetDetectorPBPS:
|
||||
print("No diodes configured, can not change any gain!")
|
||||
|
||||
# SAROP21-CVME-PBPS:Lnk10Ch15-WD-gain
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from ..general.detectors import CameraCA,CameraBS
|
||||
#from ..general.epics_wrappers import EnumSelector
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..general.detectors import CameraCA, CameraBS
|
||||
#from ..general.epics_wrappers import EnumSelector
|
||||
from slic.utils.eco_epics.utilities_epics import EnumWrapper
|
||||
|
||||
|
||||
class Pprm:
|
||||
def __init__(self, Id, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
self.targetY = MotorRecord(Id+':MOTOR_PROBE')
|
||||
self.targetY = Motor(Id + ':MOTOR_PROBE')
|
||||
self.cam = CameraCA(Id)
|
||||
self._led = PV(self.Id+':LED')
|
||||
self.target = EnumWrapper(self.Id+':PROBE_SP')
|
||||
self._led = PV(self.Id + ':LED')
|
||||
self.target = EnumWrapper(self.Id + ':PROBE_SP')
|
||||
|
||||
def illuminate(self,value=None):
|
||||
if value:
|
||||
@@ -32,7 +34,7 @@ class Bernina_XEYE:
|
||||
def __init__(self,Id,bshost=None,bsport=None):
|
||||
self.Id = Id
|
||||
try:
|
||||
self.zoom = MotorRecord('SARES20-EXP:MOT_NAV_Z.VAL')
|
||||
self.zoom = Motor('SARES20-EXP:MOT_NAV_Z.VAL')
|
||||
except:
|
||||
print("X-Ray eye zoom motor not found")
|
||||
pass
|
||||
@@ -44,7 +46,7 @@ class Bernina_XEYE:
|
||||
|
||||
if bshost:
|
||||
self.camBS = CameraBS(host=bshost,port=bsport)
|
||||
# self._led = PV(self.Id+':LED')
|
||||
# self._led = PV(self.Id + ':LED')
|
||||
|
||||
|
||||
|
||||
@@ -61,8 +63,3 @@ class Bernina_XEYE:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..general.detectors import CameraCA, CameraBS
|
||||
from slic.utils.eco_components.aliases import Alias, append_object_to_object
|
||||
from slic.core.adjustable import PVEnumAdjustable
|
||||
@@ -8,8 +8,8 @@ from epics import PV
|
||||
from slic.utils.eco_epics.utilities_epics import EnumWrapper
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, Id=None, name=None):
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
def addMotorToSelf(self, Id=None, name=None):
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Pprm:
|
||||
def __init__(self, Id, name=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self.target_pos = MotorRecord(Id + ":MOTOR_PROBE", name="target_pos")
|
||||
self.target_pos = Motor(Id + ":MOTOR_PROBE", name="target_pos")
|
||||
self.cam = CameraCA(Id)
|
||||
self.led = PVEnumAdjustable(self.Id + ":LED", name="led")
|
||||
self.target = PVEnumAdjustable(self.Id + ":PROBE_SP", name="target")
|
||||
@@ -46,7 +46,7 @@ class Bernina_XEYE:
|
||||
self.alias = Alias(name)
|
||||
self.name = name
|
||||
if zoomstage_pv:
|
||||
append_object_to_object(self, MotorRecord, zoomstage_pv, name="zoom")
|
||||
append_object_to_object(self, Motor, zoomstage_pv, name="zoom")
|
||||
try:
|
||||
self.cam = CameraCA(camera_pv)
|
||||
except:
|
||||
@@ -82,3 +82,6 @@ class Bernina_XEYE:
|
||||
# def get_illumination_state(self):
|
||||
# return bool(self._led.get())
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
# from ..devices_general.smaract import SmarActRecord
|
||||
# from epics import PV
|
||||
from ..general.delay_stage import DelayStage
|
||||
@@ -15,15 +15,15 @@ class SpectralEncoder:
|
||||
self.pvname = pvname
|
||||
self.name=name
|
||||
self.alias = Alias(name)
|
||||
append_object_to_object(self,MotorRecord,pvname+":MOTOR_X1",name='x_target')
|
||||
append_object_to_object(self,MotorRecord,pvname+":MOTOR_Y1",name='y_target')
|
||||
append_object_to_object(self, Motor, pvname+":MOTOR_X1", name='x_target')
|
||||
append_object_to_object(self, Motor, pvname+":MOTOR_Y1", name='y_target')
|
||||
if delay_stages:
|
||||
for key,pv in delay_stages.items():
|
||||
tname = 'delay_'+key+'_stg'
|
||||
append_object_to_object(self,MotorRecord,pv,name=tname)
|
||||
append_object_to_object(self,DelayTime,self.__dict__[tname],name='delay_'+key)
|
||||
append_object_to_object(self, Motor, pv, name=tname)
|
||||
append_object_to_object(self, DelayTime, self.__dict__[tname], name='delay_'+key)
|
||||
|
||||
# self.delay = MotorRecord(self.Id + "-M424:MOT")
|
||||
# self.delay = Motor(self.Id + "-M424:MOT")
|
||||
# self.delayTime = DelayStage(self.delay)
|
||||
self.data_reduction_client = PsenProcessingClient(address=reduction_client_address)
|
||||
|
||||
@@ -55,15 +55,15 @@ class SpatialEncoder:
|
||||
def __init__(self, name=None, reduction_client_address="http://sf-daqsync-02:12003/",delay_stages={'spatial_tt':"SLAAR21-LMOT-M522:MOTOR_1"},pipeline_id='SARES20-CAMS142-M4_psen_db1'):
|
||||
self.name=name
|
||||
self.alias = Alias(name)
|
||||
# append_object_to_object(self,MotorRecord,pvname+":MOTOR_X1",name='x_target')
|
||||
# append_object_to_object(self,MotorRecord,pvname+":MOTOR_Y1",name='y_target')
|
||||
# append_object_to_object(self,Motor,pvname+":MOTOR_X1",name='x_target')
|
||||
# append_object_to_object(self,Motor,pvname+":MOTOR_Y1",name='y_target')
|
||||
if delay_stages:
|
||||
for key,pv in delay_stages.items():
|
||||
tname = 'delay_'+key+'_stg'
|
||||
append_object_to_object(self,MotorRecord,pv,name=tname)
|
||||
append_object_to_object(self,Motor,pv,name=tname)
|
||||
append_object_to_object(self,DelayTime,self.__dict__[tname],name='delay_'+key)
|
||||
|
||||
# self.delay = MotorRecord(self.Id + "-M424:MOT")
|
||||
# self.delay = Motor(self.Id + "-M424:MOT")
|
||||
# self.delayTime = DelayStage(self.delay)
|
||||
# self.data_reduction_client = PsenProcessingClient(address=reduction_client_address)
|
||||
self._camera_server_client = PipelineClient()
|
||||
@@ -108,3 +108,6 @@ class SpatialEncoder:
|
||||
s.append(f" roi {self.roi}")
|
||||
s.append(f" roi_background {self.roi_background}")
|
||||
return '\n'.join(s)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from ...general.motors import MotorRecord
|
||||
from ...general.smaract import SmarActRecord
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ...general.smaract import SmarActRecord
|
||||
from ...general.delay_stage import DelayStage
|
||||
|
||||
|
||||
@@ -8,11 +9,11 @@ class palm:
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
|
||||
self.delay = MotorRecord(self.Id + "-M423:MOT")
|
||||
self.delay = Motor(self.Id + "-M423:MOT")
|
||||
self.delayTime = DelayStage(self.delay)
|
||||
|
||||
# self.delay2 = MotorRecord(self.Id+'-M422:MOT')
|
||||
# self.delayTime2 = DelayStage(self.delay)
|
||||
# self.delay2 = Motor(self.Id + '-M422:MOT')
|
||||
# self.delayTime2 = DelayStage(self.delay)
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
ostr = "***** PALM motor positions ******\n"
|
||||
@@ -31,7 +32,7 @@ class eo:
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
|
||||
self.delay = MotorRecord(self.Id + "-M422:MOT")
|
||||
self.delay = Motor(self.Id + "-M422:MOT")
|
||||
self.delayTime = DelayStage(self.delay)
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
@@ -45,3 +46,6 @@ class eo:
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
from ...general.motors import MotorRecord
|
||||
from ...general.smaract import SmarActRecord
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ...general.smaract import SmarActRecord
|
||||
from ...general.delay_stage import DelayStage
|
||||
|
||||
|
||||
class psen:
|
||||
def __init__(self,Id):
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
|
||||
self.delay = MotorRecord(self.Id+'-M424:MOT')
|
||||
|
||||
self.delay = Motor(self.Id + '-M424:MOT')
|
||||
self.delayTime = DelayStage(self.delay)
|
||||
|
||||
|
||||
def get_adjustable_positions_str(self):
|
||||
ostr = '*****PSEN motor positions******\n'
|
||||
|
||||
for tkey,item in self.__dict__.items():
|
||||
if hasattr(item,'get_current_value'):
|
||||
for tkey, item in self.__dict__.items():
|
||||
if hasattr(item, 'get_current_value'):
|
||||
pos = item.get_current_value()
|
||||
ostr += ' ' + tkey.ljust(10) + ' : % 14g\n'%pos
|
||||
return ostr
|
||||
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return self.get_adjustable_positions_str()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +1,37 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from epics import PV
|
||||
|
||||
|
||||
class AttenuatorAramis:
|
||||
def __init__(self, Id, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
self._pv_status_str = PV(self.Id+':MOT2TRANS.VALD')
|
||||
self._pv_status_int = PV(self.Id+':IDX_RB')
|
||||
pass
|
||||
self._pv_status_str = PV(Id + ':MOT2TRANS.VALD')
|
||||
self._pv_status_int = PV(Id + ':IDX_RB')
|
||||
|
||||
def updateE(self,energy = None):
|
||||
def updateE(self, energy = None):
|
||||
if energy == None:
|
||||
energy = PV("SARUN03-UIND030:FELPHOTENE").value
|
||||
energy = energy *1000
|
||||
PV(self.Id+":ENERGY").put(energy)
|
||||
print("Set energy to %s eV"%energy)
|
||||
return
|
||||
energy = energy * 1000
|
||||
PV(self.Id + ":ENERGY").put(energy)
|
||||
print("Set energy to %s eV" % energy)
|
||||
|
||||
def set_transmission(self,value,energy=None):
|
||||
def set_transmission(self, value, energy=None):
|
||||
self.updateE(energy)
|
||||
PV(self.Id+":3RD_HARM_SP").put(0)
|
||||
PV(self.Id+":TRANS_SP").put(value)
|
||||
pass
|
||||
PV(self.Id + ":3RD_HARM_SP").put(0)
|
||||
PV(self.Id + ":TRANS_SP").put(value)
|
||||
|
||||
def set_transmission_third_harmonic(self,value,energy=None):
|
||||
def set_transmission_third_harmonic(self, value, energy=None):
|
||||
self.updateE(energy)
|
||||
PV(self.Id+":3RD_HARM_SP").put(1)
|
||||
PV(self.Id+":TRANS_SP").put(value)
|
||||
pass
|
||||
PV(self.Id + ":3RD_HARM_SP").put(1)
|
||||
PV(self.Id + ":TRANS_SP").put(value)
|
||||
|
||||
def setE(self):
|
||||
pass
|
||||
|
||||
def get_transmission(self):
|
||||
tFun = PV(self.Id+":TRANS_RB").value
|
||||
tTHG = PV(self.Id+":TRANS3EDHARM_RB").value
|
||||
print("Transmission Fundamental: %s THG: %s"%(tFun, tTHG))
|
||||
return tFun,tTHG
|
||||
tFun = PV(self.Id + ":TRANS_RB").value
|
||||
tTHG = PV(self.Id + ":TRANS3EDHARM_RB").value
|
||||
print("Transmission Fundamental: %s THG: %s" % (tFun, tTHG))
|
||||
return tFun, tTHG
|
||||
|
||||
def get_status(self):
|
||||
s_str = self._pv_status_str.get(as_string=True)
|
||||
@@ -44,18 +40,14 @@ class AttenuatorAramis:
|
||||
|
||||
def __repr__(self):
|
||||
t = self.get_transmission()
|
||||
s = '1st harm. transmission = %g\n'%t[0]
|
||||
s += '3rd harm. transmission = %g\n'%t[1]
|
||||
s = '1st harm. transmission = %g\n' % t[0]
|
||||
s += '3rd harm. transmission = %g\n' % t[1]
|
||||
s += 'Targets in beam:\n'
|
||||
s += '%s'%self.get_status()[0]
|
||||
s += '%s' % self.get_status()[0]
|
||||
return s
|
||||
|
||||
__str__ = __repr__
|
||||
|
||||
def __call__(self,*args,**kwargs):
|
||||
self.set_transmission(*args,**kwargs)
|
||||
|
||||
|
||||
self.set_transmission(*args, **kwargs)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from epics import PV
|
||||
from time import sleep
|
||||
from slic.core.task import Task
|
||||
@@ -16,7 +16,7 @@ class AttenuatorAramis:
|
||||
self.alias = Alias(name)
|
||||
self.pulse_picker = pulse_picker
|
||||
self.motors = [
|
||||
MotorRecord(f"{self.Id}:MOTOR_{n+1}", name=f"motor{n+1}")
|
||||
Motor(f"{self.Id}:MOTOR_{n+1}", name=f"motor{n+1}")
|
||||
for n in range(6)
|
||||
]
|
||||
for n, mot in enumerate(self.motors):
|
||||
@@ -25,11 +25,6 @@ class AttenuatorAramis:
|
||||
if set_limits:
|
||||
mot.set_limits(*set_limits)
|
||||
|
||||
def __str__(self):
|
||||
pass
|
||||
|
||||
def __status__(self):
|
||||
pass
|
||||
|
||||
def updateE(self, energy=None):
|
||||
while not energy:
|
||||
@@ -92,3 +87,6 @@ class AttenuatorAramis:
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.set_transmission(*args, **kwargs)
|
||||
|
||||
|
||||
|
||||
|
||||
+23
-22
@@ -1,25 +1,26 @@
|
||||
from ..basedevice import BaseDevice
|
||||
from ..general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.core.task import Task
|
||||
from time import sleep
|
||||
import numpy as np
|
||||
from epics import PV
|
||||
|
||||
from ..basedevice import BaseDevice
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.core.task import Task
|
||||
|
||||
|
||||
class Double_Crystal_Mono_AramisMacro:
|
||||
|
||||
def __init__(self,Id):
|
||||
self.Id = Id
|
||||
self.theta = MotorRecord(Id+':RX12')
|
||||
self.x = MotorRecord(Id+':TX12')
|
||||
self.gap = MotorRecord(Id+':T2')
|
||||
self.roll1 = MotorRecord(Id+':RZ1')
|
||||
self.roll2 = MotorRecord(Id+':RZ2')
|
||||
self.pitch2 = MotorRecord(Id+':RX2')
|
||||
self.theta = Motor(Id + ':RX12')
|
||||
self.x = Motor(Id + ':TX12')
|
||||
self.gap = Motor(Id + ':T2')
|
||||
self.roll1 = Motor(Id + ':RZ1')
|
||||
self.roll2 = Motor(Id + ':RZ2')
|
||||
self.pitch2 = Motor(Id + ':RX2')
|
||||
|
||||
self.energy_rbk = PV(Id+':ENERGY')
|
||||
self.energy_sp = PV(Id+':ENERGY_SP')
|
||||
self.moving = PV(Id+':MOVING')
|
||||
self.energy_rbk = PV(Id + ':ENERGY')
|
||||
self.energy_sp = PV(Id + ':ENERGY_SP')
|
||||
self.moving = PV(Id + ':MOVING')
|
||||
self._stop = PV(Id +':STOP.PROC')
|
||||
|
||||
def move_and_wait(self,value,checktime=.01,precision=.5):
|
||||
@@ -124,16 +125,16 @@ class Double_Crystal_Mono(BaseDevice):
|
||||
self.z_undulator = z_undulator
|
||||
self.description = description
|
||||
|
||||
self.theta = MotorRecord(Id+':RX12')
|
||||
self.x = MotorRecord(Id+':TX12')
|
||||
self.gap = MotorRecord(Id+':T2')
|
||||
self.roll1 = MotorRecord(Id+':RZ1')
|
||||
self.roll2 = MotorRecord(Id+':RZ2')
|
||||
self.pitch2 = MotorRecord(Id+':RX2')
|
||||
self.theta = Motor(Id + ':RX12')
|
||||
self.x = Motor(Id + ':TX12')
|
||||
self.gap = Motor(Id + ':T2')
|
||||
self.roll1 = Motor(Id + ':RZ1')
|
||||
self.roll2 = Motor(Id + ':RZ2')
|
||||
self.pitch2 = Motor(Id + ':RX2')
|
||||
|
||||
self.energy_rbk = PV(Id+':ENERGY')
|
||||
self.energy_sp = PV(Id+':ENERGY_SP')
|
||||
self.moving = PV(Id+':MOVING')
|
||||
self.energy_rbk = PV(Id + ':ENERGY')
|
||||
self.energy_sp = PV(Id + ':ENERGY_SP')
|
||||
self.moving = PV(Id + ':MOVING')
|
||||
self._stop = PV(Id +':STOP.PROC')
|
||||
|
||||
def move_and_wait(self,value,checktime=.01,precision=.5):
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class KBhor:
|
||||
def __init__(self, Id, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
|
||||
self.x = MotorRecord(Id+':W_X')
|
||||
self.y = MotorRecord(Id+':W_Y')
|
||||
self.pitch = MotorRecord(Id+':W_RY')
|
||||
self.roll = MotorRecord(Id+':W_RZ')
|
||||
self.yaw = MotorRecord(Id+':W_RX')
|
||||
self.bend1 = MotorRecord(Id+':BU')
|
||||
self.bend2 = MotorRecord(Id+':BD')
|
||||
self.x = Motor(Id + ':W_X')
|
||||
self.y = Motor(Id + ':W_Y')
|
||||
self.pitch = Motor(Id + ':W_RY')
|
||||
self.roll = Motor(Id + ':W_RZ')
|
||||
self.yaw = Motor(Id + ':W_RX')
|
||||
self.bend1 = Motor(Id + ':BU')
|
||||
self.bend2 = Motor(Id + ':BD')
|
||||
|
||||
self.mode = PV(Id[:11]+':MODE').enum_strs[PV(Id[:11]+':MODE').value]
|
||||
|
||||
|
||||
#### actual motors ###
|
||||
self._Y1 = MotorRecord(Id+':TY1')
|
||||
self._Y2 = MotorRecord(Id+':TY2')
|
||||
self._Y3 = MotorRecord(Id+':TY3')
|
||||
self._X1 = MotorRecord(Id+':TX1')
|
||||
self._X2 = MotorRecord(Id+':TX2')
|
||||
self._Y1 = Motor(Id + ':TY1')
|
||||
self._Y2 = Motor(Id + ':TY2')
|
||||
self._Y3 = Motor(Id + ':TY3')
|
||||
self._X1 = Motor(Id + ':TX1')
|
||||
self._X2 = Motor(Id + ':TX2')
|
||||
|
||||
|
||||
def __str__(self):
|
||||
def __repr__(self):
|
||||
s = "**Horizontal KB mirror**\n"
|
||||
motors = "bend1 bend2 pitch roll yaw x y".split()
|
||||
for motor in motors:
|
||||
@@ -34,6 +34,6 @@ class KBhor:
|
||||
for stage in stages:
|
||||
s+= " - %s = %.4f\n" %(stage, getattr(self,stage).wm())
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class KBver:
|
||||
def __init__(self, Id, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
|
||||
self.x = MotorRecord(Id+':W_X')
|
||||
self.y = MotorRecord(Id+':W_Y')
|
||||
self.pitch = MotorRecord(Id+':W_RX')
|
||||
self.roll = MotorRecord(Id+':W_RZ')
|
||||
self.yaw = MotorRecord(Id+':W_RY')
|
||||
self.bend1 = MotorRecord(Id+':BU')
|
||||
self.bend2 = MotorRecord(Id+':BD')
|
||||
self.x = Motor(Id + ':W_X')
|
||||
self.y = Motor(Id + ':W_Y')
|
||||
self.pitch = Motor(Id + ':W_RX')
|
||||
self.roll = Motor(Id + ':W_RZ')
|
||||
self.yaw = Motor(Id + ':W_RY')
|
||||
self.bend1 = Motor(Id + ':BU')
|
||||
self.bend2 = Motor(Id + ':BD')
|
||||
|
||||
self.mode = PV(Id[:11]+':MODE').enum_strs[PV(Id[:11]+':MODE').value]
|
||||
|
||||
#### actual motors ###
|
||||
self._Y1 = MotorRecord(Id+':TY1')
|
||||
self._Y2 = MotorRecord(Id+':TY2')
|
||||
self._Y3 = MotorRecord(Id+':TY3')
|
||||
self._X1 = MotorRecord(Id+':TX1')
|
||||
self._X2 = MotorRecord(Id+':TX2')
|
||||
self._Y1 = Motor(Id + ':TY1')
|
||||
self._Y2 = Motor(Id + ':TY2')
|
||||
self._Y3 = Motor(Id + ':TY3')
|
||||
self._X1 = Motor(Id + ':TX1')
|
||||
self._X2 = Motor(Id + ':TX2')
|
||||
|
||||
def __str__(self):
|
||||
def __repr__(self):
|
||||
s = "**Vertical KB mirror**\n"
|
||||
motors = "bend1 bend2 pitch roll yaw x y".split()
|
||||
for motor in motors:
|
||||
@@ -32,6 +33,6 @@ class KBver:
|
||||
for stage in stages:
|
||||
s+= " - %s = %.4f\n" %(stage, getattr(self,stage).wm())
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
import sys
|
||||
|
||||
sys.path.append("..")
|
||||
from ..general.motors import MotorRecord
|
||||
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.utils.eco_components.aliases import Alias
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, name=None, Id=None):
|
||||
def addMotorToSelf(self, name=None, Id=None):
|
||||
try:
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
except:
|
||||
print(f"Warning! Could not find motor {name} (Id:{Id})")
|
||||
@@ -21,13 +18,16 @@ class OffsetMirror:
|
||||
self.name = name
|
||||
self.alias = Alias(name)
|
||||
|
||||
addMotorRecordToSelf(self, Id=Id + ":W_X", name="x")
|
||||
addMotorRecordToSelf(self, Id=Id + ":W_Y", name="y")
|
||||
addMotorRecordToSelf(self, Id=Id + ":W_RX", name="rx")
|
||||
addMotorRecordToSelf(self, Id=Id + ":W_RZ", name="rz")
|
||||
addMotorToSelf(self, Id=Id + ":W_X", name="x")
|
||||
addMotorToSelf(self, Id=Id + ":W_Y", name="y")
|
||||
addMotorToSelf(self, Id=Id + ":W_RX", name="rx")
|
||||
addMotorToSelf(self, Id=Id + ":W_RZ", name="rz")
|
||||
|
||||
def out(self):
|
||||
pass
|
||||
|
||||
def move_in(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ from epics import PV
|
||||
from time import sleep
|
||||
import numpy as np
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from slic.utils.eco_components.aliases import Alias
|
||||
|
||||
|
||||
def addMotorRecordToSelf(self, name=None, Id=None):
|
||||
def addMotorToSelf(self, name=None, Id=None):
|
||||
try:
|
||||
self.__dict__[name] = MotorRecord(Id, name=name)
|
||||
self.__dict__[name] = Motor(Id, name=name)
|
||||
self.alias.append(self.__dict__[name].alias)
|
||||
except:
|
||||
print(f"Warning! Could not find motor {name} (Id:{Id})")
|
||||
@@ -23,8 +24,8 @@ class Pulsepick:
|
||||
self.Id = Id
|
||||
self._openclose = PV(self.evronoff)
|
||||
self._evrsrc = PV(self.evrsrc)
|
||||
addMotorRecordToSelf(self, Id=self.Id + ":MOTOR_X1", name="x")
|
||||
addMotorRecordToSelf(self, Id=self.Id + ":MOTOR_Y1", name="y")
|
||||
addMotorToSelf(self, Id=self.Id + ":MOTOR_X1", name="x")
|
||||
addMotorToSelf(self, Id=self.Id + ":MOTOR_Y1", name="y")
|
||||
|
||||
def movein(self):
|
||||
self.x.set_target_value(4.45)
|
||||
@@ -62,4 +63,4 @@ class Pulsepick:
|
||||
return f'FEL pulse picker state {self.get_status()}.'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class RefLaser_Aramis:
|
||||
def __init__(self, Id, elog=None, name=None, inpos=-18.818, outpos=-5, z_undulator=None, description=None):
|
||||
@@ -8,13 +9,13 @@ class RefLaser_Aramis:
|
||||
self.name = name
|
||||
self._inpos = inpos
|
||||
self._outpos = outpos
|
||||
self.mirrmotor = MotorRecord(self.Id+':MOTOR_1')
|
||||
self.mirrmotor = Motor(self.Id + ':MOTOR_1')
|
||||
|
||||
|
||||
def __call__(self,*args,**kwargs):
|
||||
self.set(*args,**kwargs)
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.set(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
def __repr__(self):
|
||||
status = self.get_status()
|
||||
if status:
|
||||
return "Reflaser is In."
|
||||
@@ -33,7 +34,7 @@ class RefLaser_Aramis:
|
||||
isin = None
|
||||
return isin
|
||||
|
||||
def set(self,value):
|
||||
def set(self, value):
|
||||
if type(value) is str:
|
||||
if value.lower()=='in':
|
||||
value = True
|
||||
@@ -45,7 +46,6 @@ class RefLaser_Aramis:
|
||||
self.mirrmotor.set_target_value(self._inpos)
|
||||
else:
|
||||
self.mirrmotor.set_target_value(self._outpos)
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
|
||||
@@ -1,27 +1,33 @@
|
||||
from ..general.motors import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
|
||||
|
||||
class SlitBlades_old:
|
||||
def __init__(self, Id, name=None, elog=None, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._x1 = MotorRecord(Id+':MOTOR_X1')
|
||||
self._x2 = MotorRecord(Id+':MOTOR_X2')
|
||||
self._y1 = MotorRecord(Id+':MOTOR_Y1')
|
||||
self._y2 = MotorRecord(Id+':MOTOR_Y2')
|
||||
self._x1 = Motor(Id + ':MOTOR_X1')
|
||||
self._x2 = Motor(Id + ':MOTOR_X2')
|
||||
self._y1 = Motor(Id + ':MOTOR_Y1')
|
||||
self._y2 = Motor(Id + ':MOTOR_Y2')
|
||||
|
||||
def get_hg(self):
|
||||
return self._x2.get_current_value()-self._x1.get_current_value()
|
||||
|
||||
def get_vg(self):
|
||||
return self._y2.get_current_value()-self._y1.get_current_value()
|
||||
|
||||
def get_ho(self):
|
||||
return (self._x1.get_current_value()+self._x2.get_current_value())/2
|
||||
|
||||
def get_vo(self):
|
||||
return (self._y1.get_current_value()+self._y2.get_current_value())/2
|
||||
|
||||
def set_hg(self,value):
|
||||
ho = self.get_ho()
|
||||
c1 = self._x1.set_target_value(ho-value/2)
|
||||
c2 = self._x2.set_target_value(ho+value/2)
|
||||
return c1,c2
|
||||
|
||||
def set_vg(self,value):
|
||||
vo = self.get_vo()
|
||||
c1 = self._y1.set_target_value(vo-value/2)
|
||||
@@ -33,6 +39,7 @@ class SlitBlades_old:
|
||||
c1 = self._x1.set_target_value(value-hg/2)
|
||||
c2 = self._x2.set_target_value(value+hg/2)
|
||||
return c1,c2
|
||||
|
||||
def set_vo(self,value):
|
||||
vg = self.get_vg()
|
||||
c1 = self._y1.set_target_value(value-vg/2)
|
||||
@@ -53,23 +60,27 @@ class SlitFourBlades_old:
|
||||
def __init__(self, Id, name=None, elog=None, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._ax1 = MotorRecord(Id+':MOTOR_AX1')
|
||||
self._ax2 = MotorRecord(Id+':MOTOR_AX2')
|
||||
self._ay1 = MotorRecord(Id+':MOTOR_AY1')
|
||||
self._ay2 = MotorRecord(Id+':MOTOR_AY2')
|
||||
self._bx1 = MotorRecord(Id+':MOTOR_BX1')
|
||||
self._bx2 = MotorRecord(Id+':MOTOR_BX2')
|
||||
self._by1 = MotorRecord(Id+':MOTOR_BY1')
|
||||
self._by2 = MotorRecord(Id+':MOTOR_BY2')
|
||||
self._ax1 = Motor(Id + ':MOTOR_AX1')
|
||||
self._ax2 = Motor(Id + ':MOTOR_AX2')
|
||||
self._ay1 = Motor(Id + ':MOTOR_AY1')
|
||||
self._ay2 = Motor(Id + ':MOTOR_AY2')
|
||||
self._bx1 = Motor(Id + ':MOTOR_BX1')
|
||||
self._bx2 = Motor(Id + ':MOTOR_BX2')
|
||||
self._by1 = Motor(Id + ':MOTOR_BY1')
|
||||
self._by2 = Motor(Id + ':MOTOR_BY2')
|
||||
|
||||
def get_hg(self):
|
||||
return self._ax2.get_current_value()-self._ax1.get_current_value()
|
||||
|
||||
def get_vg(self):
|
||||
return self._ay2.get_current_value()-self._ay1.get_current_value()
|
||||
|
||||
def get_ho(self):
|
||||
return (self._ax1.get_current_value()+self._ax2.get_current_value())/2
|
||||
|
||||
def get_vo(self):
|
||||
return (self._ay1.get_current_value()+self._ay2.get_current_value())/2
|
||||
|
||||
def set_hg(self,value):
|
||||
ho = self.get_ho()
|
||||
c1 = self._ax1.set_target_value(ho-value/2)
|
||||
@@ -77,6 +88,7 @@ class SlitFourBlades_old:
|
||||
c3 = self._bx1.set_target_value(ho-value/2)
|
||||
c4 = self._bx2.set_target_value(ho+value/2)
|
||||
return c1,c2,c3,c4
|
||||
|
||||
def set_vg(self,value):
|
||||
vo = self.get_vo()
|
||||
c1 = self._ay1.set_target_value(vo-value/2)
|
||||
@@ -92,6 +104,7 @@ class SlitFourBlades_old:
|
||||
c3 = self._bx1.set_target_value(value-hg/2)
|
||||
c4 = self._bx2.set_target_value(value+hg/2)
|
||||
return c1,c2,c3,c4
|
||||
|
||||
def set_vo(self,value):
|
||||
vg = self.get_vg()
|
||||
c1 = self._ay1.set_target_value(value-vg/2)
|
||||
@@ -104,36 +117,38 @@ class SlitFourBlades_old:
|
||||
self.set_hg(width)
|
||||
self.set_vg(height)
|
||||
|
||||
def __str__(self):
|
||||
def __repr__(self):
|
||||
string1 = 'gap: (%g,%g) mm'%(self.get_hg(),self.get_vg())
|
||||
string2 = 'pos: (%g,%g) mm'%(self.get_ho(),self.get_vo())
|
||||
return '\n'.join((string1,string2))
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
|
||||
class SlitPosWidth_old:
|
||||
def __init__(self, Id, name=None, elog=None, z_undulator=None, description=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._xoffs = MotorRecord(Id+':MOTOR_X')
|
||||
self._yoffs = MotorRecord(Id+':MOTOR_Y')
|
||||
self._xgap = MotorRecord(Id+':MOTOR_W')
|
||||
self._ygap = MotorRecord(Id+':MOTOR_H')
|
||||
self._xoffs = Motor(Id + ':MOTOR_X')
|
||||
self._yoffs = Motor(Id + ':MOTOR_Y')
|
||||
self._xgap = Motor(Id + ':MOTOR_W')
|
||||
self._ygap = Motor(Id + ':MOTOR_H')
|
||||
|
||||
def get_hg(self):
|
||||
return self._xgap.get_current_value()
|
||||
|
||||
def get_vg(self):
|
||||
return self._ygap.get_current_value()
|
||||
|
||||
def get_ho(self):
|
||||
return self._xoffs.get_current_value()
|
||||
|
||||
def get_vo(self):
|
||||
return self._yoffs.get_current_value()
|
||||
|
||||
def set_hg(self,value):
|
||||
c = self._xgap.set_target_value(value)
|
||||
return c
|
||||
|
||||
def set_vg(self,value):
|
||||
c = self._ygap.set_target_value(value)
|
||||
return c
|
||||
@@ -141,6 +156,7 @@ class SlitPosWidth_old:
|
||||
def set_ho(self,value):
|
||||
c = self._xoffs.set_target_value(value)
|
||||
return c
|
||||
|
||||
def set_vo(self,value):
|
||||
c = self._yoffs.set_target_value(value)
|
||||
return c
|
||||
@@ -153,3 +169,6 @@ class SlitPosWidth_old:
|
||||
string1 = 'gap: (%g,%g) mm'%(self.get_hg(),self.get_vg())
|
||||
string2 = 'pos: (%g,%g) mm'%(self.get_ho(),self.get_vo())
|
||||
return '\n'.join((string1,string2))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ..general.motors_new import MotorRecord
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..general.adjustable import AdjustableVirtual
|
||||
from slic.utils.eco_components.aliases import Alias, append_object_to_object
|
||||
from functools import partial
|
||||
@@ -17,14 +17,14 @@ class SlitBlades:
|
||||
self.name = name
|
||||
self.Id = pvname
|
||||
self.alias = Alias(name)
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_X1", name="right")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_X2", name="left")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_Y1", name="down")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_Y2", name="up")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_X", name="hpos_virt_mrec")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_W", name="hgap_virt_mrec")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_Y", name="vpos_virt_mrec")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_H", name="vgap_virt_mrec")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_X1", name="right")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_X2", name="left")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_Y1", name="down")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_Y2", name="up")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_X", name="hpos_virt_mrec")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_W", name="hgap_virt_mrec")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_Y", name="vpos_virt_mrec")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_H", name="vgap_virt_mrec")
|
||||
|
||||
def getgap(xn, xp):
|
||||
return xp - xn
|
||||
@@ -109,10 +109,10 @@ class SlitPosWidth:
|
||||
self.name = name
|
||||
self.Id = pvname
|
||||
self.alias = Alias(name)
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_X", name="hpos")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_Y", name="vpos")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_W", name="hgap")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOTOR_H", name="vgap")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_X", name="hpos")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_Y", name="vpos")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_W", name="hgap")
|
||||
append_object_to_object(self, Motor, pvname + ":MOTOR_H", name="vgap")
|
||||
|
||||
def getblade(pos,gap,direction=1):
|
||||
return pos + direction*gap/2
|
||||
@@ -205,10 +205,10 @@ class SlitBlades_JJ:
|
||||
self.name = name
|
||||
self.Id = pvname
|
||||
self.alias = Alias(name)
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOT_1", name="right")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOT_2", name="left")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOT_4", name="down")
|
||||
append_object_to_object(self, MotorRecord, pvname + ":MOT_3", name="up")
|
||||
append_object_to_object(self, Motor, pvname + ":MOT_1", name="right")
|
||||
append_object_to_object(self, Motor, pvname + ":MOT_2", name="left")
|
||||
append_object_to_object(self, Motor, pvname + ":MOT_4", name="down")
|
||||
append_object_to_object(self, Motor, pvname + ":MOT_3", name="up")
|
||||
|
||||
def getgap(xn, xp):
|
||||
return xp - xn
|
||||
@@ -292,10 +292,10 @@ class SlitBlades_old:
|
||||
def __init__(self, Id, name=None, elog=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._x1 = MotorRecord(Id + ":MOTOR_X1")
|
||||
self._x2 = MotorRecord(Id + ":MOTOR_X2")
|
||||
self._y1 = MotorRecord(Id + ":MOTOR_Y1")
|
||||
self._y2 = MotorRecord(Id + ":MOTOR_Y2")
|
||||
self._x1 = Motor(Id + ":MOTOR_X1")
|
||||
self._x2 = Motor(Id + ":MOTOR_X2")
|
||||
self._y1 = Motor(Id + ":MOTOR_Y1")
|
||||
self._y2 = Motor(Id + ":MOTOR_Y2")
|
||||
|
||||
def get_hg(self):
|
||||
return self._x2.get_current_value() - self._x1.get_current_value()
|
||||
@@ -347,10 +347,10 @@ class SlitBladesJJ_old:
|
||||
def __init__(self, Id, name=None, elog=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._x1 = MotorRecord(Id + ":MOT2")
|
||||
self._x2 = MotorRecord(Id + ":MOT3")
|
||||
self._y1 = MotorRecord(Id + ":MOT4")
|
||||
self._y2 = MotorRecord(Id + ":MOT5")
|
||||
self._x1 = Motor(Id + ":MOT2")
|
||||
self._x2 = Motor(Id + ":MOT3")
|
||||
self._y1 = Motor(Id + ":MOT4")
|
||||
self._y2 = Motor(Id + ":MOT5")
|
||||
|
||||
def get_hg(self):
|
||||
return -(self._x2.get_current_value() - self._x1.get_current_value())
|
||||
@@ -402,14 +402,14 @@ class SlitFourBlades_old:
|
||||
def __init__(self, Id, name=None, elog=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._ax1 = MotorRecord(Id + ":MOTOR_AX1")
|
||||
self._ax2 = MotorRecord(Id + ":MOTOR_AX2")
|
||||
self._ay1 = MotorRecord(Id + ":MOTOR_AY1")
|
||||
self._ay2 = MotorRecord(Id + ":MOTOR_AY2")
|
||||
self._bx1 = MotorRecord(Id + ":MOTOR_BX1")
|
||||
self._bx2 = MotorRecord(Id + ":MOTOR_BX2")
|
||||
self._by1 = MotorRecord(Id + ":MOTOR_BY1")
|
||||
self._by2 = MotorRecord(Id + ":MOTOR_BY2")
|
||||
self._ax1 = Motor(Id + ":MOTOR_AX1")
|
||||
self._ax2 = Motor(Id + ":MOTOR_AX2")
|
||||
self._ay1 = Motor(Id + ":MOTOR_AY1")
|
||||
self._ay2 = Motor(Id + ":MOTOR_AY2")
|
||||
self._bx1 = Motor(Id + ":MOTOR_BX1")
|
||||
self._bx2 = Motor(Id + ":MOTOR_BX2")
|
||||
self._by1 = Motor(Id + ":MOTOR_BY1")
|
||||
self._by2 = Motor(Id + ":MOTOR_BY2")
|
||||
|
||||
def get_hg(self):
|
||||
return self._ax2.get_current_value() - self._ax1.get_current_value()
|
||||
@@ -472,10 +472,10 @@ class SlitPosWidth_old:
|
||||
def __init__(self, Id, name=None, elog=None):
|
||||
self.Id = Id
|
||||
self.name = name
|
||||
self._xoffs = MotorRecord(Id + ":MOTOR_X")
|
||||
self._yoffs = MotorRecord(Id + ":MOTOR_Y")
|
||||
self._xgap = MotorRecord(Id + ":MOTOR_W")
|
||||
self._ygap = MotorRecord(Id + ":MOTOR_H")
|
||||
self._xoffs = Motor(Id + ":MOTOR_X")
|
||||
self._yoffs = Motor(Id + ":MOTOR_Y")
|
||||
self._xgap = Motor(Id + ":MOTOR_W")
|
||||
self._ygap = Motor(Id + ":MOTOR_H")
|
||||
|
||||
def get_hg(self):
|
||||
return self._xgap.get_current_value()
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
from ..devices_general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from ..eco_epics.utilities_epics import EnumWrapper
|
||||
from slic.core.task import Task
|
||||
from time import sleep
|
||||
import numpy as np
|
||||
from epics import PV
|
||||
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..eco_epics.utilities_epics import EnumWrapper
|
||||
from slic.core.task import Task
|
||||
|
||||
|
||||
class Double_Crystal_Mono_AramisMacro:
|
||||
def __init__(self,Id,timeAdjustable=None,timeReferenceEnergy=None,timeReference=None):
|
||||
def __init__(self, Id, timeAdjustable=None, timeReferenceEnergy=None, timeReference=None):
|
||||
self.Id = Id
|
||||
self.theta = MotorRecord(Id+':RX12')
|
||||
self.x = MotorRecord(Id+':TX12')
|
||||
self.gap = MotorRecord(Id+':T2')
|
||||
self.roll1 = MotorRecord(Id+':RZ1')
|
||||
self.roll2 = MotorRecord(Id+':RZ2')
|
||||
self.pitch2 = MotorRecord(Id+':RX2')
|
||||
|
||||
self.energy_rbk = PV(Id+':ENERGY')
|
||||
self.energy_sp = PV(Id+':ENERGY_SP')
|
||||
self.moving = PV(Id+':MOVING')
|
||||
self.theta = Motor(Id + ':RX12')
|
||||
self.x = Motor(Id + ':TX12')
|
||||
self.gap = Motor(Id + ':T2')
|
||||
self.roll1 = Motor(Id + ':RZ1')
|
||||
self.roll2 = Motor(Id + ':RZ2')
|
||||
self.pitch2 = Motor(Id + ':RX2')
|
||||
|
||||
self.energy_rbk = PV(Id + ':ENERGY')
|
||||
self.energy_sp = PV(Id + ':ENERGY_SP')
|
||||
self.moving = PV(Id + ':MOVING')
|
||||
self._stop = PV(Id +':STOP.PROC')
|
||||
self.crystal_type = EnumWrapper(Id + ':CRYSTAL_SP')
|
||||
self.beam_offset = PV(Id + ':BEAM_OFFSET')
|
||||
@@ -27,7 +28,7 @@ class Double_Crystal_Mono_AramisMacro:
|
||||
self.timeReference = timeReference
|
||||
self.correctTime = False
|
||||
|
||||
def _calcOffsetDetour(self,E,crystal_type=None,beam_offset=None):
|
||||
def _calcOffsetDetour(self, E, crystal_type=None, beam_offset=None):
|
||||
if not crystal_type:
|
||||
crystal_type = self.crystal_type.get()
|
||||
if crystal_type is "Si-111":
|
||||
@@ -39,7 +40,7 @@ class Double_Crystal_Mono_AramisMacro:
|
||||
theta = np.arcsin(12398.419739640718/E/2/d)
|
||||
return np.tan(theta) * beam_offset
|
||||
|
||||
def setTimeReference(self,t=None,E=None):
|
||||
def setTimeReference(self, t=None, E=None):
|
||||
if not t:
|
||||
t = self.timeAdjustable.get_current_value()
|
||||
if not E:
|
||||
@@ -48,7 +49,7 @@ class Double_Crystal_Mono_AramisMacro:
|
||||
self.timeReference = t
|
||||
self.timeReferenceEnergy = E
|
||||
|
||||
def move_and_wait(self,value,checktime=.01,precision=.5):
|
||||
def move_and_wait(self, value, checktime=.01, precision=.5):
|
||||
if self.correctTime:
|
||||
p_ref = self._calcOffsetDetour(self.timeReferenceEnergy)
|
||||
p_target = self._calcOffsetDetour(value)
|
||||
@@ -61,46 +62,48 @@ class Double_Crystal_Mono_AramisMacro:
|
||||
#while abs(self.wait_for_valid_value()-value)>precision:
|
||||
# sleep(checktime)
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
def set_target_value(self, value, hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold, stopper=self.stop)
|
||||
|
||||
def stop(self):
|
||||
self._stop.put(1)
|
||||
self._stop.put(1)
|
||||
|
||||
def get_current_value(self):
|
||||
currentenergy = self.energy_rbk.get()
|
||||
return currentenergy
|
||||
currentenergy = self.energy_rbk.get()
|
||||
return currentenergy
|
||||
|
||||
def wait_for_valid_value(self):
|
||||
tval = np.nan
|
||||
while not np.isfinite(tval):
|
||||
tval = self.energy_rbk.get()
|
||||
return(tval)
|
||||
|
||||
|
||||
def set_current_value(self,value):
|
||||
self.energy_sp.put(value)
|
||||
|
||||
self.energy_sp.put(value)
|
||||
|
||||
def is_moving(self):
|
||||
inmotion = int(self.moving.get())
|
||||
return not bool(inmotion)
|
||||
|
||||
inmotion = int(self.moving.get())
|
||||
return not bool(inmotion)
|
||||
|
||||
# spec-inspired convenience methods
|
||||
def mv(self,value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
|
||||
def wm(self,*args,**kwargs):
|
||||
return self.get_current_value(*args,**kwargs)
|
||||
def mvr(self,value,*args,**kwargs):
|
||||
|
||||
def mvr(self,value,*args,**kwargs):
|
||||
if not self.is_moving():
|
||||
startvalue = self.get_current_value(*args,**kwargs)
|
||||
else:
|
||||
startvalue = self.get_current_value(*args,**kwargs)
|
||||
self._currentChange = self.set_target_value(value+startvalue,*args,**kwargs)
|
||||
|
||||
def wait(self):
|
||||
self._currentChange.wait()
|
||||
|
||||
def __str__(self):
|
||||
|
||||
def __repr__(self):
|
||||
s = "**Double crystal monochromator**\n\n"
|
||||
motors = "theta gap x roll1 roll2 pitch2".split()
|
||||
for motor in motors:
|
||||
@@ -109,16 +112,13 @@ class Double_Crystal_Mono_AramisMacro:
|
||||
for pv in pvs:
|
||||
s+= " - %s = %.4f\n" %(pv, getattr(self,pv).value)
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __call__(self,value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
|
||||
|
||||
class EcolEnergy:
|
||||
def __init__(self,Id, val='SARCL02-MBND100:P-SET',rb='SARCL02-MBND100:P-READ' ,dmov='SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK'):
|
||||
def __init__(self,Id, val='SARCL02-MBND100:P-SET', rb='SARCL02-MBND100:P-READ', dmov='SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK'):
|
||||
self.Id = Id
|
||||
self.setter = PV(val)
|
||||
self.readback = PV(rb)
|
||||
@@ -128,7 +128,7 @@ class EcolEnergy:
|
||||
def get_current_value(self):
|
||||
return self.readback.get()
|
||||
|
||||
def move_and_wait(self,value,checktime=.01,precision=2):
|
||||
def move_and_wait(self, value, checktime=.01, precision=2):
|
||||
curr = self.setter.get()
|
||||
while abs(curr-value)>0.1:
|
||||
curr = self.setter.get()
|
||||
@@ -142,23 +142,25 @@ class EcolEnergy:
|
||||
#print(self.dmov.get())
|
||||
sleep(checktime)
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
def set_target_value(self, value, hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold)
|
||||
|
||||
|
||||
|
||||
class Double_Crystal_Mono:
|
||||
def __init__(self,Id,timeAdjustable=None,timeReferenceEnergy=None,timeReference=None):
|
||||
def __init__(self, Id, timeAdjustable=None, timeReferenceEnergy=None, timeReference=None):
|
||||
self.Id = Id
|
||||
self.theta = MotorRecord(Id+':RX12')
|
||||
self.x = MotorRecord(Id+':TX12')
|
||||
self.gap = MotorRecord(Id+':T2')
|
||||
self.roll1 = MotorRecord(Id+':RZ1')
|
||||
self.roll2 = MotorRecord(Id+':RZ2')
|
||||
self.pitch2 = MotorRecord(Id+':RX2')
|
||||
|
||||
self.energy_rbk = PV(Id+':ENERGY')
|
||||
self.energy_sp = PV(Id+':ENERGY_SP')
|
||||
self.moving = PV(Id+':MOVING')
|
||||
self.theta = Motor(Id + ':RX12')
|
||||
self.x = Motor(Id + ':TX12')
|
||||
self.gap = Motor(Id + ':T2')
|
||||
self.roll1 = Motor(Id + ':RZ1')
|
||||
self.roll2 = Motor(Id + ':RZ2')
|
||||
self.pitch2 = Motor(Id + ':RX2')
|
||||
|
||||
self.energy_rbk = PV(Id + ':ENERGY')
|
||||
self.energy_sp = PV(Id + ':ENERGY_SP')
|
||||
self.moving = PV(Id + ':MOVING')
|
||||
self._stop = PV(Id +':STOP.PROC')
|
||||
self.crystal_type = EnumWrapper(Id + ':CRYSTAL_SP')
|
||||
self.beam_offset = PV(Id + ':BEAM_OFFSET')
|
||||
@@ -167,7 +169,7 @@ class Double_Crystal_Mono:
|
||||
self.timeReference = timeReference
|
||||
self.correctTime = False
|
||||
|
||||
def _calcOffsetDetour(self,E,crystal_type=None,beam_offset=None):
|
||||
def _calcOffsetDetour(self, E, crystal_type=None, beam_offset=None):
|
||||
if not crystal_type:
|
||||
crystal_type = str(self.crystal_type)
|
||||
if crystal_type=="Si-111":
|
||||
@@ -179,7 +181,7 @@ class Double_Crystal_Mono:
|
||||
theta = np.arcsin(12398.419739640718/E/2/d)
|
||||
return np.tan(theta) * beam_offset
|
||||
|
||||
def setTimeReference(self,t=None,E=None):
|
||||
def setTimeReference(self, t=None, E=None):
|
||||
if not t:
|
||||
t = self.timeAdjustable.get_current_value()
|
||||
if not E:
|
||||
@@ -188,7 +190,7 @@ class Double_Crystal_Mono:
|
||||
self.timeReference = t
|
||||
self.timeReferenceEnergy = E
|
||||
|
||||
def move_and_wait(self,value,checktime=.01,precision=.5):
|
||||
def move_and_wait(self, value, checktime=.01, precision=.5):
|
||||
if self.correctTime:
|
||||
p_ref = self._calcOffsetDetour(self.timeReferenceEnergy)
|
||||
p_target = self._calcOffsetDetour(value)
|
||||
@@ -202,64 +204,63 @@ class Double_Crystal_Mono:
|
||||
if self.correctTime:
|
||||
time_mover.wait()
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
def set_target_value(self, value, hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold, stopper=self.stop)
|
||||
|
||||
|
||||
def stop(self):
|
||||
self._stop.put(1)
|
||||
self._stop.put(1)
|
||||
|
||||
def get_current_value(self):
|
||||
currentenergy = self.energy_rbk.get()
|
||||
return currentenergy
|
||||
currentenergy = self.energy_rbk.get()
|
||||
return currentenergy
|
||||
|
||||
def wait_for_valid_value(self):
|
||||
tval = np.nan
|
||||
while not np.isfinite(tval):
|
||||
tval = self.energy_rbk.get()
|
||||
return(tval)
|
||||
|
||||
|
||||
def set_current_value(self,value):
|
||||
self.energy_sp.put(value)
|
||||
|
||||
self.energy_sp.put(value)
|
||||
|
||||
def is_moving(self):
|
||||
inmotion = int(self.moving.get())
|
||||
return not bool(inmotion)
|
||||
|
||||
inmotion = int(self.moving.get())
|
||||
return not bool(inmotion)
|
||||
|
||||
# spec-inspired convenience methods
|
||||
def mv(self,value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
|
||||
def wm(self,*args,**kwargs):
|
||||
return self.get_current_value(*args,**kwargs)
|
||||
def mvr(self,value,*args,**kwargs):
|
||||
|
||||
def mvr(self,value,*args,**kwargs):
|
||||
if not self.is_moving():
|
||||
startvalue = self.get_current_value(*args,**kwargs)
|
||||
else:
|
||||
startvalue = self.get_current_value(*args,**kwargs)
|
||||
self._currentChange = self.set_target_value(value+startvalue,*args,**kwargs)
|
||||
|
||||
def wait(self):
|
||||
self._currentChange.wait()
|
||||
|
||||
def __str__(self):
|
||||
|
||||
def __repr__(self):
|
||||
s = "**Double crystal monochromator**\n\n"
|
||||
motors = "theta gap x roll1 roll2 pitch2".split()
|
||||
for motor in motors:
|
||||
s+= " - %s = %.4f\n" %(motor, getattr(self,motor).wm())
|
||||
s+= " - %s = %.4f\n" %(motor, getattr(self, motor).wm())
|
||||
pvs = "energy_rbk".split()
|
||||
for pv in pvs:
|
||||
s+= " - %s = %.4f\n" %(pv, getattr(self,pv).value)
|
||||
s+= " - %s = %.4f\n" %(pv, getattr(self, pv).value)
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __call__(self,value):
|
||||
self._currentChange = self.set_target_value(value)
|
||||
|
||||
|
||||
class EcolEnergy:
|
||||
def __init__(self,Id, val='SARCL02-MBND100:P-SET',rb='SARCL02-MBND100:P-READ' ,dmov='SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK'):
|
||||
def __init__(self,Id, val='SARCL02-MBND100:P-SET', rb='SARCL02-MBND100:P-READ', dmov='SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK'):
|
||||
self.Id = Id
|
||||
self.setter = PV(val)
|
||||
self.readback = PV(rb)
|
||||
@@ -269,7 +270,7 @@ class EcolEnergy:
|
||||
def get_current_value(self):
|
||||
return self.readback.get()
|
||||
|
||||
def move_and_wait(self,value,checktime=.01,precision=2):
|
||||
def move_and_wait(self, value, checktime=.01, precision=2):
|
||||
curr = self.setter.get()
|
||||
while abs(curr-value)>0.1:
|
||||
curr = self.setter.get()
|
||||
@@ -277,37 +278,36 @@ class EcolEnergy:
|
||||
sleep(0.3)
|
||||
|
||||
self.setter.put(value)
|
||||
while abs(self.get_current_value() - value)>precision:
|
||||
while abs(self.get_current_value() - value) > precision:
|
||||
sleep(checktime)
|
||||
while not self.dmov.get():
|
||||
#print(self.dmov.get())
|
||||
sleep(checktime)
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
|
||||
def set_target_value(self, value, hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold)
|
||||
|
||||
|
||||
class MonoEcolEnergy:
|
||||
def __init__(self,Id):
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
self.name = 'energy_collimator'
|
||||
self.dcm = Double_Crystal_Mono(Id)
|
||||
self.ecol = EcolEnergy('ecol_dummy')
|
||||
self.offset = None
|
||||
self.MeVperEV = 0.78333
|
||||
|
||||
|
||||
def get_current_value(self):
|
||||
return self.dcm.get_current_value()
|
||||
|
||||
def move_and_wait(self,value):
|
||||
def move_and_wait(self, value):
|
||||
ch = [self.dcm.set_target_value(value),
|
||||
self.ecol.set_target_value(self.calcEcol(value))]
|
||||
for tc in ch:
|
||||
tc.wait()
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
def set_target_value(self, value, hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold, stopper=self.dcm.stop)
|
||||
|
||||
@@ -316,81 +316,78 @@ class MonoEcolEnergy:
|
||||
erb = self.ecol.get_current_value()
|
||||
self.offset = {'dcm':mrb, 'ecol':erb}
|
||||
|
||||
def calcEcol(self,eV):
|
||||
def calcEcol(self, eV):
|
||||
return (eV-self.offset['dcm'])*self.MeVperEV + self.offset['ecol']
|
||||
|
||||
|
||||
class AlvraDCM_FEL:
|
||||
def __init__(self,Id):
|
||||
self.Id = Id
|
||||
self.name = 'Alvra DCM monochromator coupled to FEL beam'
|
||||
# self.IOCstatus = PV('ALVRA:running') # bool 0 running, 1 not running
|
||||
self._FELcoupling = PV('SGE-OP2E-ARAMIS:MODE_SP') # string "Off" or "e-beam"
|
||||
self._setEnergy = PV('SAROP11-ARAMIS:ENERGY_SP_USER') # float eV
|
||||
self._getEnergy = PV('SAROP11-ARAMIS:ENERGY') # float eV
|
||||
self.ebeamEnergy = PV('SARCL02-MBND100:P-READ') # float MeV/c
|
||||
# self.ebeamEnergySP = PV('ALVRA:Energy_SP') # float MeV
|
||||
self.dcmStop = PV('SAROP11-ODCM105:STOP.PROC') # stop the DCM motors
|
||||
self.dcmMoving = PV('SAROP11-ODCM105:MOVING') # DCM moving field
|
||||
self._energyChanging = PV('SGE-OP2E-ARAMIS:MOVING') # PV telling you something related to the energy is changing
|
||||
self._alvraMode = PV('SAROP11-ARAMIS:MODE') # string Aramis SAROP11 mode
|
||||
self.ebeamOK = PV('SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK') # is ebeam no longer changing
|
||||
self.photCalib1 = PV('SGE-OP2E-ARAMIS:PH2E_X1') # photon energy calibration low calibration point
|
||||
self.photCalib2 = PV('SGE-OP2E-ARAMIS:PH2E_X2') # photon energy calibration high calibration point
|
||||
self.ebeamCalib1 = PV('SGE-OP2E-ARAMIS:PH2E_Y1') # electron energy calibration low calibration point
|
||||
self.ebeamCalib2 = PV('SGE-OP2E-ARAMIS:PH2E_Y2') # electron energy calibration high calibration point
|
||||
|
||||
def __str__(self):
|
||||
# ioc = self.IOCstatus.get()
|
||||
# if ioc == 0:
|
||||
# iocStr = "Soft IOC running"
|
||||
# else:
|
||||
# iocStr = "Soft IOC not running"
|
||||
FELcouplingStr = self._FELcoupling.get(as_string=True)
|
||||
alvraModeStr = self._alvraMode.get(as_string=True)
|
||||
currEnergy = self._getEnergy.get()
|
||||
currebeamEnergy = self.ebeamEnergy.get()
|
||||
photCalib1Str = self.photCalib1.get()
|
||||
photCalib2Str = self.photCalib2.get()
|
||||
ebeamCalib1Str = self.ebeamCalib1.get()
|
||||
ebeamCalib2Str = self.ebeamCalib2.get()
|
||||
|
||||
s = '**Alvra DCM-FEL status**\n\n'
|
||||
# print('%s'%iocStr)
|
||||
# print('FEL coupling %s'%FELcouplingStr)
|
||||
# print('Alvra beamline mode %s'%alvraModeStr)
|
||||
# print('Photon energy (eV) %'%currEnergy)
|
||||
# s += '%s\n'%iocStr
|
||||
s += 'FEL coupling: %s\n'%FELcouplingStr
|
||||
s += 'Alvra beamline mode: %s\n'%alvraModeStr
|
||||
s += 'Photon energy: %.2f eV\n'%currEnergy
|
||||
s += 'Electron energy: %.2f MeV\n'%currebeamEnergy
|
||||
s += 'Calibration set points:\n'
|
||||
s += 'Low: Photon %.2f keV, Electron %.2f MeV\n'%(photCalib1Str, ebeamCalib1Str)
|
||||
s += 'High: Photon %.2f keV, Electron %.2f MeV\n'%(photCalib2Str, ebeamCalib2Str)
|
||||
return s
|
||||
|
||||
def get_current_value(self):
|
||||
return self._getEnergy.get()
|
||||
|
||||
def move_and_wait(self,value,checktime=.1,precision=0.5):
|
||||
self._FELcoupling.put(1) # ensure the FEL coupling is turned on
|
||||
self._setEnergy.put(value)
|
||||
# while self.ebeamOK.get()==0:
|
||||
# sleep(checktime)
|
||||
# while abs(self.ebeamEnergy.get()-self.ebeamEnergySP.get())>precision:
|
||||
# sleep(checktime)
|
||||
# while self.dcmMoving.get()==1:
|
||||
# sleep(checktime)
|
||||
while self._energyChanging == 1:
|
||||
sleep(checktime)
|
||||
def __init__(self, Id):
|
||||
self.Id = Id
|
||||
self.name = 'Alvra DCM monochromator coupled to FEL beam'
|
||||
# self.IOCstatus = PV('ALVRA:running') # bool 0 running, 1 not running
|
||||
self._FELcoupling = PV('SGE-OP2E-ARAMIS:MODE_SP') # string "Off" or "e-beam"
|
||||
self._setEnergy = PV('SAROP11-ARAMIS:ENERGY_SP_USER') # float eV
|
||||
self._getEnergy = PV('SAROP11-ARAMIS:ENERGY') # float eV
|
||||
self.ebeamEnergy = PV('SARCL02-MBND100:P-READ') # float MeV/c
|
||||
# self.ebeamEnergySP = PV('ALVRA:Energy_SP') # float MeV
|
||||
self.dcmStop = PV('SAROP11-ODCM105:STOP.PROC') # stop the DCM motors
|
||||
self.dcmMoving = PV('SAROP11-ODCM105:MOVING') # DCM moving field
|
||||
self._energyChanging = PV('SGE-OP2E-ARAMIS:MOVING') # PV telling you something related to the energy is changing
|
||||
self._alvraMode = PV('SAROP11-ARAMIS:MODE') # string Aramis SAROP11 mode
|
||||
self.ebeamOK = PV('SFB_BEAM_ENERGY_ECOL:SUM-ERROR-OK') # is ebeam no longer changing
|
||||
self.photCalib1 = PV('SGE-OP2E-ARAMIS:PH2E_X1') # photon energy calibration low calibration point
|
||||
self.photCalib2 = PV('SGE-OP2E-ARAMIS:PH2E_X2') # photon energy calibration high calibration point
|
||||
self.ebeamCalib1 = PV('SGE-OP2E-ARAMIS:PH2E_Y1') # electron energy calibration low calibration point
|
||||
self.ebeamCalib2 = PV('SGE-OP2E-ARAMIS:PH2E_Y2') # electron energy calibration high calibration point
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold)
|
||||
def __repr__(self):
|
||||
# ioc = self.IOCstatus.get()
|
||||
# if ioc == 0:
|
||||
# iocStr = "Soft IOC running"
|
||||
# else:
|
||||
# iocStr = "Soft IOC not running"
|
||||
FELcouplingStr = self._FELcoupling.get(as_string=True)
|
||||
alvraModeStr = self._alvraMode.get(as_string=True)
|
||||
currEnergy = self._getEnergy.get()
|
||||
currebeamEnergy = self.ebeamEnergy.get()
|
||||
photCalib1Str = self.photCalib1.get()
|
||||
photCalib2Str = self.photCalib2.get()
|
||||
ebeamCalib1Str = self.ebeamCalib1.get()
|
||||
ebeamCalib2Str = self.ebeamCalib2.get()
|
||||
|
||||
s = '**Alvra DCM-FEL status**\n\n'
|
||||
# print('%s'%iocStr)
|
||||
# print('FEL coupling %s'%FELcouplingStr)
|
||||
# print('Alvra beamline mode %s'%alvraModeStr)
|
||||
# print('Photon energy (eV) %'%currEnergy)
|
||||
# s += '%s\n'%iocStr
|
||||
s += 'FEL coupling: %s\n'%FELcouplingStr
|
||||
s += 'Alvra beamline mode: %s\n'%alvraModeStr
|
||||
s += 'Photon energy: %.2f eV\n'%currEnergy
|
||||
s += 'Electron energy: %.2f MeV\n'%currebeamEnergy
|
||||
s += 'Calibration set points:\n'
|
||||
s += 'Low: Photon %.2f keV, Electron %.2f MeV\n'%(photCalib1Str, ebeamCalib1Str)
|
||||
s += 'High: Photon %.2f keV, Electron %.2f MeV\n'%(photCalib2Str, ebeamCalib2Str)
|
||||
return s
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
def get_current_value(self):
|
||||
return self._getEnergy.get()
|
||||
|
||||
def move_and_wait(self,value,checktime=.1,precision=0.5):
|
||||
self._FELcoupling.put(1) # ensure the FEL coupling is turned on
|
||||
self._setEnergy.put(value)
|
||||
# while self.ebeamOK.get()==0:
|
||||
# sleep(checktime)
|
||||
# while abs(self.ebeamEnergy.get()-self.ebeamEnergySP.get())>precision:
|
||||
# sleep(checktime)
|
||||
# while self.dcmMoving.get()==1:
|
||||
# sleep(checktime)
|
||||
while self._energyChanging == 1:
|
||||
sleep(checktime)
|
||||
|
||||
def set_target_value(self,value,hold=False):
|
||||
changer = lambda: self.move_and_wait(value)
|
||||
return Task(changer, hold=hold)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from ...general.motors import MotorRecord
|
||||
from epics import PV
|
||||
from slic.devices.general.motor import Motor
|
||||
from ..aliases import Alias, append_object_to_object
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ class RefLaser_Aramis:
|
||||
|
||||
self._inpos = inpos
|
||||
self._outpos = outpos
|
||||
self.mirrmotor = MotorRecord(self.Id + ":MOTOR_1")
|
||||
self.mirrmotor = Motor(self.Id + ":MOTOR_1")
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.set(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
def __repr__(self):
|
||||
status = self.get_status()
|
||||
if status:
|
||||
return "Reflaser is In."
|
||||
@@ -50,5 +50,5 @@ class RefLaser_Aramis:
|
||||
else:
|
||||
self.mirrmotor.set_target_value(self._outpos)
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user