path adjustments away fromhome folder of gac-bernina

This commit is contained in:
gac bernina
2026-05-22 11:56:47 +02:00
parent 11364bc067
commit bb857d6a74
18 changed files with 1024 additions and 403 deletions
+4 -4
View File
@@ -15,8 +15,8 @@ class CheckerCA(Assembly):
pvname=None,
thresholds=None,
required_fraction=None,
filepath_thresholds="/photonics/home/gac-bernina/eco/configuration/checker_thresholds",
filepath_fraction="/photonics/home/gac-bernina/eco/configuration/checker_required_fraction",
filepath_thresholds="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_thresholds.json",
filepath_fraction="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_required_fraction.json",
name=None,
):
super().__init__(name=name)
@@ -69,8 +69,8 @@ class CheckerBS(Assembly):
bs_channel=None,
thresholds=None,
required_fraction=None,
filepath_thresholds="/photonics/home/gac-bernina/eco/configuration/checker_thresholds",
filepath_fraction="/photonics/home/gac-bernina/eco/configuration/checker_required_fraction",
filepath_thresholds="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_thresholds.json",
filepath_fraction="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_required_fraction.json",
name=None,
):
super().__init__(name=name)
+305 -210
View File
@@ -35,7 +35,6 @@ import numpy as np
from IPython import get_ipython
from eco.acquisition import counters
path_aliases = PathAlias()
sys.path.append("/sf/bernina/config/src/python/bernina_analysis")
@@ -165,7 +164,7 @@ namespace.append_obj(
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/run_table_channels_CA",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/run_table_channels_CA.json",
name="_env_channels_ca",
module_name="eco.elements.adjustable",
lazy=True,
@@ -653,13 +652,6 @@ namespace.append_obj(
lazy=True,
)
# namespace.append_obj(
# "TimetoolSpatial",
# module_name="eco.timing.timing_diag",
# name="tt_spatial_dev",
# lazy=True,
# )
namespace.append_obj(
"HexapodSymmetrie",
name="usd_table",
@@ -864,7 +856,8 @@ namespace.append_obj(
## diffractometers
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/config_JFs",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/config_JFs.json",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/config_JFs.json",
module_name="eco.elements.adjustable",
lazy=True,
name="config_JFs",
@@ -963,55 +956,105 @@ namespace.append_obj(
### channelsfor daq ###
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_JF",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_JF.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_JF",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channTest of new scilog for Ovuka experimentels_BS",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_BS.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_BS",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_BSCAM",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_BSCAM.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_BSCAM",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_CA",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_CA.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_CA",
)
# namespace.append_obj(
# "MpodModule",
# "SARES21-PS7071",
# [1, 2, 3, 4],
# ["ch1", "ch2", "ch3", "ch4"],
# module_string="LV_OMPV_1",
# name="power_LV_patch1",
# lazy=True,
# module_name="eco.devices_general.powersockets",
# )
# namespace.append_obj(
# "MpodModule",
# "SARES21-PS7071",
# [5, 6, 7, 8],
# ["ch1", "ch2", "ch3", "ch4"],
# module_string="LV_OMPV_1",
# name="power_LV_patch2",
# lazy=True,
# module_name="eco.devices_general.powersockets",
# )
# new MPOD implementation
namespace.append_obj(
"MpodModule",
"SARES21-PS7071",
[1, 2, 3, 4],
"NEW_MpodModule",
"SARES20-MPD1",
[0, 1, 2, 3],
["ch1", "ch2", "ch3", "ch4"],
module_string="LV_OMPV_1",
module_string="1",
name="power_LV_patch1",
lazy=True,
module_name="eco.devices_general.powersockets",
)
namespace.append_obj(
"MpodModule",
"SARES21-PS7071",
[5, 6, 7, 8],
"NEW_MpodModule",
"SARES20-MPD1",
[4, 5, 6, 7],
["ch1", "ch2", "ch3", "ch4"],
module_string="LV_OMPV_1",
module_string="1",
name="power_LV_patch2",
lazy=True,
module_name="eco.devices_general.powersockets",
)
from eco.loptics.bernina_laser import Stage_LXT_Delay
# OLD type lxt
# namespace.append_obj(
# "StageLxtDelay",
# NamespaceComponent(namespace, "las.delay_nopa"),
# NamespaceComponent(namespace, "las.xlt"),
# lazy=True,
# name="lxt",
# direction=-1,
# module_name="eco.loptics.bernina_laser",
# )
# NEW type lxt
namespace.append_obj(
"LxtCompStageDelay",
NamespaceComponent(namespace, "tt_kb.delay"),
NamespaceComponent(namespace, "las.xlt"),
feedback_enabled_adj=NamespaceComponent(namespace, "tt_kb.feedback_enabled"),
lazy=True,
name="lxt",
module_name="eco.loptics.bernina_laser",
)
# namespace.append_obj(
# "NEW_MpodModule",
# "SARES20-MPD1",
@@ -1040,8 +1083,8 @@ namespace.append_obj(
pvname="SLAAR21-LTIM01-EVR0:CALCI",
thresholds=[0.2, 10],
required_fraction=0.6,
filepath_thresholds="/photonics/home/gac-bernina/eco/configuration/checker_thresholds_default",
filepath_fraction="/photonics/home/gac-bernina/eco/configuration/checker_required_fraction_default",
filepath_thresholds="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/default_checker_thresholds.json",
filepath_fraction="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/default_checker_thresholds_fraction.json",
lazy=True,
name="checker_mon_opt_ioxos",
)
@@ -1052,8 +1095,8 @@ namespace.append_obj(
bs_channel="SAROP21-PBPS133:INTENSITY",
thresholds=[0.2, 10],
required_fraction=0.6,
filepath_thresholds="/photonics/home/gac-bernina/eco/configuration/checker_thresholds_default",
filepath_fraction="/photonics/home/gac-bernina/eco/configuration/checker_required_fraction_default",
filepath_thresholds="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/default_checker_thresholds.json",
filepath_fraction="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/default_checker_thresholds_fraction.json",
lazy=True,
name="checker",
)
@@ -1162,12 +1205,42 @@ namespace.append_obj(
#####################################################################################################
## more temporary devices will be outcoupled to temorary module.
# namespace.append_obj(
# "RIXS",
# lazy=True,
# name="rixs",
# module_name="eco.endstations.bernina_rixs",
# )
namespace.append_obj(
"RIXS",
lazy=True,
name="rixs",
config_jf_adj=config_JFs,
pgroup_adj=config_bernina.pgroup,
module_name="eco.endstations.bernina_rixs",
)
namespace.append_obj(
"SaxsSpectrometer",
lazy=True,
name="xspec_gc",
config_jf_adj=config_JFs,
pgroup_adj=config_bernina.pgroup,
module_name="eco.bernina.bernina_exp",
)
namespace.append_obj(
"CameraBasler",
pvname="SARES20-CAMS142-M1",
lazy=True,
name="samplecam",
camserver_group=["Laser", "Bernina"],
module_name="eco.devices_general.cameras_swissfel",
)
namespace.append_obj(
"CameraBasler",
pvname="SARES20-CAMS142-C1",
lazy=True,
name="gccam",
camserver_group=["Laser", "Bernina"],
module_name="eco.devices_general.cameras_swissfel",
)
#### Beam pointing cameras for THz setups ####
@@ -1236,6 +1309,14 @@ namespace.append_obj(
module_name="eco.microscopes",
)
namespace.append_obj(
"CameraBasler",
"SARES20-CAMS142-M1",
lazy=True,
name="samplecam_RIXS",
module_name="eco.devices_general.cameras_swissfel",
)
namespace.append_obj(
"CameraBasler",
"SARES20-CAMS142-C2",
@@ -1248,7 +1329,7 @@ namespace.append_obj(
"CameraBasler",
"SARES20-CAMS142-C3",
lazy=True,
name="samplecam_top",
name="samplecam_inline",
module_name="eco.devices_general.cameras_swissfel",
)
@@ -1261,13 +1342,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",
@@ -1324,12 +1405,12 @@ namespace.append_obj(
# name="clic",
# module_name="eco.loptics.bernina_laser",
# )
namespace.append_obj(
"MidIR",
lazy=True,
name="midir",
module_name="eco.loptics.bernina_laser",
)
# namespace.append_obj(
# "MidIR",
# lazy=True,
# name="midir",
# module_name="eco.loptics.bernina_laser",
# )
namespace.append_obj(
"OPAHE_bernina",
@@ -1343,6 +1424,33 @@ from ..devices_general.motors import SmaractStreamdevice
from ..loptics.bernina_laser import DelayTime
class VonHamos(Assembly):
def __init__(self, config_jf_adj, pgroup_adj, name="vhamos"):
super().__init__(name=name)
self._append(
Jungfrau,
jf_id="JF04T01V01",
name="detector",
config_adj=config_jf_adj,
pgroup_adj=pgroup_adj,
)
self._append(
MotorRecord, "SARES20-XPS1:MOT_1", name="slit_hor", is_setting=True
)
self._append(
MotorRecord, "SARES20-XPS1:MOT_2", name="slit_ver", is_setting=True
)
namespace.append_obj(
VonHamos,
lazy=True,
name="vhamos",
config_jf_adj=config_JFs,
pgroup_adj=config_bernina.pgroup,
)
# namespace.append_obj(
# "Organic_crystal_breadboard",
# lazy=True,
@@ -1353,7 +1461,6 @@ from ..loptics.bernina_laser import DelayTime
from ..epics.adjustable import AdjustablePv, AdjustablePvEnum
# class Double_Pulse_Pump(Assembly):
# def __init__(self, name=None):
# super().__init__(name=name)
@@ -1692,28 +1799,28 @@ namespace.append_obj(
# self._pz = pz
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_mirr_x0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_mirr_x0.json",
# name="offset_mirr_x",
# default_value=0,
# is_setting=True,
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_mirr_z0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_mirr_z0.json",
# name="offset_mirr_z",
# default_value=0,
# is_setting=True,
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_par_x0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_par_x0.json",
# name="offset_par_x",
# default_value=0,
# is_setting=True,
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_par_z0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_par_z0.json",
# name="offset_par_z",
# default_value=0,
# is_setting=True,
@@ -1863,7 +1970,7 @@ namespace.append_obj(
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/combined_delta",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/combined_delta.json",
# name="combined_delta",
# default_value=0,
# is_setting=True,
@@ -1944,7 +2051,6 @@ from ..devices_general.motors import MotorRecord
from ..loptics.bernina_laser import DelayTime
from ..microscopes import MicroscopeMotorRecord
# class JohannAnalyzer(Assembly):
# def __init__(self, name=""):
# super().__init__(name=name)
@@ -2151,124 +2257,139 @@ namespace.append_obj(
############## experiment specific #############
namespace.append_obj(
MotorRecord,
"SARES20-MF1:MOT_12",
name="bsx",
)
# namespace.append_obj(
# MotorRecord,
# "SARES20-MF1:MOT_12",
# name="bsx",
# )
# namespace.append_obj(
# "LinearFresnelZonePlate",
# name="fzp",
# module_name="eco.bernina.bernina_exp",
# lazy=True,
# )
class ConvergentBeamDiffraction(Assembly):
def __init__(self, name=None):
super().__init__(name=name)
self._append(
SmaractRecord,
"SARES20-MCS3:MOT_1",
preferred_home_direction="forward",
name="sample_x",
is_setting=True,
)
self._append(
SmaractRecord,
"SARES20-MCS3:MOT_2",
preferred_home_direction="forward",
name="sample_y",
is_setting=True,
)
self._append(
SmaractRecord,
"SARES20-MCS3:MOT_3",
preferred_home_direction="reverse",
name="sample_z",
is_setting=True,
)
self._append(
DetectorGet, self._get_zmq_dataset, name="positions", is_display=False
)
# self._append(DetectorObject,self._positions, name='positions')
# namespace.append_obj(
# "TimetoolSpatial",
# module_name="eco.timing.timing_diag",
# name="tt_spatial_dev",
# lazy=True,
# )
self._append(
SmaractRecord, "SARES20-MCS3:MOT_4", name="ublock_x", is_setting=True
)
self._append(
MotorRecord, "SARES20-MF1:MOT_15", name="ublock_y", is_setting=True
)
self._append(
SmaractRecord, "SARES20-MCS3:MOT_5", name="ublock_z", is_setting=True
)
self._append(
SmaractRecord, "SARES20-MCS3:MOT_6", name="ublock_ry", is_setting=True
)
self._append(
SmaractRecord, "SARES20-MCS3:MOT_7", name="ublock_rz", is_setting=True
)
def _get_zmq_dataset(self):
# import zmq
# import json
# from pprint import pprint
# class ConvergentBeamDiffraction(Assembly):
# def __init__(self, name=None):
# super().__init__(name=name)
# self._append(
# SmaractRecord,
# "SARES20-MCS3:MOT_1",
# preferred_home_direction="forward",
# name="sample_x",
# is_setting=True,
# )
# self._append(
# SmaractRecord,
# "SARES20-MCS3:MOT_2",
# preferred_home_direction="forward",
# name="sample_y",
# is_setting=True,
# )
# self._append(
# SmaractRecord,
# "SARES20-MCS3:MOT_3",
# preferred_home_direction="reverse",
# name="sample_z",
# is_setting=True,
# )
# self._append(
# DetectorGet, self._get_zmq_dataset, name="positions", is_display=False
# )
# # self._append(DetectorObject,self._positions, name='positions')
ATTRS = [
"SlitU - left (float64, mm)",
"SlitU - right (float64, mm)",
"SlitU - up (float64, mm)",
"SlitU - down (float64, mm)",
"SlitD - left (int64, pm)",
"SlitD - right (int64, pm)",
"SlitD - up (int64, pm)",
"SlitD - down (int64, pm)",
"MLL - UP - X (float64, nm)",
"MLL - UP - Y (float64, nm)",
"MLL - UP - Z (float64, nm)",
"MLL - UP - Pitch (float64, ndeg)",
"MLL - UP - Roll (float64, ndeg)",
"MLL - UP - Yaw (float64, ndeg)",
"MLL - DOWN - X (float64, nm)",
"MLL - DOWN - Y (float64, nm)",
"MLL - DOWN - Z (float64, nm)",
"MLL - DOWN - Pitch (float64, ndeg)",
"MLL - DOWN - Roll (float64, ndeg)",
"MLL - DOWN - Yaw (float64, ndeg)",
"OSA - X (int64, pm)",
"OSA - Y (int64, pm)",
"OSA - Z (int64, pm)",
"SAM - X (float64, mm)",
"SAM - Y (float64, mm)",
"SAM - Z (float64, mm)",
"SAM - pitch (int64, ndeg)",
"SAM - yaw (int64, ndeg)",
"CONE - X (float64, mm)",
"CONE - Y (float64, mm)",
"CONE - Z (float64, mm)",
"MIC - X (float64, mm)",
"MIC - Y (int64, nm)",
"MIC - Z (float64, mm)",
"BSU - X (float64, mm)",
"BSU - Y (float64, mm)",
"BSU - Z (float64, mm)",
"BSD - X (float64, mm)",
"BSD - Y (float64, mm)",
"BSD - Z (float64, mm)",
]
# self._append(
# SmaractRecord, "SARES20-MCS3:MOT_4", name="ublock_x", is_setting=True
# )
# self._append(
# MotorRecord, "SARES20-MF1:MOT_15", name="ublock_y", is_setting=True
# )
# self._append(
# SmaractRecord, "SARES20-MCS3:MOT_5", name="ublock_z", is_setting=True
# )
# self._append(
# SmaractRecord, "SARES20-MCS3:MOT_6", name="ublock_ry", is_setting=True
# )
# self._append(
# SmaractRecord, "SARES20-MCS3:MOT_7", name="ublock_rz", is_setting=True
# )
HOST = (
"129.129.243.102" # Replace with the IP address of our server in BL network
)
# def _get_zmq_dataset(self):
# # import zmq
# # import json
# # from pprint import pprint
socket = zmq.Context.instance().socket(zmq.SUB)
socket.setsockopt(zmq.RCVTIMEO, 100)
socket.setsockopt(zmq.LINGER, 0)
socket.connect(f"tcp://{HOST}:50002")
socket.setsockopt_string(zmq.SUBSCRIBE, "")
while not socket.poll(timeout=100):
pass
# ATTRS = [
# "SlitU - left (float64, mm)",
# "SlitU - right (float64, mm)",
# "SlitU - up (float64, mm)",
# "SlitU - down (float64, mm)",
# "SlitD - left (int64, pm)",
# "SlitD - right (int64, pm)",
# "SlitD - up (int64, pm)",
# "SlitD - down (int64, pm)",
# "MLL - UP - X (float64, nm)",
# "MLL - UP - Y (float64, nm)",
# "MLL - UP - Z (float64, nm)",
# "MLL - UP - Pitch (float64, ndeg)",
# "MLL - UP - Roll (float64, ndeg)",
# "MLL - UP - Yaw (float64, ndeg)",
# "MLL - DOWN - X (float64, nm)",
# "MLL - DOWN - Y (float64, nm)",
# "MLL - DOWN - Z (float64, nm)",
# "MLL - DOWN - Pitch (float64, ndeg)",
# "MLL - DOWN - Roll (float64, ndeg)",
# "MLL - DOWN - Yaw (float64, ndeg)",
# "OSA - X (int64, pm)",
# "OSA - Y (int64, pm)",
# "OSA - Z (int64, pm)",
# "SAM - X (float64, mm)",
# "SAM - Y (float64, mm)",
# "SAM - Z (float64, mm)",
# "SAM - pitch (int64, ndeg)",
# "SAM - yaw (int64, ndeg)",
# "CONE - X (float64, mm)",
# "CONE - Y (float64, mm)",
# "CONE - Z (float64, mm)",
# "MIC - X (float64, mm)",
# "MIC - Y (int64, nm)",
# "MIC - Z (float64, mm)",
# "BSU - X (float64, mm)",
# "BSU - Y (float64, mm)",
# "BSU - Z (float64, mm)",
# "BSD - X (float64, mm)",
# "BSD - Y (float64, mm)",
# "BSD - Z (float64, mm)",
# ]
positions = socket.recv()
positions = json.loads(positions.decode()).split(";")
# HOST = (
# "129.129.243.102" # Replace with the IP address of our server in BL network
# )
data = {ATTRS[i]: positions[i] for i in range(len(ATTRS))}
# pprint(data)
return data
# socket = zmq.Context.instance().socket(zmq.SUB)
# socket.setsockopt(zmq.RCVTIMEO, 100)
# socket.setsockopt(zmq.LINGER, 0)
# socket.connect(f"tcp://{HOST}:50002")
# socket.setsockopt_string(zmq.SUBSCRIBE, "")
# while not socket.poll(timeout=100):
# pass
# positions = socket.recv()
# positions = json.loads(positions.decode()).split(";")
# data = {ATTRS[i]: positions[i] for i in range(len(ATTRS))}
# # pprint(data)
# return data
# namespace.append_obj(
@@ -2299,32 +2420,6 @@ class ConvergentBeamDiffraction(Assembly):
# <<<<< WHAT WAS THIS FOR? --> removed 1015-09-01
from eco.loptics.bernina_laser import Stage_LXT_Delay
# OLD type lxt
# namespace.append_obj(
# "StageLxtDelay",
# NamespaceComponent(namespace, "las.delay_nopa"),
# NamespaceComponent(namespace, "las.xlt"),
# lazy=True,
# name="lxt",
# direction=-1,
# module_name="eco.loptics.bernina_laser",
# )
# NEW type lxt
namespace.append_obj(
"LxtCompStageDelay",
NamespaceComponent(namespace, "tt_kb.delay"),
NamespaceComponent(namespace, "las.xlt"),
feedback_enabled_adj=NamespaceComponent(namespace, "tt_kb.feedback_enabled"),
lazy=True,
name="lxt",
module_name="eco.loptics.bernina_laser",
)
##combined delaystage with phase shifter motion##
@@ -2360,28 +2455,29 @@ except:
print("Did not succeed to append an eco folder in current prgoup")
class Xspect_EH55(Assembly):
def __init__(self, name="xspect_bernina"):
super().__init__(name=name)
self._append(
MotorRecord, "SARES20-MF1:MOT_15", name="x_crystal", is_setting=True
)
self._append(
MotorRecord, "SARES20-MF1:MOT_16", name="y_crystal", is_setting=True
)
self._append(
SmaractRecord, "SARES23-USR:MOT_17", name="theta_crystal", is_setting=True
)
self._append(
CameraBasler,
"SARES20-CAMS142-M3",
name="camera_bsss",
is_display=False,
is_setting=False,
)
# class Xspect_EH55(Assembly):
# def __init__(self, name="xspect_bernina"):
# super().__init__(name=name)
# self._append(
# MotorRecord, "SARES20-MF1:MOT_15", name="x_crystal", is_setting=True
# )
# self._append(
# MotorRecord, "SARES20-MF1:MOT_16", name="y_crystal", is_setting=True
# )
# self._append(
# SmaractRecord, "SARES23-USR:MOT_17", name="theta_crystal", is_setting=True
# )
# self._append(
# CameraBasler,
# "SARES20-CAMS142-M3",
# name="camera_bsss",
# is_display=False,
# is_setting=False,
# )
namespace.append_obj(Xspect_EH55, name="xspect_bernina", lazy=True)
# namespace.append_obj(Xspect_EH55, name="xspect_bernina", lazy=True)
############## BIG JJ SLIT #####################
namespace.append_obj(
@@ -2461,7 +2557,6 @@ namespace.append_obj(SampleHeaterJet, name="heater_jet", lazy=True)
## sample illumination
from eco.devices_general.powersockets import MpodChannel
# namespace.append_obj(IlluminatorsLasers, name="sample_illumination", lazy=True)
## LIQUID jet setup
@@ -2619,7 +2714,7 @@ class Tapedrive(Assembly):
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p20231_mono_und_offset",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configurationmono_und_offset.json",
name="mono_und_calib",
default_value=[[6500, 0], [7100, 0]],
is_setting=True,
+17 -22
View File
@@ -32,7 +32,6 @@ import sys, os, shutil
import numpy as np
from IPython import get_ipython
path_aliases = PathAlias()
sys.path.append("/sf/bernina/config/src/python/bernina_analysis")
@@ -201,7 +200,7 @@ namespace.append_obj(
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/run_table_channels_CA",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/run_table_channels_CA.json",
name="_env_channels_ca",
module_name="eco.elements.adjustable",
lazy=True,
@@ -977,7 +976,7 @@ namespace.append_obj(
## diffractometers
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/config_JFs",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/config_JFs.json",
module_name="eco.elements.adjustable",
lazy=True,
name="config_JFs",
@@ -1067,35 +1066,35 @@ namespace.append_obj(
### channelsfor daq ###
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_JF",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_JF.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_JF",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channTest of new scilog for Ovuka experimentels_BS",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channTest of new scilog for Ovuka experimentels_BS.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_BS",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_BSCAM",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_BSCAM.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_BSCAM",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_CA",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_CA.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_CA",
)
namespace.append_obj(
"AdjustableFS",
"/photonics/home/gac-bernina/eco/configuration/channels_CA_epicsdaq",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/channels_CA_epicsdaq.json",
module_name="eco.elements.adjustable",
lazy=True,
name="channels_CA_epicsdaq",
@@ -1208,8 +1207,8 @@ namespace.append_obj(
pvname="SLAAR21-LTIM01-EVR0:CALCI",
thresholds=[0.2, 10],
required_fraction=0.6,
filepath_thresholds="/photonics/home/gac-bernina/eco/configuration/checker_thresholds_default",
filepath_fraction="/photonics/home/gac-bernina/eco/configuration/checker_required_fraction_default",
filepath_thresholds="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_thresholds_default.json",
filepath_fraction="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_required_fraction_default.json",
lazy=True,
name="checker_mon_opt_ioxos",
)
@@ -1220,8 +1219,8 @@ namespace.append_obj(
bs_channel="SAROP21-PBPS133:INTENSITY",
thresholds=[0.2, 10],
required_fraction=0.6,
filepath_thresholds="/photonics/home/gac-bernina/eco/configuration/checker_thresholds_default",
filepath_fraction="/photonics/home/gac-bernina/eco/configuration/checker_required_fraction_default",
filepath_thresholds="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_thresholds_default.json",
filepath_fraction="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/checker_required_fraction_default.json",
lazy=True,
name="checker",
)
@@ -2078,7 +2077,6 @@ from ..elements.assembly import Assembly
from ..devices_general.motors import SmaractStreamdevice
from ..loptics.bernina_laser import DelayTime
# namespace.append_obj(
# "Organic_crystal_breadboard",
# lazy=True,
@@ -2089,7 +2087,6 @@ from ..loptics.bernina_laser import DelayTime
from ..epics.adjustable import AdjustablePv, AdjustablePvEnum
# class Double_Pulse_Pump(Assembly):
# def __init__(self, name=None):
# super().__init__(name=name)
@@ -2367,28 +2364,28 @@ namespace.append_obj(
# self._pz = pz
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_mirr_x0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_mirr_x0.json",
# name="offset_mirr_x",
# default_value=0,
# is_setting=True,
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_mirr_z0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_mirr_z0.json",
# name="offset_mirr_z",
# default_value=0,
# is_setting=True,
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_par_x0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_par_x0.json",
# name="offset_par_x",
# default_value=0,
# is_setting=True,
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/p21145_par_z0",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_par_z0.json",
# name="offset_par_z",
# default_value=0,
# is_setting=True,
@@ -2538,7 +2535,7 @@ namespace.append_obj(
# )
# self._append(
# AdjustableFS,
# "/photonics/home/gac-bernina/eco/configuration/combined_delta",
# "/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/combined_delta.json",
# name="combined_delta",
# default_value=0,
# is_setting=True,
@@ -2619,7 +2616,6 @@ from ..devices_general.motors import MotorRecord
from ..loptics.bernina_laser import DelayTime
from ..microscopes import MicroscopeMotorRecord
# class JohannAnalyzer(Assembly):
# def __init__(self, name=""):
# super().__init__(name=name)
@@ -2949,7 +2945,6 @@ namespace.append_obj(
from eco.loptics.bernina_laser import Stage_LXT_Delay
# namespace.append_obj(
# "StageLxtDelay",
# ocb.delay_thz,
@@ -3277,7 +3272,7 @@ class Tapedrive(Assembly):
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p20231_mono_und_offset",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p20231_mono_und_offset.json",
name="mono_und_calib",
default_value=[[6500, 0], [7100, 0]],
is_setting=True,
+137 -1
View File
@@ -11,6 +11,7 @@ from eco.elements.adjustable import AdjustableFS, AdjustableVirtual
from eco.elements.detector import DetectorGet
from eco.devices_general.pipelines_swissfel import Pipeline
from eco.devices_general.pv_adjustable import PvRecord
from eco.devices_general.motors import ThorlabsPiezoRecord
class LiquidJetSpectroscopy(Assembly):
@@ -128,7 +129,7 @@ class LiquidJetSpectroscopy(Assembly):
)
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/apd_voltage_calibration",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/apd_voltage_calibration.json",
name="apd_voltage_calibration",
is_display=False,
is_setting=True,
@@ -175,3 +176,138 @@ class LiquidJetSpectroscopy(Assembly):
pvsetname="SARES20-FEEDBACK-SAMPLE:ENABLE",
name="feedback_enabled",
)
class SaxsSpectrometer(Assembly):
def __init__(
self,
pv_xgc="SARES20-MF1:MOT_4",
pv_rana="SARES20-MF1:MOT_3",
jf_id="JF03T01V02",
config_jf_adj=None,
pgroup_adj=None,
name="xspec_gc",
):
super().__init__(name=name),
self._append(
MotorRecord,
pv_xgc,
name="x_gc",
)
self._append(
MotorRecord,
pv_rana,
name="r_ana",
)
self._append(
Jungfrau,
jf_id,
pgroup_adj=pgroup_adj,
config_adj=config_jf_adj,
name="detector",
)
class LinearFresnelZonePlate(Assembly):
def __init__(
self,
name=None,
):
super().__init__(name=name)
self._append(
MpodChannel,
pvbase="SARES21-PS7071",
channel_number=4,
name="light",
)
self.motor_configuration_thorlabs = {
"hwp_mon": {
"pvname": "SLAAR21-LMOT-ELL1",
},
"hwp_pump": {
"pvname": "SLAAR21-LMOT-ELL5",
},
}
### thorlabs piezo motors ###
for name, config in self.motor_configuration_thorlabs.items():
self._append(
ThorlabsPiezoRecord,
pvname=config["pvname"],
name=name,
is_setting=True,
)
# self._append(
# CameraBasler,
# # pvname_camera="SARES20-CAMS142-M3", #THC
# "SARES20-CAMS142-C2", # GIC
# name="cam_inline",
# )
# self._append(
# MicroscopeMotorRecord,
# pvname_camera="SARES20-CAMS142-C1", # GIC
# pvname_zoom="SARES20-MF1:MOT_14",
# name="cam_top",
# )
self._append(
MotorRecord,
"SARES20-MCS1:MOT_8",
name="rot",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-MCS1:MOT_3",
name="tilt",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-MCS3:MOT_6",
name="x",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-XPS1:MOT_2",
name="y",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-MCS3:MOT_4",
name="z",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-XPS1:MOT_1",
name="foc",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-XPS1:MOT_3",
name="beam_stop_y",
is_setting=True,
is_display=True,
)
self._append(
MotorRecord,
"SARES20-MCS1:MOT_1",
name="i0_pos",
is_setting=True,
is_display=True,
)
+7 -3
View File
@@ -2,7 +2,11 @@ from ..elements.assembly import Assembly
from ..aliases import Alias
from eco import ecocnf
from epics.pv import PV
from bsread.bsavail import pollStream
# try:
# from bsread.bsavail import pollStream
# except:
# from bsread.unused.bsavail import pollStream
from bsread import dispatcher, source
from ..epics import get_from_archive
from escape import stream
@@ -45,8 +49,8 @@ class DetectorBsStream:
"setup of stream for bs channel not implemented yet"
)
def get_stream_state(self, timeout=1):
return pollStream(self.bs_channel, timeout=1)
# def get_stream_state(self, timeout=1):
# return pollStream(self.bs_channel, timeout=1)
def create_stream_callback(self, foo):
with source(channels=[self.bs_channel]) as s:
+14 -4
View File
@@ -1,7 +1,7 @@
import requests
import time
from ..elements.assembly import Assembly
from ..elements.adjustable import AdjustableGetSet
from ..elements.adjustable import AdjustableGetSet, Tweak
from numpy import polyval
import numpy as np
import urllib.request
@@ -36,17 +36,23 @@ AUTOIRIS = IntEnum("autoiris", {"on": 1, "off": 0})
class AxisPTZ(Assembly):
def __init__(self, camera_address, name="dummycam",timeout=0.1):
def __init__(
self,
camera_address,
name="dummycam",
timeout=0.1,
tweak_steps=[-3, -3],
):
super().__init__(name=name)
self.camera_address = camera_address
self.camera_n = 1
self.camera_ir = 0
self.timeout = timeout
try:
self.get_position()
except:
raise Exception(f'Could not connect to camera {self.name}!!')
raise Exception(f"Could not connect to camera {self.name}!!")
self._append(
AdjustableGetSet,
lambda: polyval([0.00290058, 0.99709942], self.get_position()["zoom"]),
@@ -100,7 +106,11 @@ class AxisPTZ(Assembly):
name="autoiris",
is_setting=True,
)
self._tweak_steps = tweak_steps
def tweak(self):
t = Tweak([self.pan, self._tweak_steps[0]], [self.tilt, self._tweak_steps[1]])
t.xy_adjustable_tweak()
# camera_n = 1
# camera_url = 'http://<<camera address>>/axis-cgi/com/ptz.cgi'
+13 -6
View File
@@ -28,7 +28,7 @@ def get_camclient():
global CAM_CLIENT
if not CAM_CLIENT:
CAM_CLIENT = CamClient()
CAM_CLIENT.timeout = 5
CAM_CLIENT.timeout = 8
return CAM_CLIENT
@@ -36,7 +36,7 @@ def get_pipelineclient():
global PIPELINE_CLIENT
if not PIPELINE_CLIENT:
PIPELINE_CLIENT = PipelineClient()
PIPELINE_CLIENT.timeout = 5
PIPELINE_CLIENT.timeout = 8
return PIPELINE_CLIENT
@@ -326,7 +326,7 @@ class CameraBasler(Assembly):
camserver_alias=camserver_alias,
camserver_group=camserver_group,
name="config_cs",
is_display="recursive",
is_display=True,
is_setting=True,
)
@@ -344,14 +344,14 @@ class CameraBasler(Assembly):
DetectorPvEnum,
self.pvname + ":BUSY_INIT",
name="is_initializing",
is_setting=True,
is_display=True,
is_setting=False,
is_display=False,
)
self._append(
AdjustablePvEnum,
self.pvname + ":CAMERASTATUS",
name="cam_status",
is_setting=True,
is_setting=False,
is_display=True,
)
self._append(
@@ -538,6 +538,13 @@ class CameraBasler(Assembly):
self._set_parameters(1)
self.cam_status(2)
def re_initialize(self, wait_before_init=1, wait_for_init=3):
self.cam_status(0)
time.sleep(wait_before_init)
self.cam_status(1)
time.sleep(wait_for_init)
self.cam_status(2)
def get_camera_images(self, n):
imgs = []
while len(np.unique(imgs, axis=0)) < n:
+81 -19
View File
@@ -1,5 +1,6 @@
# from ..eco_epics.motor import Motor as _Motor
from functools import partial
import warnings
from epics.motor import Motor as _Motor
from epics import PV
@@ -116,9 +117,7 @@ def _tweak_ioc_notebook(self, step_value=None):
current_label = widgets.HTML(
value=f"<b>Current position:</b> {_format_value(target_value)}"
)
status_label = widgets.HTML(
value=f"<b>Step size:</b> {_format_value(step_value)}"
)
status_label = widgets.HTML(value=f"<b>Step size:</b> {_format_value(step_value)}")
help_label = widgets.HTML(
value=(
"<b>Controls:</b> Stepsize *2, Stepsize /2, Down, Up, Go abs, Reset offset, Exit"
@@ -177,9 +176,7 @@ def _tweak_ioc_notebook(self, step_value=None):
try:
self.set_target_value(float(go_input.value), check=True).wait()
_refresh_current()
status_label.value = (
f"<b>Moved to:</b> {_format_value(go_input.value)}"
)
status_label.value = f"<b>Moved to:</b> {_format_value(go_input.value)}"
except Exception as exc:
status_label.value = f"<b>Error:</b> {exc}"
@@ -195,7 +192,18 @@ def _tweak_ioc_notebook(self, step_value=None):
def _shutdown(_=None):
self.clear_value_callback(index=callback_id)
for ctl in [step_input, go_input, set_input, btn_up, btn_down, btn_left, btn_right, btn_go, btn_set, btn_exit]:
for ctl in [
step_input,
go_input,
set_input,
btn_up,
btn_down,
btn_left,
btn_right,
btn_go,
btn_set,
btn_exit,
]:
ctl.disabled = True
status_label.value = "<b>Tweak UI closed.</b>"
@@ -215,7 +223,9 @@ def _tweak_ioc_notebook(self, step_value=None):
btn_set.on_click(_click_set)
btn_exit.on_click(_shutdown)
controls = widgets.HBox([btn_up, btn_down, btn_left, btn_right, btn_go, btn_set, btn_exit])
controls = widgets.HBox(
[btn_up, btn_down, btn_left, btn_right, btn_go, btn_set, btn_exit]
)
inputs = widgets.HBox([step_input, go_input, set_input])
ui = widgets.VBox([current_label, status_label, help_label, inputs, controls])
@@ -1353,8 +1363,9 @@ class MotorRecord(Assembly):
def changer(value):
statflag_start = self.status_flag.get_current_value()
if not statflag_start.value == 0:
raise AdjustableError(
f"Motor {self.alias.get_full_name()}({self.pvname}) cannot start moving with status flag {statflag_start.name} ."
warnings.warn(
f"Motor {self.alias.get_full_name()}({self.pvname}) might not or move uncontrolled with status flag {statflag_start.name} .",
Warning,
)
self._status = self._motor.move(value, ignore_limits=(not check), wait=True)
self._status_message = _status_messages[self._status]
@@ -1472,7 +1483,9 @@ class MotorRecord(Assembly):
def __call__(self, value):
self._currentChange = self.set_target_value(value)
def _tweak_ioc(self, step_value=None):
def _tweak_ioc(self, step_value=None, go_to_current_value_first=True):
if go_to_current_value_first:
self.set_target_value(self.get_current_value()).wait()
if _is_notebook():
try:
return _tweak_ioc_notebook(self, step_value=step_value)
@@ -1709,13 +1722,19 @@ class SmaractSettings(Assembly):
is_setting=True,
)
self._append(
AdjustableFS,
file_path="/photonics/home/gac-bernina/eco/configuration/smaract/setting_table",
name="_setting_table",
is_setting=False,
is_display=False,
)
try:
self._append(
AdjustableFS,
file_path="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/smaract_settings_collection.json",
name="_setting_table",
is_setting=False,
is_display=False,
)
except:
print(
"Failed to load smaract settings collection. Please check the file path and content of smaract_settings_collection.json."
)
self._setting_table = None
def recall(self, stage_alias_or_model=None):
setting_table = self._setting_table()
@@ -2069,7 +2088,9 @@ class SmaractRecord(Assembly):
def __call__(self, value):
self._currentChange = self.set_target_value(value)
def _tweak_ioc(self, step_value=None):
def _tweak_ioc(self, step_value=None, go_to_current_value_first=True):
if go_to_current_value_first:
self.set_target_value(self.get_current_value()).wait()
if _is_notebook():
try:
return _tweak_ioc_notebook(self, step_value=step_value)
@@ -2564,3 +2585,44 @@ class SmaractRecordFlags(Assembly):
def _get_flag_index_value(self, value, index):
return int("{0:015b}".format(int(value))[-1 * (index + 1)]) == 1
@spec_convenience
@value_property
@tweak_option
class DcmConfigAdj(Assembly):
def __init__(
self,
name=None,
dcm_config_dict=None,
energy=None,
crystal=None,
):
super().__init__(name=name)
self.dcm_config_dict = dcm_config_dict
self.crystal = crystal
self.energy = energy
def get_adjustable(self):
crystal_number = self.crystal().value
config_crystal = self.dcm_config_dict[crystal_number]
adj = config_crystal.__dict__[self.name]
return adj
def move(self, value):
adj = self.get_adjustable()
adj(value)
sleep(0.2)
energy = self.energy.get_current_value()
self.energy.set_target_value(energy)
def stop(self):
"""Adjustable convention"""
pass
def set_target_value(self, value):
return self.set_target_value(value)
def get_current_value(self):
adj = self.get_adjustable()
return adj.get_current_value()
+105 -35
View File
@@ -1,6 +1,8 @@
from ..epics.adjustable import AdjustablePvEnum, AdjustablePvString, AdjustablePv
from ..elements.assembly import Assembly
from ..epics.detector import DetectorPvEnum, DetectorPvData
from .detectors import DetectorVirtual
from functools import partial
from eco.elements.adjustable import spec_convenience
@@ -275,38 +277,54 @@ class MpodModule(Assembly):
)
class NEW_MpodStatus(Assembly):
def __init__(self, pvbase, channel_number, module_string, name=None):
# two module strings available 1 = low voltage and 3 = high voltage
# for new ioc by Thierry
flag_names_mpod = [
"outputOn",
"outputInhibit",
"outputFailureMinSenseVoltage",
"outputFailureMaxSenseVoltage",
"outputFailureMaxTerminalVoltage",
"outputFailureMaxCurrent",
"outputFailureMaxTemperature",
"outputFailureMaxPower",
"outputFailureTimeout",
"outputCurrentLimited",
"outputRampUp",
"outputRampDown",
"outputEnableKill",
"outputEmergencyOff",
"outputAdjusting",
"outputConstantVoltage",
"outputLowCurrentRange",
"outputCurrentBoundsExceeded",
"outputFailureCurrentLimit",
"outputCurrentIncreasing",
"outputCurrentDecreasing",
"outputConstantPower",
"outputVoltageRampSpeedLimited",
"outputVoltageBottomReached",
"outputInitCrcCheckBad",
]
class NEW_MpodFlags(Assembly):
def __init__(self, flags, name="flags"):
super().__init__(name=name)
self.pvbase = pvbase
self._module_string = module_string
self.channel_number = channel_number
self._append(
DetectorPvEnum,
self.pvbase + f":M{self._module_string}-VRAMP_RB",
name="RAMP_V_RB",
)
self._append(
DetectorPvEnum,
self.pvbase + f":M{self._module_string}-IRAMP_RB",
name="RAMP_I_RB",
)
self._append(
AdjustablePv,
self.pvbase + f":M{self._module_string}-VRAMP_SP",
name="RAMP_V_SP",
)
self._append(
AdjustablePv,
self.pvbase + f":M{self._module_string}-IRAMP_SP",
name="RAMP_I_SP",
)
self._append(
DetectorPvEnum,
self.pvbase + f":{self._module_string}0{self.channel_number}-ONOFF_RB",
name="power",
)
self._flags = flags
for flag_name in flag_names_mpod:
self._append(
DetectorVirtual,
[self._flags],
partial(self._get_flag_name_value, flag_name=flag_name),
name=flag_name,
is_status=False,
is_display=True,
)
def _get_flag_name_value(self, value, flag_name=None):
index = flag_names_mpod.index(flag_name)
return int("{0:015b}".format(int(value))[-1 * (index + 1)]) == 1
class NEW_MpodChannel(Assembly):
@@ -315,6 +333,7 @@ class NEW_MpodChannel(Assembly):
self.pvbase = pvbase
self._module_string = module_string
self.channel_number = channel_number
self._append(
AdjustablePvEnum,
self.pvbase + f":{self._module_string}0{self.channel_number}-SWITCH_SP",
@@ -344,12 +363,63 @@ class NEW_MpodChannel(Assembly):
is_setting=True,
is_display=True,
)
# self._append(
# AdjustablePv,
# self.pvbase + f":{self._module_string}0{self.channel_number}-VRISE_SP",
# pvreadbackname=self.pvbase
# + f":{self._module_string}0{self.channel_number}-VRISE_RB",
# pvlowlimname=self.pvbase,
# name="V_rise",
# is_setting=True,
# is_display=True,
# )
# self._append(
# AdjustablePv,
# self.pvbase + f":{self._module_string}0{self.channel_number}-IRISE_SP",
# pvreadbackname=self.pvbase
# + f":{self._module_string}0{self.channel_number}-IRISE_RB",
# pvlowlimname=self.pvbase,
# name="I_rise",
# is_setting=True,
# is_display=True,
# )
# self._append(
# AdjustablePv,
# self.pvbase + f":{self._module_string}0{self.channel_number}-VFALL_SP",
# pvreadbackname=self.pvbase
# + f":{self._module_string}0{self.channel_number}-VFALL_RB",
# pvlowlimname=self.pvbase,
# name="V_fall",
# is_setting=True,
# is_display=True,
# )
# self._append(
# AdjustablePv,
# self.pvbase + f":{self._module_string}0{self.channel_number}-IFALL_SP",
# pvreadbackname=self.pvbase
# + f":{self._module_string}0{self.channel_number}-IFALL_RB",
# pvlowlimname=self.pvbase,
# name="I_fall",
# is_setting=True,
# is_display=True,
# )
self._append(
NEW_MpodStatus,
self.pvbase,
self.channel_number,
self._module_string,
DetectorPvData,
self.pvbase + f":{self._module_string}0{self.channel_number}-STAT",
name="_flags",
is_setting=False,
)
self._append(
NEW_MpodFlags,
self._flags,
name="flags",
is_setting=False,
is_status=True,
)
def get_current_value(self, *args, **kwargs):
+3 -3
View File
@@ -91,9 +91,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_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-MF1:MOT_13", name="eos_mirr", is_setting=True
# )
+77 -7
View File
@@ -75,7 +75,7 @@ class Analyzer(Assembly):
# print(f"Initialization of epics motor {name}: {pvname}:{pvmot} failed, replaced by dummy!")
# append the detector
self._append(
Detector,
DetectorStages,
name="det",
pvname=pvname,
is_setting=False,
@@ -138,6 +138,33 @@ class Analyzer(Assembly):
t_hor = abs(x_s)
return om, t_hor, det_t_hor, det_t_ver, det_rot
def positions_for_energy(self, energy):
"""Print the motor positions corresponding to a given energy in eV"""
om, t_hor, det_t_hor, det_t_ver, det_rot = self.motor_pos_from_energy(energy)
def unit_for(name):
if name.startswith("det_"):
motor = getattr(getattr(self, "det", None), name[4:], None)
else:
motor = getattr(self, name, None)
return f" ({motor.unit})" if getattr(motor, "unit", None) else ""
fields = [
("om", om),
("t_hor", t_hor),
("det_t_hor", det_t_hor),
("det_t_ver", det_t_ver),
("det_rot", det_rot),
]
print(
f"Positions for energy {energy:.2f} eV:\n"
+ "\n".join(
f" {name:<10} = {value:8.2f}{unit_for(name)}"
for name, value in fields
)
)
def energy_from_motor_pos(self, om, t_hor, det_t_hor, det_t_ver, *args):
tth = self.tth_from_motor_pos(
t_hor=t_hor, det_t_hor=det_t_hor, det_t_ver=det_t_ver
@@ -240,7 +267,7 @@ class Analyzer(Assembly):
return np.rad2deg(np.arctan(t_ver / t_hor))
class Detector(Assembly):
class DetectorStages(Assembly):
def __init__(
self,
name=None,
@@ -282,10 +309,22 @@ class RIXS(Assembly):
self,
name=None,
pvname="SARES22-RIXS",
jf_id="JF05T01V01",
config_jf_adj=None,
pgroup_adj=None,
alias_namespace=None,
):
super().__init__(name=name)
self.pvname = pvname
self._append(
DetectorStages,
name="det",
pvname=pvname,
is_setting=True,
is_display="recursive",
)
self.config = {
"crystals": {
"Si533": {
@@ -300,6 +339,12 @@ class RIXS(Assembly):
),
"material": xu.materials.Si,
},
"Si931": {
"xu": xu.HXRD(
xu.materials.Si.Q(0, -1, 1), xu.materials.Si.Q(9, 3, 1)
),
"material": xu.materials.Si,
},
},
"rowland": {
"r": 1000,
@@ -311,10 +356,10 @@ class RIXS(Assembly):
# append an analyzer
self.append_analyzer(
pos=2,
analyzer="Si533",
pos=1,
analyzer="Si844",
hkl=(8, 4, 4),
name="ana2",
name="ana_right",
pvname=pvname,
)
@@ -322,10 +367,35 @@ class RIXS(Assembly):
pos=2,
analyzer="Si844",
hkl=(8, 4, 4),
name="ana2_laser",
name="ana_center",
pvname=pvname,
)
self.append_analyzer(
pos=3,
analyzer="Si844",
hkl=(8, 4, 4),
name="ana_left",
pvname=pvname,
)
# self.append_analyzer(
# pos=2,
# analyzer="Si844",
# hkl=(8, 4, 4),
# name="ana2_laser",
# pvname=pvname,
# )
self._append(
Jungfrau,
jf_id,
config_adj=config_jf_adj,
pgroup_adj=pgroup_adj,
name="detector",
is_setting=True,
)
def append_analyzer(
self,
pos=None,
@@ -352,7 +422,7 @@ class RIXS(Assembly):
name=name,
config=self.config,
pvname=pvname,
is_setting=False,
is_setting=True,
is_display="recursive",
)
+24 -22
View File
@@ -55,14 +55,14 @@ class THzVirtualStages(Assembly):
self._pz = pz
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p21145_mirr_z0",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_mirr_z0.json",
name="offset_mirr_z",
default_value=0,
is_setting=True,
)
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p21145_par_z0",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21145_par_z0.json",
name="offset_par_z",
default_value=0,
is_setting=True,
@@ -89,24 +89,26 @@ class THzVirtualStages(Assembly):
self.offset_mirr_z.mv(self._mz())
self.offset_par_z.mv(self._pz())
class THz_cameras(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 = "THC_" + name,
name=name,
is_setting=True,
cfg["pvname"],
camserver_alias="THC_" + name,
name=name,
is_setting=True,
is_display="recursive",
)
self.__dict__[name].serial_no.mv(cfg["serial_number"])
class High_field_thz_chamber(Assembly):
def __init__(
self,
delay_offset_detector = None,
delay_offset_detector=None,
thc_x_adjustable=None,
name=None,
configuration=[],
@@ -235,11 +237,11 @@ class High_field_thz_chamber(Assembly):
### Cameras ###
self._append(
THz_cameras,
THz_cameras,
name="camera",
camera_config=self.camera_configuration,
)
)
### lakeshore temperatures ####
self._append(
AdjustablePv,
@@ -1608,14 +1610,14 @@ def get_array_frame(a):
class GrazingIncidenceLowTemperatureChamber(Assembly):
def __init__(self, xp = None, helium_control_valve = None, name=None):
def __init__(self, xp=None, helium_control_valve=None, name=None):
super().__init__(name=name)
self.name = name
### SmarAct stages ###
self.motor_configuration = {
"beam_block": {
"id": "SARES23-USR:MOT_18",
"id": "SARES20-MCS3:MOT_18",
"pv_descr": "6:3 LSD Chamber Beam Block",
"direction": 0,
"sensor": 1,
@@ -1624,7 +1626,7 @@ class GrazingIncidenceLowTemperatureChamber(Assembly):
"kwargs": {"accuracy": 0.000001},
},
"interferrometer_paddle": {
"id": "SARES23-USR:MOT_16",
"id": "SARES20-MCS3:MOT_16",
"pv_descr": "6:1 LSD Interferrometer Paddle",
"direction": 0,
"sensor": 1,
@@ -1635,12 +1637,12 @@ class GrazingIncidenceLowTemperatureChamber(Assembly):
}
self.motor_configuration_openloop = {
"interferrometer_ver": {
"id": "SARES23-USR:asyn",
"id": "SARES20-MCS3:asyn",
"pv_descr": "5:1 LSD interferrometer hor",
"channel": 13,
},
"interferrometer_hor": {
"id": "SARES23-USR:asyn",
"id": "SARES20-MCS3:asyn",
"pv_descr": "5:2 LSD interferrometer ver",
"channel": 14,
},
@@ -1700,17 +1702,17 @@ class GrazingIncidenceLowTemperatureChamber(Assembly):
name="interferometer_value",
)
self._append(
MpodChannel,
pvbase="SARES21-PS7071",
channel_number=3,
name="illumination",
)
# self._append(
# MpodChannel,
# pvbase="SARES21-PS7071",
# channel_number=3,
# name="illumination",
# )
self._append(
AttenuatorSafetyBernina,
xp=xp,
name="attenuator_safety",
is_display='recursive',
is_display="recursive",
)
if helium_control_valve:
+14 -15
View File
@@ -93,28 +93,28 @@ class MIRVirtualStages(Assembly):
self._mz = mz
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p21954_lens_z0",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21954_lens_z0.json",
name="offset_lens_z",
default_value=0,
is_setting=True,
)
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p21954_lens_x0",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21954_lens_x0.json",
name="offset_lens_x",
default_value=0,
is_setting=True,
)
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p21954_par_z0",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21954_par_z0.json",
name="offset_par_z",
default_value=0,
is_setting=True,
)
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/p21954_mir_z0",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21954_mir_z0.json",
name="offset_mir_z",
default_value=0,
is_setting=True,
@@ -351,7 +351,7 @@ class MidIR(Assembly):
y_adj=self.y,
z_adj=self.z,
names_rotated_axes=["xlens", "ylens", "zlens"],
file_rotation="/photonics/home/gac-bernina/eco/configuration/p21954_lens_stage_rotation",
file_rotation="/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/p21954_lens_stage_rotation.json",
name="lens_beam_direction",
)
@@ -553,9 +553,8 @@ class MidIR(Assembly):
ax4.set_xlabel("pixel")
ax1_px.set_xlabel("time (ps)")
fpath = "/photonics/home/gac-bernina/cep_calib.jpg"
fig.savefig(fpath, dpi=200)
fpath = Path(fpath)
fpath = Path.home() / "cep_calib.jpg"
fig.savefig(str(fpath), dpi=200)
try:
msg = f"<h1>CEP calibration results:</h1>\n"
msg += f"Polynomial c0*x(px)^2 + c1*xs(px) + c2:\n {calibration} \n\n"
@@ -718,21 +717,21 @@ class StageLxtDelay(Assembly):
self._append(AdjustableMemory, direction, name="_direction", is_setting=True)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_delay_phase_shifter_threshold",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_delay_phase_shifter_threshold.json",
name="switch_threshold",
default_value=50e-12,
is_setting=True,
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/{name}_conbined_fine_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_conbined_fine_adj_offset.json",
name="offset_fine_adj",
default_value=0.0,
is_setting=True,
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_coarse_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_coarse_adj_offset.json",
name="offset_coarse_adj",
default_value=0.0,
is_setting=True,
@@ -858,17 +857,17 @@ class Stage_LXT_Delay(AdjustableVirtual):
self._coarse_delay_adj = coarse_delay_adj
self._direction = direction
self.switch_threshold = AdjustableFS(
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_delay_phase_shifter_threshold",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_delay_phase_shifter_threshold.json",
name="switch_threshold",
default_value=50e-12,
)
self.offset_fine_adj = AdjustableFS(
f"/photonics/home/gac-bernina/eco/configuration/{name}_conbined_fine_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_conbined_fine_adj_offset.json",
name="offset_fine_adj",
default_value=0.0,
)
self.offset_coarse_adj = AdjustableFS(
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_coarse_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_coarse_adj_offset.json",
name="offset_coarse_adj",
default_value=0.0,
)
@@ -1227,7 +1226,7 @@ class LaserBernina(Assembly):
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/wp_att_calibration",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/wp_att_calibration.json",
name="wp_att_calibration",
is_display=False,
is_setting=True,
+2 -2
View File
@@ -34,13 +34,13 @@ class Feedback_Timetool(Assembly):
self.control_adj = control_adj
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/tt_feedback_setpoint",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/tt_feedback_setpoint.json",
default_value=setpoint,
name="setpoint",
)
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/tt_feedback_calib_s_per_px",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/tt_feedback_calib_s_per_px.json",
default_value=calib_s_per_px,
name="calib_s_per_px",
)
+51 -24
View File
@@ -80,7 +80,7 @@ class Crystals(Assembly):
self.diffractometer = diffractometer_you
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_list",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_list.json",
name="_crystal_list",
default_value={},
is_setting=True,
@@ -106,7 +106,7 @@ class Crystals(Assembly):
}
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_constraints",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_constraints.json",
name="_constraints",
default_value=cons,
is_setting=True,
@@ -231,10 +231,10 @@ class Crystals(Assembly):
]
for a in attrs:
if os.path.exists(
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_{a}"
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_{a}.json"
):
os.remove(
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_{a}"
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_{a}.json"
)
print(f"Deleted crystal {name}.")
else:
@@ -342,7 +342,7 @@ class DiffGeometryYou(Assembly):
# self._append(diffractometer_you,call_obj=False, name='diffractometer')
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_unit_cell",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_unit_cell.json",
name="unit_cell",
default_value={
"name": "",
@@ -357,7 +357,7 @@ class DiffGeometryYou(Assembly):
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_u_matrix",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_u_matrix.json",
name="u_matrix",
default_value=[],
is_setting=True,
@@ -365,7 +365,7 @@ class DiffGeometryYou(Assembly):
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_ub_matrix",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_ub_matrix.json",
name="ub_matrix",
default_value=[],
is_setting=True,
@@ -373,14 +373,14 @@ class DiffGeometryYou(Assembly):
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_orientations",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_orientations.json",
name="orientations",
default_value=[],
is_setting=True,
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/{name}_reflections",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/{name}_reflections.json",
name="reflections",
default_value=[],
is_setting=True,
@@ -398,20 +398,36 @@ class DiffGeometryYou(Assembly):
### use robot motors if robot is in config
if cfg.robot():
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/crystals/move_robot",
name="move_robot",
default_value=True,
is_setting=False,
)
def rob_get(a): return a
AdjustableFS,
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/move_robot.json",
name="move_robot",
default_value=True,
is_setting=False,
)
def rob_get(a):
return a
def rob_set(a):
if self.move_robot():
if self.move_robot():
return [a]
else:
return None
gam_rob = AdjustableVirtual([self.diffractometer.gamma_robot],rob_get, rob_set, name="gamma_robot", check_limits=True)
del_rob = AdjustableVirtual([self.diffractometer.delta_robot],rob_get, rob_set, name="delta_robot", check_limits=True)
gam_rob = AdjustableVirtual(
[self.diffractometer.gamma_robot],
rob_get,
rob_set,
name="gamma_robot",
check_limits=True,
)
del_rob = AdjustableVirtual(
[self.diffractometer.delta_robot],
rob_get,
rob_set,
name="delta_robot",
check_limits=True,
)
get_lims = lambda a: a
gam_rob.get_limits = get_lims(self.diffractometer.gamma_robot.get_limits)
del_rob.get_limits = get_lims(self.diffractometer.delta_robot.get_limits)
@@ -423,9 +439,20 @@ class DiffGeometryYou(Assembly):
)
### add the phi constraint to thc as phi_wobble if thc is in config
if cfg.thc():
def phi_wobble_get(a): return a
def phi_wobble_set(a): return [a]
self.diffractometer.thc._append(AdjustableVirtual, [self.constraints.phi], phi_wobble_get, phi_wobble_set, name='phi_wobble')
def phi_wobble_get(a):
return a
def phi_wobble_set(a):
return [a]
self.diffractometer.thc._append(
AdjustableVirtual,
[self.constraints.phi],
phi_wobble_get,
phi_wobble_set,
name="phi_wobble",
)
if cfg.kappa():
adjs = ["gamma", "mu", "delta", "eta_kap", "kappa", "phi_kap"]
@@ -570,7 +597,7 @@ class DiffGeometryYou(Assembly):
beta = float(input(f"Angle beta ({alpha}): ") or alpha)
gamma = float(input(f"Angle gamma ({alpha}): ") or alpha)
im = Image.open(
"/photonics/home/gac-bernina/eco/configuration/crystals/you_diffractometer.png"
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/you_diffractometer.png"
)
normal = []
while not len(normal) == 3:
@@ -782,7 +809,7 @@ class DiffGeometryYou(Assembly):
def show_you_geometry(self):
im = Image.open(
"/photonics/home/gac-bernina/eco/configuration/crystals/you_diffractometer.png"
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/crystals/you_diffractometer.png"
)
im.show()
+7 -7
View File
@@ -166,21 +166,21 @@ class StageLxtDelay(Assembly):
self._append(AdjustableMemory, direction, name="_direction", is_setting=True)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_delay_phase_shifter_threshold",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_delay_phase_shifter_threshold.json",
name="switch_threshold",
default_value=50e-12,
is_setting=True,
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/{name}_conbined_fine_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_conbined_fine_adj_offset.json",
name="offset_fine_adj",
default_value=0.0,
is_setting=True,
)
self._append(
AdjustableFS,
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_coarse_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_coarse_adj_offset.json",
name="offset_coarse_adj",
default_value=0.0,
is_setting=True,
@@ -235,17 +235,17 @@ class Stage_LXT_Delay(AdjustableVirtual):
self._coarse_delay_adj = coarse_delay_adj
self._direction = direction
self.switch_threshold = AdjustableFS(
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_delay_phase_shifter_threshold",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_delay_phase_shifter_threshold.json",
name="switch_threshold",
default_value=50e-12,
)
self.offset_fine_adj = AdjustableFS(
f"/photonics/home/gac-bernina/eco/configuration/{name}_conbined_fine_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_conbined_fine_adj_offset.json",
name="offset_fine_adj",
default_value=0.0,
)
self.offset_coarse_adj = AdjustableFS(
f"/photonics/home/gac-bernina/eco/configuration/{name}_combined_coarse_adj_offset",
f"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/{name}_combined_coarse_adj_offset.json",
name="offset_coarse_adj",
default_value=0.0,
)
@@ -308,7 +308,7 @@ class LaserBernina(Assembly):
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/wp_att_calibration",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/wp_att_calibration.json",
name="wp_att_calibration",
is_display=False,
)
+161 -17
View File
@@ -1,7 +1,7 @@
from eco.bs.detector import DetectorPvString
from eco.epics import get_from_archive
from ..devices_general.motors import MotorRecord, MotorRecord
from eco.elements.adjustable import AdjustableFS, AdjustableVirtual
from ..devices_general.motors import MotorRecord # , DcmConfigAdj
from eco.elements.adjustable import AdjustableFS, AdjustableVirtual, value_property
from ..epics.adjustable import AdjustablePv, AdjustablePvEnum
from ..epics.detector import DetectorPvData
from epics import PV
@@ -20,6 +20,52 @@ from ..elements.assembly import Assembly
from eco.xoptics.dcm_pathlength_compensation import MonoTimecompensation
@spec_convenience
@value_property
@tweak_option
class DcmConfigAdj(Assembly):
def __init__(
self,
name=None,
dcm_config_dict=None,
energy=None,
crystal=None,
):
super().__init__(name=name)
self.dcm_config_dict = dcm_config_dict
self.crystal = crystal
self.energy = energy
def get_adjustable(self):
crystal_number = self.crystal().value
config_crystal = self.dcm_config_dict[crystal_number]
adj = config_crystal.__dict__[self.name]
return adj
def move(self, value):
adj = self.get_adjustable()
adj.set_target_value(value).wait()
sleep(0.2)
energy = self.energy.get_current_value()
self.energy.set_target_value(energy).wait()
def stop(self):
"""Adjustable convention"""
pass
def set_target_value(self, value, hold=False):
return Changer(
target=value,
parent=self,
changer=self.move,
hold=hold,
)
def get_current_value(self):
adj = self.get_adjustable()
return adj.get_current_value()
@get_from_archive
@spec_convenience
@update_changes
@@ -57,18 +103,21 @@ class DoubleCrystalMono(Assembly):
self.pvname + ":CRYSTAL",
pvname_set=self.pvname + ":CRYSTAL_SP",
name="crystal",
is_setting=True,
)
self._append(
AdjustablePvEnum,
self.pvname + ":DIFF_ORDER",
name="diffraction_order",
is_setting=True,
)
self._append(DcmConfig, self.pvname, name="mono_config")
self._append(
AdjustablePvEnum, pvname + ":BRAGG_ACCURACY_SP", name="theta_accuracy"
AdjustablePvEnum,
pvname + ":BRAGG_ACCURACY_SP",
name="theta_accuracy",
is_setting=True,
)
self._append(AdjustablePvEnum, pvname + ":HOLDING_BRAGG_SP", name="theta_hold")
@@ -143,7 +192,7 @@ class DoubleCrystalMono(Assembly):
self._append(
AdjustableFS,
"/photonics/home/gac-bernina/eco/configuration/mono_und_offset",
"/sf/bernina/code/gac-bernina/eco_cnf_bernina/configuration/mono_und_offset.json",
name="mono_und_calib",
default_value=[[6500, 0], [7100, 0]],
is_setting=True,
@@ -211,6 +260,16 @@ class DoubleCrystalMono(Assembly):
if feedback_message:
self._append(DetectorPvString, feedback_message, name="feedback_message")
self._append(
DcmConfig,
self.pvname,
name="mono_config",
energy=self.energy,
crystal=self.crystal,
is_setting="recursive",
is_display=True,
)
def add_mono_und_calibration_point(self):
mono_energy = self.energy.get_current_value()
fel_offset = (
@@ -250,21 +309,100 @@ class DoubleCrystalMono(Assembly):
class DcmConfig(Assembly):
def __init__(self, pvbase, name=None):
def __init__(self, pvbase, name=None, energy=None, crystal=None):
super().__init__(name=name)
self.pvbase = pvbase
self._append(DetectorPvData, self.pvbase + ":PITCH1_OFF", name="pitch1_offset")
self._append(DetectorPvData, self.pvbase + ":ROLL1_OFF", name="roll1_offset")
self._append(DetectorPvData, self.pvbase + ":PITCH2_OFF", name="pitch2_offset")
self._append(DetectorPvData, self.pvbase + ":ROLL2_OFF", name="roll2_offset")
self._append(DetectorPvData, self.pvbase + ":T2_OFF", name="gap_offset")
self._append(DetectorPvData, self.pvbase + ":TX_OFF", name="x_offset")
# self._append(DetectorPvData, self.pvbase + ":PITCH1_OFF", name="pitch1_offset")
# self._append(DetectorPvData, self.pvbase + ":ROLL1_OFF", name="roll1_offset")
# self._append(DetectorPvData, self.pvbase + ":PITCH2_OFF", name="pitch2_offset")
# self._append(DetectorPvData, self.pvbase + ":ROLL2_OFF", name="roll2_offset")
# self._append(DetectorPvData, self.pvbase + ":T2_OFF", name="gap_offset")
# self._append(DetectorPvData, self.pvbase + ":TX_OFF", name="x_offset")
self._append(DetectorPvData, self.pvbase + ":T2_MIN", name="gap_min")
self._append(DetectorPvData, self.pvbase + ":T2_MAX", name="gap_max")
self._append(DcmConfigSet, self.pvbase, "CRY1", name="config_Si111")
self._append(DcmConfigSet, self.pvbase, "CRY2", name="config_Si311")
self._append(DcmConfigSet, self.pvbase, "CRY3", name="config_InSb111")
self._append(
DcmConfigSet,
self.pvbase,
"CRY1",
name="config_Si111",
is_setting="recursive",
is_display=False,
)
self._append(
DcmConfigSet,
self.pvbase,
"CRY2",
name="config_Si311",
is_setting="recursive",
is_display=False,
)
self._append(
DcmConfigSet,
self.pvbase,
"CRY3",
name="config_InSb111",
is_setting="recursive",
is_display=False,
)
dcm_config_dict = {
1: self.config_Si111,
2: self.config_Si311,
3: self.config_InSb111,
}
self._append(
DcmConfigAdj,
name="pitch1_offset",
dcm_config_dict=dcm_config_dict,
energy=energy,
crystal=crystal,
is_setting=False,
is_display=True,
)
self._append(
DcmConfigAdj,
name="roll1_offset",
dcm_config_dict=dcm_config_dict,
energy=energy,
crystal=crystal,
is_setting=False,
is_display=True,
)
self._append(
DcmConfigAdj,
name="pitch2_offset",
dcm_config_dict=dcm_config_dict,
energy=energy,
crystal=crystal,
is_setting=False,
is_display=True,
)
self._append(
DcmConfigAdj,
name="roll2_offset",
dcm_config_dict=dcm_config_dict,
energy=energy,
crystal=crystal,
is_setting=False,
is_display=True,
)
self._append(
DcmConfigAdj,
name="gap_offset",
dcm_config_dict=dcm_config_dict,
energy=energy,
crystal=crystal,
is_setting=False,
is_display=True,
)
self._append(
DcmConfigAdj,
name="x_offset",
dcm_config_dict=dcm_config_dict,
energy=energy,
crystal=crystal,
is_setting=False,
is_display=True,
)
class DcmConfigSet(Assembly):
@@ -277,31 +415,37 @@ class DcmConfigSet(Assembly):
AdjustablePv,
self.pvbase + ":PITCH1_" + self.par_set_name + "_OFF",
name="pitch1_offset",
is_setting=True,
)
self._append(
AdjustablePv,
self.pvbase + ":ROLL1_" + self.par_set_name + "_OFF",
name="roll1_offset",
is_setting=True,
)
self._append(
AdjustablePv,
self.pvbase + ":PITCH2_" + self.par_set_name + "_OFF",
name="pitch2_offset",
is_setting=True,
)
self._append(
AdjustablePv,
self.pvbase + ":ROLL2_" + self.par_set_name + "_OFF",
name="roll2_offset",
is_setting=True,
)
self._append(
AdjustablePv,
self.pvbase + ":T2_" + self.par_set_name + "_OFF",
name="gap_offset",
is_setting=True,
)
self._append(
AdjustablePv,
self.pvbase + ":TX_" + self.par_set_name + "_OFF",
name="x_offset",
is_setting=True,
)
+2 -2
View File
@@ -12,8 +12,8 @@ class RefLaser_BerninaUSD(Assembly):
def __init__(
self,
pvname_mirrortranslation="SARES20-MCS1:MOT_12",
pvname_onoff="SARES21-PS7071:LV_OMPV_1_CH1_SWITCH_SP",
# pvname_onoff="SARES20-MPD1:100-SWITCH_SP",
# pvname_onoff="SARES21-PS7071:LV_OMPV_1_CH1_SWITCH_SP",
pvname_onoff="SARES20-MPD1:100-SWITCH_SP",
outpos_adjfs_path=None,
indiff=0.3,
elog=None,