Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff057af10f | |||
| 1aa2afe35a | |||
| dcc3f6d774 |
+46
-36
@@ -1185,6 +1185,7 @@ namespace.append_obj(
|
||||
"RIXS",
|
||||
lazy=True,
|
||||
name="rixs",
|
||||
jf_id="JF14T01V01",
|
||||
config_jf_adj=config_JFs,
|
||||
pgroup_adj=config_bernina.pgroup,
|
||||
module_name="eco.endstations.bernina_rixs",
|
||||
@@ -1318,13 +1319,13 @@ namespace.append_obj(
|
||||
# module_name="eco.devices_general.cameras_swissfel",
|
||||
# )
|
||||
|
||||
# namespace.append_obj(
|
||||
# "OxygenSensor",
|
||||
# "SARES20-CWAG-GPS01:ADC08",
|
||||
# lazy=True,
|
||||
# name="oxygen_sensor",
|
||||
# module_name="eco.devices_general.sensors_ai",
|
||||
# )
|
||||
namespace.append_obj(
|
||||
"OxygenSensor",
|
||||
"SARES20-CWAG-GPS01:ADC08",
|
||||
lazy=True,
|
||||
name="oxygen_sensor",
|
||||
module_name="eco.devices_general.sensors_ai",
|
||||
)
|
||||
|
||||
# namespace.append_obj(
|
||||
# "CameraBasler",
|
||||
@@ -1400,12 +1401,12 @@ namespace.append_obj(
|
||||
)
|
||||
|
||||
|
||||
# namespace.append_obj(
|
||||
# "IncouplingCleanBernina",
|
||||
# lazy=True,
|
||||
# name="clic",
|
||||
# module_name="eco.loptics.bernina_laser",
|
||||
# )
|
||||
namespace.append_obj(
|
||||
"IncouplingCleanBernina",
|
||||
lazy=True,
|
||||
name="clic",
|
||||
module_name="eco.loptics.bernina_laser",
|
||||
)
|
||||
# namespace.append_obj(
|
||||
# "MidIR",
|
||||
# lazy=True,
|
||||
@@ -1572,30 +1573,39 @@ class Incoupling(Assembly):
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_15", name="thz_par2_rx", is_setting=True
|
||||
# )
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_11", name="thz_par1_z", is_setting=True
|
||||
)
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_17", name="thz_par1_ry", is_setting=True
|
||||
)
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_11", name="thz_par1_z", is_setting=True
|
||||
# )
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_17", name="thz_par1_ry", is_setting=True
|
||||
# )
|
||||
|
||||
# try:
|
||||
# self.motor_configuration_thorlabs = {
|
||||
# "thz_filter": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL4",
|
||||
# },
|
||||
# "thz_crystal": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL3",
|
||||
# },
|
||||
# "thz_waveplate": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL5",
|
||||
# },
|
||||
# "nd_filter": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL2",
|
||||
# },
|
||||
# "polarizer": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL1",
|
||||
# },
|
||||
# }
|
||||
try:
|
||||
self.motor_configuration_thorlabs = {
|
||||
"thz_filter": {
|
||||
"pvname": "SLAAR21-LMOT-ELL4",
|
||||
},
|
||||
"thz_crystal": {
|
||||
"pvname": "SLAAR21-LMOT-ELL3",
|
||||
},
|
||||
"thz_waveplate": {
|
||||
"hwp": {
|
||||
"pvname": "SLAAR21-LMOT-ELL5",
|
||||
},
|
||||
"nd_filter": {
|
||||
"fw": {
|
||||
"pvname": "SLAAR21-LMOT-ELL2",
|
||||
},
|
||||
"polarizer": {
|
||||
"pvname": "SLAAR21-LMOT-ELL1",
|
||||
},
|
||||
}
|
||||
|
||||
### thorlabs piezo motors ###
|
||||
@@ -1613,9 +1623,9 @@ class Incoupling(Assembly):
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_18", name="opa_mirr2_ry", is_setting=True
|
||||
# )
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_10", name="tt_nopa_target", is_setting=True
|
||||
)
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_10", name="tt_nopa_target", is_setting=True
|
||||
# )
|
||||
self._append(
|
||||
AnalogOutput,
|
||||
"SLAAR21-LDIO-LAS6991:DAC07_VOLTS",
|
||||
@@ -1629,9 +1639,9 @@ class Incoupling(Assembly):
|
||||
is_setting=True,
|
||||
)
|
||||
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_X", name="lens_z", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_Y", name="lens_x", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_Z", name="lens_y", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_1", name="lens_z", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_2", name="lens_x", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_3", name="lens_y", is_setting=True)
|
||||
# self._append(
|
||||
# MotorRecord, "SARES20-MF1:MOT_13", name="eos_mirr", is_setting=True
|
||||
# )
|
||||
|
||||
@@ -56,7 +56,7 @@ class CamserverConfig2(Assembly):
|
||||
precision=0,
|
||||
check_interval=None,
|
||||
name="_config",
|
||||
is_setting=False,
|
||||
is_setting=True,
|
||||
is_display=False,
|
||||
)
|
||||
|
||||
@@ -64,7 +64,7 @@ class CamserverConfig2(Assembly):
|
||||
AdjustableObject,
|
||||
self._config,
|
||||
name="config",
|
||||
is_setting=True,
|
||||
is_setting=False,
|
||||
is_display="recursive",
|
||||
)
|
||||
self._append(
|
||||
|
||||
@@ -10,6 +10,7 @@ from ..aliases import Alias
|
||||
from ..elements.adjustable import (
|
||||
AdjustableError,
|
||||
AdjustableFS,
|
||||
AdjustableGetSet,
|
||||
AdjustableMemory,
|
||||
spec_convenience,
|
||||
ValueInRange,
|
||||
@@ -883,7 +884,7 @@ class SmarActOpenLoopRecord(Assembly):
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_position.json",
|
||||
name="position",
|
||||
name="_position",
|
||||
default_value=0,
|
||||
is_setting=True,
|
||||
is_display=True,
|
||||
@@ -907,7 +908,7 @@ class SmarActOpenLoopRecord(Assembly):
|
||||
|
||||
def move(self, value, check=True, wait=False):
|
||||
value = int(value) * self.direction()
|
||||
pos = int(self.position() * self.direction())
|
||||
pos = int(self._position() * self.direction())
|
||||
target_rel = value - pos
|
||||
if check:
|
||||
if self.limit_low:
|
||||
@@ -924,7 +925,7 @@ class SmarActOpenLoopRecord(Assembly):
|
||||
f":MST{self.channel-1},{target_rel},{int(self.voltage()*40.95)},{int(self.frequency())}"
|
||||
)
|
||||
if res[-1] == "0":
|
||||
self.position.mv(value)
|
||||
self._position.mv(value)
|
||||
else:
|
||||
raise Exception(
|
||||
f"Motion of SmarAct Motor {self.name} failed with error code {res}"
|
||||
@@ -938,7 +939,197 @@ class SmarActOpenLoopRecord(Assembly):
|
||||
self.limit_high.set_target_value(limit_high)
|
||||
|
||||
def get_current_value(self):
|
||||
return self.position.get_current_value()
|
||||
return self._position.get_current_value()
|
||||
|
||||
def set_current_value(self, value):
|
||||
self._position(value)
|
||||
|
||||
def set_target_value(self, value, hold=False, check=True, **kwargs):
|
||||
return Changer(
|
||||
target=value,
|
||||
parent=self,
|
||||
changer=self.move,
|
||||
hold=hold,
|
||||
stopper=self.stop,
|
||||
)
|
||||
|
||||
# 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} stat: {self.status_flag().name}"
|
||||
s += f"\t@ {colorama.Style.BRIGHT}{self.get_current_value():1.6g}{colorama.Style.RESET_ALL}"
|
||||
# # 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)
|
||||
|
||||
|
||||
@spec_convenience
|
||||
# @get_from_archive
|
||||
@value_property
|
||||
@tweak_option
|
||||
class SmarActOpenLoopRecordMCS2(Assembly):
|
||||
def __init__(self, pvname=None, channel=None, name=None):
|
||||
super().__init__(name=name)
|
||||
self.pvname = pvname
|
||||
self.channel = channel
|
||||
|
||||
self._append(
|
||||
AdjustablePv,
|
||||
self.pvname.split(":")[0] + f":MOT_{self.channel}.DESC",
|
||||
name="description",
|
||||
is_setting=False,
|
||||
is_display=False,
|
||||
)
|
||||
self._append(
|
||||
AdjustablePv,
|
||||
self.pvname + ".AOUT",
|
||||
name="_com_set",
|
||||
is_setting=False,
|
||||
is_display=False,
|
||||
)
|
||||
self._append(
|
||||
AdjustablePv,
|
||||
self.pvname + ".TINP",
|
||||
name="_com_get",
|
||||
is_setting=False,
|
||||
is_display=False,
|
||||
)
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_limit_high.json",
|
||||
default_value=-1e6,
|
||||
name="limit_high",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_limit_low.json",
|
||||
default_value=1e6,
|
||||
name="limit_low",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_voltage.json",
|
||||
name="voltage",
|
||||
default_value=25,
|
||||
is_setting=True,
|
||||
is_display=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_frequency.json",
|
||||
name="frequency",
|
||||
default_value=250,
|
||||
is_setting=True,
|
||||
is_display=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_position.json",
|
||||
name="_position",
|
||||
default_value=0,
|
||||
is_setting=True,
|
||||
is_display=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustableFS,
|
||||
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/smaract_openloop_{name}_direction.json",
|
||||
name="direction",
|
||||
default_value=1,
|
||||
is_setting=True,
|
||||
is_display=True,
|
||||
)
|
||||
|
||||
def get_motion_mode():
|
||||
return int(self.eval_command(f":CHAN{self.channel-1}:MMOD?"))
|
||||
|
||||
def set_motion_mode(value):
|
||||
self.eval_command(f":CHAN{self.channel-1}:MMOD {value}")
|
||||
|
||||
self._append(
|
||||
AdjustableGetSet,
|
||||
get_motion_mode,
|
||||
set_motion_mode,
|
||||
set_returns_changer=False,
|
||||
precision=0,
|
||||
check_interval=None,
|
||||
cache_get_seconds=None,
|
||||
unit=None,
|
||||
name="motion_mode",
|
||||
)
|
||||
|
||||
if not self.motion_mode() == 4:
|
||||
self.motion_mode.mv_elog(
|
||||
4,
|
||||
f"Setting SmarAct Channel {self.channel} on {self.pvname} to Open Loop (4). To go back to closed loop, set it to (0)",
|
||||
)
|
||||
|
||||
def eval_command(self, cmd):
|
||||
self._com_set(cmd)
|
||||
sleep(0.2)
|
||||
return self._com_get()
|
||||
|
||||
def stop(self):
|
||||
self._com_set(f":STOP{self.channel-1}")
|
||||
|
||||
def move(self, value, check=True, wait=True):
|
||||
value = int(value) * self.direction()
|
||||
pos = int(self._position() * self.direction())
|
||||
target_rel = value - pos
|
||||
if check:
|
||||
if self.limit_low:
|
||||
if value < self.limit_low():
|
||||
raise Exception(
|
||||
f"Target value of {self.name} is smaller than limit value!"
|
||||
)
|
||||
if self.limit_high:
|
||||
if self.limit_high() < value:
|
||||
raise Exception(
|
||||
f"Target value of {self.name} is higher than limit value!"
|
||||
)
|
||||
self.eval_command(f":MOVE{self.channel-1} {target_rel}")
|
||||
if wait:
|
||||
while not self.get_move_done():
|
||||
sleep(0.1)
|
||||
self._position.mv(value)
|
||||
|
||||
def get_limits(self):
|
||||
return (self.limit_low(), self.limit_high())
|
||||
|
||||
def get_move_done(self):
|
||||
stat = self.get_status()
|
||||
if int(stat[-1]) == 9:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def get_status(self):
|
||||
stat = self.eval_command(f":CHAN{self.channel-1}:STAT?")
|
||||
if len(stat) == 0:
|
||||
for n in range(10):
|
||||
stat = self.eval_command(f":CHAN{self.channel-1}:STAT?")
|
||||
if len(stat) > 0:
|
||||
break
|
||||
return stat
|
||||
|
||||
def set_limits(self, limit_low, limit_high):
|
||||
self.limit_low.set_target_value(limit_low)
|
||||
self.limit_high.set_target_value(limit_high)
|
||||
|
||||
def get_current_value(self):
|
||||
return self._position.get_current_value()
|
||||
|
||||
def set_current_value(self, value):
|
||||
self._position(value)
|
||||
|
||||
def set_target_value(self, value, hold=False, check=True, **kwargs):
|
||||
return Changer(
|
||||
|
||||
@@ -7,28 +7,26 @@ class OxygenSensor(AnalogInput):
|
||||
super().__init__(pvname, name=name)
|
||||
self.unit.set_target_value("%")
|
||||
|
||||
def set_no_oxygen(self, val_curr=None):
|
||||
if not val_curr:
|
||||
val_curr = self.raw.get_current_value()
|
||||
def set_no_oxygen(self, raw_val=None):
|
||||
if not raw_val:
|
||||
raw_val = self.raw.get_current_value()
|
||||
slo = self.linear_calibration_slope.get_current_value()
|
||||
off = self.linear_calibration_offset.get_current_value()
|
||||
|
||||
off_n = -slo * val_curr
|
||||
af = (100 - off) / slo
|
||||
# slo_new = slo*((100-val_curr)/(100-off))
|
||||
slo_n = 100 / af
|
||||
r0 = raw_val
|
||||
r100 = (100 - off) / slo
|
||||
slo_n = 100 / (r100 - r0)
|
||||
off_n = -slo_n * r0
|
||||
self.linear_calibration_offset(off_n)
|
||||
self.linear_calibration_slope(slo_n)
|
||||
|
||||
def set_full_oxygen(self, val_curr=None):
|
||||
if not val_curr:
|
||||
val_curr = self.raw.get_current_value()
|
||||
af = val_curr
|
||||
def set_full_oxygen(self, raw_val=None):
|
||||
if not raw_val:
|
||||
raw_val = self.raw.get_current_value()
|
||||
slo = self.linear_calibration_slope.get_current_value()
|
||||
off = self.linear_calibration_offset.get_current_value()
|
||||
|
||||
az = -off / slo
|
||||
slo_n = 100 / (af - az)
|
||||
off_n = -slo_n * az
|
||||
r0 = -(off / slo)
|
||||
r100 = raw_val
|
||||
slo_n = 100 / (r100 - r0)
|
||||
off_n = -slo_n * r0
|
||||
self.linear_calibration_offset(off_n)
|
||||
self.linear_calibration_slope(slo_n)
|
||||
|
||||
@@ -22,32 +22,43 @@ class Incoupling(Assembly):
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_15", name="thz_par2_rx", is_setting=True
|
||||
# )
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_11", name="thz_par1_z", is_setting=True
|
||||
# )
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_17", name="thz_par1_ry", is_setting=True
|
||||
# )
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_11", name="thz_par1_z", is_setting=True
|
||||
)
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_17", name="thz_par1_ry", is_setting=True
|
||||
SmaractRecord, "SARES20-MCS3:MOT_17", name="power_check", is_setting=True
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
self.motor_configuration_thorlabs = {
|
||||
"thz_filter": {
|
||||
"pvname": "SLAAR21-LMOT-ELL4",
|
||||
},
|
||||
"thz_crystal": {
|
||||
"pvname": "SLAAR21-LMOT-ELL3",
|
||||
},
|
||||
"thz_waveplate": {
|
||||
# "thz_filter": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL4",
|
||||
# },
|
||||
# "thz_crystal": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL3",
|
||||
# },
|
||||
# "thz_waveplate": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL5",
|
||||
# },
|
||||
# "nd_filter": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL2",
|
||||
# },
|
||||
# "polarizer": {
|
||||
# "pvname": "SLAAR21-LMOT-ELL1",
|
||||
# },
|
||||
|
||||
"waveplate": {
|
||||
"pvname": "SLAAR21-LMOT-ELL5",
|
||||
},
|
||||
"nd_filter": {
|
||||
"filter_wheel": {
|
||||
"pvname": "SLAAR21-LMOT-ELL2",
|
||||
},
|
||||
"polarizer": {
|
||||
"pvname": "SLAAR21-LMOT-ELL1",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
### thorlabs piezo motors ###
|
||||
for name, config in self.motor_configuration_thorlabs.items():
|
||||
self._append(
|
||||
@@ -60,24 +71,24 @@ class Incoupling(Assembly):
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
self._append(
|
||||
AdjustableInterpolate,
|
||||
self.nd_filter,
|
||||
filename_calib="/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/nd_filter_wheel_thlabs.json",
|
||||
deadband=None,
|
||||
interp_method="next",
|
||||
callbacks_before_change=[],
|
||||
callbacks_after_change=[],
|
||||
unit="OptDens",
|
||||
name="nd_filter_optical_density",
|
||||
)
|
||||
# self._append(
|
||||
# AdjustableInterpolate,
|
||||
# self.nd_filter,
|
||||
# filename_calib="/sf/bernina/code/gac-bernina/eco_cnf_bernina/reference_values/nd_filter_wheel_thlabs.json",
|
||||
# deadband=None,
|
||||
# interp_method="next",
|
||||
# callbacks_before_change=[],
|
||||
# callbacks_after_change=[],
|
||||
# unit="OptDens",
|
||||
# name="nd_filter_optical_density",
|
||||
# )
|
||||
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_18", name="opa_mirr2_ry", is_setting=True
|
||||
)
|
||||
self._append(
|
||||
SmaractRecord, "SARES20-MCS2:MOT_10", name="tt_nopa_target", is_setting=True
|
||||
)
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_18", name="opa_mirr2_ry", is_setting=True
|
||||
# )
|
||||
# self._append(
|
||||
# SmaractRecord, "SARES20-MCS2:MOT_10", name="tt_nopa_target", is_setting=True
|
||||
# )
|
||||
self._append(
|
||||
AnalogOutput,
|
||||
"SLAAR21-LDIO-LAS6991:DAC07_VOLTS",
|
||||
@@ -91,56 +102,56 @@ class Incoupling(Assembly):
|
||||
is_setting=True,
|
||||
)
|
||||
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_5", name="lens_z", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_6", name="lens_x", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_4", name="lens_y", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_1", name="lens_z", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_2", name="lens_x", is_setting=True)
|
||||
self._append(MotorRecord, "SARES20-XPS1:MOT_3", name="lens_y", is_setting=True)
|
||||
# self._append(
|
||||
# MotorRecord, "SARES20-MF1:MOT_13", name="eos_mirr", is_setting=True
|
||||
# )
|
||||
|
||||
self._append(
|
||||
AnalogOutput,
|
||||
"SLAAR21-LDIO-LAS6991:DAC06_VOLTS",
|
||||
name="eos_fb_rx",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
AnalogOutput,
|
||||
"SLAAR21-LDIO-LAS6991:DAC05_VOLTS",
|
||||
name="eos_fb_ry",
|
||||
is_setting=True,
|
||||
)
|
||||
# self._append(
|
||||
# AnalogOutput,
|
||||
# "SLAAR21-LDIO-LAS6991:DAC06_VOLTS",
|
||||
# name="eos_fb_rx",
|
||||
# is_setting=True,
|
||||
# )
|
||||
# self._append(
|
||||
# AnalogOutput,
|
||||
# "SLAAR21-LDIO-LAS6991:DAC05_VOLTS",
|
||||
# name="eos_fb_ry",
|
||||
# is_setting=True,
|
||||
# )
|
||||
|
||||
self._append(
|
||||
AdjustablePv,
|
||||
pvsetname="SLAAR21-LCAM-C561:FIT2_REQUIRED.PROC",
|
||||
name="eos_fb_setpoint_rq",
|
||||
name="fb_setpoint_rq",
|
||||
accuracy=1,
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustablePv,
|
||||
pvsetname="SLAAR21-LCAM-C561:FIT2_DEFAULT.PROC",
|
||||
name="eos_fb_setpoint_df",
|
||||
name="fb_setpoint_df",
|
||||
accuracy=1,
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
AdjustablePv,
|
||||
pvsetname="SLAAR21-LTIM01-EVR0:CALCW.A",
|
||||
name="eos_fd_enable",
|
||||
name="fd_enable",
|
||||
accuracy=1,
|
||||
is_setting=True,
|
||||
)
|
||||
|
||||
self._append(
|
||||
AdjustableVirtual,
|
||||
[self.thz_crystal, self.thz_waveplate],
|
||||
lambda c, w: c,
|
||||
lambda angle: [angle, angle / 2],
|
||||
name="thz_polarization",
|
||||
is_setting=False,
|
||||
)
|
||||
# self._append(
|
||||
# AdjustableVirtual,
|
||||
# [self.thz_crystal, self.thz_waveplate],
|
||||
# lambda c, w: c,
|
||||
# lambda angle: [angle, angle / 2],
|
||||
# name="thz_polarization",
|
||||
# is_setting=False,
|
||||
# )
|
||||
|
||||
self._append(
|
||||
DetectorPvData,
|
||||
@@ -154,11 +165,11 @@ class Incoupling(Assembly):
|
||||
name="pump_intensity",
|
||||
)
|
||||
|
||||
self._append(
|
||||
DetectorPvData,
|
||||
"SARES20-LSCP9-FNS:CH6:VAL_GET",
|
||||
name="shg_intensity",
|
||||
)
|
||||
# self._append(
|
||||
# DetectorPvData,
|
||||
# "SARES20-LSCP9-FNS:CH6:VAL_GET",
|
||||
# name="shg_intensity",
|
||||
# )
|
||||
# IOXAS (SARES20_CH6)
|
||||
|
||||
# self._append(
|
||||
|
||||
@@ -303,13 +303,12 @@ class DetectorStages(Assembly):
|
||||
f"Initialization of epics motor {name}: {pvname}:{pvmot} failed, replaced by dummy!"
|
||||
)
|
||||
|
||||
|
||||
class RIXS(Assembly):
|
||||
def __init__(
|
||||
self,
|
||||
name=None,
|
||||
pvname="SARES22-RIXS",
|
||||
jf_id="JF05T01V01",
|
||||
jf_id="JF14T01V01",
|
||||
config_jf_adj=None,
|
||||
pgroup_adj=None,
|
||||
alias_namespace=None,
|
||||
@@ -379,13 +378,10 @@ class RIXS(Assembly):
|
||||
pvname=pvname,
|
||||
)
|
||||
|
||||
# self.append_analyzer(
|
||||
# pos=2,
|
||||
# analyzer="Si844",
|
||||
# hkl=(8, 4, 4),
|
||||
# name="ana2_laser",
|
||||
# pvname=pvname,
|
||||
# )
|
||||
self.append_multi_analyzer_motion(
|
||||
analyzer_list=[self.ana_right, self.ana_center, self.ana_left],
|
||||
name="energy_all_analyzers"
|
||||
)
|
||||
|
||||
self._append(
|
||||
Jungfrau,
|
||||
@@ -426,20 +422,45 @@ class RIXS(Assembly):
|
||||
is_display="recursive",
|
||||
)
|
||||
|
||||
def append_multi_analyzer_motion(self, analyzer_list = [], name=None):
|
||||
|
||||
detector_motors = [self.det.t_hor, self.det.t_ver, self.det.rot]
|
||||
analyzer_motors = [motor for ana in analyzer_list for motor in [ana.__dict__["om"], ana.__dict__["t_hor"]]]
|
||||
|
||||
def motor_pos_from_energy_multy_analyzers(energy):
|
||||
motor_positions = np.array([ana.motor_pos_from_energy(energy) for ana in analyzer_list])
|
||||
|
||||
detector_positions = motor_positions[:,2:]
|
||||
if np.sum(np.std(detector_positions, axis=0)) > 0.1:
|
||||
raise (f"Conflicting detector target positions in multi analyzer motion: {[[ana.name, det_pos] for ana, det_pos in zip(analyzer_list, detector_positions)]}, check analyzer configuration")
|
||||
else:
|
||||
detector_position = np.mean(detector_positions, axis=0)
|
||||
analyzer_positions = np.concat(motor_positions[:,0:2])
|
||||
return np.concat([detector_position, analyzer_positions])
|
||||
|
||||
def energy_from_motor_pos_multy_analyzers(*args, **kwargs):
|
||||
energies = np.array([[ana.energy()] for ana in analyzer_list])
|
||||
if None in energies:
|
||||
return None
|
||||
elif np.std(energies) > 0.1:
|
||||
return None
|
||||
else:
|
||||
return np.mean(energies)
|
||||
|
||||
self._append(
|
||||
AdjustableVirtual,
|
||||
detector_motors+analyzer_motors,
|
||||
energy_from_motor_pos_multy_analyzers,
|
||||
motor_pos_from_energy_multy_analyzers,
|
||||
is_setting=False,
|
||||
is_display=True,
|
||||
name=name,
|
||||
unit="eV",
|
||||
)
|
||||
|
||||
def gui(self, guiType="xdm"):
|
||||
"""Adjustable convention"""
|
||||
cmd = ["caqtdm", "-macro"]
|
||||
cmd += ["P=SARES22-RIXS", "ESB_RIXS_motors.ui"]
|
||||
return self._run_cmd(" ".join(cmd))
|
||||
|
||||
# def get_adjustable_positions_str(self):
|
||||
# ostr = "*****GPS motor positions******\n"
|
||||
|
||||
# for tkey, item in self.__dict__.items():
|
||||
# if hasattr(item, "get_current_value"):
|
||||
# pos = item.get_current_value()
|
||||
# ostr += " " + tkey.ljust(17) + " : % 14g\n" % pos
|
||||
# return ostr
|
||||
|
||||
# def __repr__(self):
|
||||
# return self.get_adjustable_positions_str()
|
||||
|
||||
@@ -13,7 +13,7 @@ from ..devices_general.motors import (
|
||||
MotorRecord,
|
||||
SmaractRecord,
|
||||
ThorlabsPiezoRecord,
|
||||
SmarActOpenLoopRecord,
|
||||
SmarActOpenLoopRecordMCS2,
|
||||
)
|
||||
from ..epics.adjustable import AdjustablePv
|
||||
import numpy as np
|
||||
@@ -1609,6 +1609,21 @@ def get_array_frame(a):
|
||||
return np.concatenate([a[:, 0], a[-1, 1:], a[-2::-1, -1], a[0, -2::-1]])
|
||||
|
||||
|
||||
class GicCameras(Assembly):
|
||||
def __init__(self, name=None, camera_config={}):
|
||||
super().__init__(name=name)
|
||||
for name, cfg in camera_config.items():
|
||||
self._append(
|
||||
CameraBasler,
|
||||
cfg["pvname"],
|
||||
camserver_alias="GIC_" + name,
|
||||
name=name,
|
||||
is_setting=True,
|
||||
is_display="recursive",
|
||||
)
|
||||
self.__dict__[name].serial_no.mv(cfg["serial_number"])
|
||||
|
||||
|
||||
class GrazingIncidenceLowTemperatureChamber(Assembly):
|
||||
def __init__(self, xp=None, helium_control_valve=None, name=None):
|
||||
super().__init__(name=name)
|
||||
@@ -1647,6 +1662,23 @@ class GrazingIncidenceLowTemperatureChamber(Assembly):
|
||||
"channel": 14,
|
||||
},
|
||||
}
|
||||
self.camera_configuration = {
|
||||
"inline": {
|
||||
"pvname": "SARES20-CAMS142-M1",
|
||||
"serial_number": 40298870,
|
||||
},
|
||||
"sideview": {
|
||||
"pvname": "SARES20-CAMS142-M2",
|
||||
"serial_number": 40298884,
|
||||
},
|
||||
}
|
||||
|
||||
self._append(
|
||||
GicCameras,
|
||||
name="samplecam",
|
||||
camera_config=self.camera_configuration,
|
||||
)
|
||||
|
||||
for name, config in self.motor_configuration.items():
|
||||
self._append(
|
||||
SmaractRecord,
|
||||
@@ -1657,7 +1689,7 @@ class GrazingIncidenceLowTemperatureChamber(Assembly):
|
||||
|
||||
for name, config in self.motor_configuration_openloop.items():
|
||||
self._append(
|
||||
SmarActOpenLoopRecord,
|
||||
SmarActOpenLoopRecordMCS2,
|
||||
pvname=config["id"],
|
||||
name=name,
|
||||
channel=config["channel"],
|
||||
|
||||
@@ -1350,6 +1350,30 @@ class LaserBernina(Assembly):
|
||||
name="delay_twin",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
SmaractRecord,
|
||||
"SLAAR21-LMTS-SMAR1:MOT_5",
|
||||
name="delaystage_ftir",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
SmaractRecord,
|
||||
"SLAAR21-LMTS-SMAR1:MOT_4",
|
||||
name="dfg_rot",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
SmaractRecord,
|
||||
"SLAAR21-LMTS-SMAR1:MOT_3",
|
||||
name="dfg_pos",
|
||||
is_setting=True,
|
||||
)
|
||||
self._append(
|
||||
DelayTime,
|
||||
self.delaystage_ftir,
|
||||
name="delay_ftir",
|
||||
is_setting=True,
|
||||
)
|
||||
|
||||
self._append(
|
||||
DelayTime,
|
||||
|
||||
@@ -292,9 +292,9 @@ class TimetoolBerninaUSD(Assembly):
|
||||
for pos in x:
|
||||
print(f"Moving to {pos*1e15} fs")
|
||||
self.delay.set_target_value(pos).wait()
|
||||
pids_start.append(pid.value)
|
||||
pids_start.append(int(pid.value))
|
||||
sleep(seconds)
|
||||
pids_stop.append(pid.value)
|
||||
pids_stop.append(int(pid.value))
|
||||
retrieving = True
|
||||
i = 1
|
||||
source = dh.Daqbuf()
|
||||
@@ -401,10 +401,10 @@ class TimetoolBerninaUSD(Assembly):
|
||||
fig.tight_layout()
|
||||
plt.show()
|
||||
if to_elog:
|
||||
fpath = "/photonics/home/gac-bernina/tt_calib.jpg"
|
||||
fpath = f"{Path.home()}/temp/tt_calib.jpg"
|
||||
fig.savefig(fpath, dpi=200)
|
||||
fpath = Path(fpath)
|
||||
dpath = Path("/photonics/home/gac-bernina/tt_calib.pkl")
|
||||
dpath = Path(f"{Path.home()}/temp/tt_calib.pkl")
|
||||
df = DataFrame({"tt_kb.delay": x, "tt_kb.edge_position_px": y})
|
||||
df.to_pickle(dpath)
|
||||
if to_elog:
|
||||
@@ -767,10 +767,10 @@ class TimetoolBerninaDSD(Assembly):
|
||||
fig.tight_layout()
|
||||
plt.show()
|
||||
if to_elog:
|
||||
fpath = "/photonics/home/gac-bernina/tt_calib.jpg"
|
||||
fpath = f"{Path.home()}/temp/tt_calib.jpg"
|
||||
fig.savefig(fpath, dpi=200)
|
||||
fpath = Path(fpath)
|
||||
dpath = Path("/photonics/home/gac-bernina/tt_calib.pkl")
|
||||
dpath = Path(f"{Path.home()}/temp/tt_calib.pkl")
|
||||
df = DataFrame({"tt_kb.delay": x, "tt_kb.edge_position_px": y})
|
||||
df.to_pickle(dpath)
|
||||
if to_elog:
|
||||
|
||||
Reference in New Issue
Block a user