hack for stall fue to not broken experimental file system

This commit is contained in:
2021-10-29 16:39:28 +02:00
parent f5663a700c
commit 0adfa32983
4 changed files with 315 additions and 244 deletions
+155 -144
View File
@@ -33,7 +33,7 @@ namespace.append_obj(
namespace.append_obj(
"BerninaEnv",
name='env_log',
name="env_log",
module_name="eco.fel.atmosphere",
lazy=True,
)
@@ -45,6 +45,7 @@ namespace.append_obj(
for tk in components:
namespace.append_obj_from_config(tk, lazy=True)
# Adding stuff the "new" way
# namespace.append_obj(
@@ -307,43 +308,43 @@ namespace.append_obj(
### draft new epics daq ###
namespace.append_obj(
"EpicsDaq",
default_file_path=f"/sf/bernina/data/{config_berninamesp['pgroup']}/res/epics_daq/",
channels_list=channels_CA_epicsdaq,
name="daq_epics_local",
module_name="eco.acquisition.epics_data",
lazy=True,
)
# namespace.append_obj(
# "EpicsDaq",
# default_file_path=f"/sf/bernina/data/{config_berninamesp['pgroup']}/res/epics_daq/",
# channels_list=channels_CA_epicsdaq,
# name="daq_epics_local",
# module_name="eco.acquisition.epics_data",
# lazy=True,
# )
### old epics daq ###
namespace.append_obj(
"ChannelList",
name="epics_channel_list",
file_name="/sf/bernina/config/channel_lists/default_channel_list_epics",
module_name="eco.utilities.config",
)
namespace.append_obj(
"Epicstools",
name="epics_daq",
channel_list=epics_channel_list,
default_file_path=f"/sf/bernina/data/{config_berninamesp['pgroup']}/res/epics_daq/",
module_name="eco.acquisition.epics_data",
)
namespace.append_obj(
"Scans",
name="scans_epics",
module_name="eco.acquisition.scan",
data_base_dir="scan_data",
scan_info_dir=f"/sf/bernina/data/{config_berninamesp['pgroup']}/res/scan_info",
default_counters=[epics_daq],
checker=checker_epics,
scan_directories=True,
run_table=run_table,
)
# namespace.append_obj(
# "ChannelList",
# name="epics_channel_list",
# file_name="/sf/bernina/config/channel_lists/default_channel_list_epics",
# module_name="eco.utilities.config",
# )
# namespace.append_obj(
# "Epicstools",
# name="epics_daq",
# channel_list=epics_channel_list,
# default_file_path=f"/sf/bernina/data/{config_berninamesp['pgroup']}/res/epics_daq/",
# module_name="eco.acquisition.epics_data",
# )
# namespace.append_obj(
# "Scans",
# name="scans_epics",
# module_name="eco.acquisition.scan",
# data_base_dir="scan_data",
# scan_info_dir=f"/sf/bernina/data/{config_berninamesp['pgroup']}/res/scan_info",
# default_counters=[epics_daq],
# checker=checker_epics,
# scan_directories=True,
# run_table=run_table,
# )
#
#
##### standard DAQ #######
namespace.append_obj(
"Daq",
@@ -375,14 +376,15 @@ namespace.append_obj(
lazy=True,
)
#####################################################################################################
## 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",
# module_name="eco.endstations.bernina_rixs",
# )
namespace.append_obj(
"AxisPTZ",
@@ -433,6 +435,7 @@ namespace.append_obj(
module_name="eco.devices_general.timing",
)
# will be split in permanent and temporary
# namespace.append_obj(
# "Laser_Exp",
@@ -479,53 +482,53 @@ from ..loptics.bernina_laser import DelayTime
from ..microscopes import MicroscopeMotorRecord
# ad hoc 2 pulse setup
class Laser2pulse(Assembly):
def __init__(self, name=None):
super().__init__(name=name)
self._append(
SmaractStreamdevice,
"SARES23-ESB1",
name="pump_exp_delaystage",
is_setting=True,
)
self._append(
DelayTime,
self.pump_exp_delaystage,
name="pump_delay_exp",
is_setting=False,
is_status=True,
reset_current_value_to=False,
)
self._append(SmaractStreamdevice, "SARES23-ESB5", name="wp", is_setting=True)
self._append(
SmaractStreamdevice,
"SARES23-ESB4",
name="pump_2_delaystage",
is_setting=True,
)
self._append(
DelayTime,
self.pump_2_delaystage,
name="pump_2_delay",
is_setting=False,
is_status=True,
reset_current_value_to=False,
)
self._append(SmaractStreamdevice, "SARES23-ESB6", name="ratio", is_setting=True)
self._append(
SmaractStreamdevice, "SARES23-ESB17", name="rx_pump", is_setting=True
)
self._append(
SmaractStreamdevice, "SARES23-ESB18", name="ry_pump", is_setting=True
)
namespace.append_obj(
Laser2pulse,
lazy=True,
name="laser2pulse",
)
# class Laser2pulse(Assembly):
# def __init__(self, name=None):
# super().__init__(name=name)
# self._append(
# SmaractStreamdevice,
# "SARES23-ESB1",
# name="pump_exp_delaystage",
# is_setting=True,
# )
#
# self._append(
# DelayTime,
# self.pump_exp_delaystage,
# name="pump_delay_exp",
# is_setting=False,
# is_status=True,
# reset_current_value_to=False,
# )
# self._append(SmaractStreamdevice, "SARES23-ESB5", name="wp", is_setting=True)
# self._append(
# SmaractStreamdevice,
# "SARES23-ESB4",
# name="pump_2_delaystage",
# is_setting=True,
# )
# self._append(
# DelayTime,
# self.pump_2_delaystage,
# name="pump_2_delay",
# is_setting=False,
# is_status=True,
# reset_current_value_to=False,
# )
# self._append(SmaractStreamdevice, "SARES23-ESB6", name="ratio", is_setting=True)
# self._append(
# SmaractStreamdevice, "SARES23-ESB17", name="rx_pump", is_setting=True
# )
# self._append(
# SmaractStreamdevice, "SARES23-ESB18", name="ry_pump", is_setting=True
# )
#
#
# namespace.append_obj(
# Laser2pulse,
# lazy=True,
# name="laser2pulse",
# )
# from eco.xoptics import dcm_pathlength_compensation as dpc
@@ -543,74 +546,82 @@ namespace.append_obj(
# ad hoc interferometric timetool
class TTinterferometrid(Assembly):
def __init__(self, name=None):
super().__init__(name=name)
self._append(MotorRecord, "SARES20-MF1:MOT_7", name="z_target", is_setting=True)
self._append(
MotorRecord, "SARES20-MF1:MOT_10", name="x_target", is_setting=True
)
self._append(
MotorRecord,
"SLAAR21-LMOT-M521:MOTOR_1",
name="delaystage",
is_setting=True
# MotorRecord,"SLAAR21-LMOT-M521",name = ""
# starting following commandline silently:
# caqtdm -macro "P=SLAAR21-LMOT-M521:,M=MOTOR_1" motorx_more.ui
)
self._append(
DelayTime,
self.delaystage,
name="delay",
is_setting=True,
is_status=True,
)
self._append(
SmaractStreamdevice,
"SARES23-ESB18",
name="rot_BC",
accuracy=3e-3,
is_setting=True,
)
# self._append(
# MotorRecord, "SARES20-MF1:MOT_15", name="zoom_microscope", is_setting=True
# )
self._append(
MicroscopeMotorRecord,
pvname_camera="SARES20-CAMS142-M1",
camserver_alias="tt_spatial",
pvname_zoom="SARES20-MF1:MOT_15",
is_setting=True,
is_status="recursive",
name="microscope",
)
namespace.append_obj(
TTinterferometrid,
lazy=True,
name="exp",
)
# class TTinterferometrid(Assembly):
# def __init__(self, name=None):
# super().__init__(name=name)
# self._append(MotorRecord, "SARES20-MF1:MOT_7", name="z_target", is_setting=True)
# self._append(
# MotorRecord, "SARES20-MF1:MOT_10", name="x_target", is_setting=True
# )
# self._append(
# MotorRecord,
# "SLAAR21-LMOT-M521:MOTOR_1",
# name="delaystage",
# is_setting=True
# # MotorRecord,"SLAAR21-LMOT-M521",name = ""
# # starting following commandline silently:
# # caqtdm -macro "P=SLAAR21-LMOT-M521:,M=MOTOR_1" motorx_more.ui
# )
# self._append(
# DelayTime,
# self.delaystage,
# name="delay",
# is_setting=True,
# is_status=True,
# )
# self._append(
# SmaractStreamdevice,
# "SARES23-ESB18",
# name="rot_BC",
# accuracy=3e-3,
# is_setting=True,
# )
# # self._append(
# # MotorRecord, "SARES20-MF1:MOT_15", name="zoom_microscope", is_setting=True
# # )
# self._append(
# MicroscopeMotorRecord,
# pvname_camera="SARES20-CAMS142-M1",
# camserver_alias="tt_spatial",
# pvname_zoom="SARES20-MF1:MOT_15",
# is_setting=True,
# is_status="recursive",
# name="microscope",
# )
#
#
# namespace.append_obj(
# TTinterferometrid,
# lazy=True,
# name="exp",
# )
############## experiment specific #############
# try to append pgroup folder to path
# try to append pgroup folder to path !!!!! This caused eco to run in a timeout without error traceback !!!!!
try:
import sys
from pathlib import Path
pgroup_eco_path = Path(f'/sf/bernina/data/{config_berninamesp["pgroup"]}/res/eco')
pgroup_eco_path.mkdir(mode=775, exist_ok=True)
sys.path.append(pgroup_eco_path.as_posix())
import sys
from ..utilities import TimeoutPath
if TimeoutPath(f'/sf/bernina/data/{config_berninamesp["pgroup"]}/res/').exists():
pgroup_eco_path = TimeoutPath(
f'/sf/bernina/data/{config_berninamesp["pgroup"]}/res/eco'
)
pgroup_eco_path.mkdir(mode=775, exist_ok=True)
sys.path.append(pgroup_eco_path.as_posix())
else:
print(
"Could not access experiment folder, could be due to more systematic file system failure!"
)
except:
print("Did not succed to append an eco folder in current prgoup")
#### pgroup specific appending, might be temporary at this location ####
namespace.append_obj("Xom", module_name="xom", name="xom", lazy=True)
# namespace.append_obj("Xom", module_name="xom", name="xom", lazy=True)
############## maybe to be recycled ###################
+2 -34
View File
@@ -349,38 +349,6 @@ components = [
"type": "eco.xdiagnostics.profile_monitors:Pprm",
},
# {
# "name": "kb_ver",
# "args": ["SAROP21-OKBV139"],
# "z_und": 139,
# "desc": "Vertically focusing Bernina KB mirror",
# "type": "eco.xoptics.KBver:KBver",
# "kwargs": {},
# },
# {
# "args": ["SAROP21-OKBH140"],
# "name": "kb_hor",
# "z_und": 140,
# "desc": "Horizontally focusing Bernina KB mirror",
# "type": "eco.xoptics.KBhor:KBhor",
# "kwargs": {},
# },
{
"name": "kb_ver",
"args": ["SAROP21-OKBV139"],
"z_und": 139,
"desc": "Vertically focusing Bernina KB mirror",
"type": "eco.xoptics.kb_mirrors:KbVer",
"kwargs": {},
},
{
"args": ["SAROP21-OKBH140"],
"name": "kb_hor",
"z_und": 140,
"desc": "Horizontally focusing Bernina KB mirror",
"type": "eco.xoptics.kb_mirrors:KbHor",
"kwargs": {},
},
# {
# "name": "spatial_tt",
# "args": [],
# "kwargs": {"reduction_client_address": "http://sf-daqsync-02:12003/"},
@@ -726,8 +694,8 @@ components = [
"args": [],
"name": "ocb",
"z_und": 142,
"desc": "LiNbO3 crystal breadboard",
"type": "eco.endstations.bernina_sample_environments:LiNbO3_crystal_breadboard",
"desc": "Organic Crystal Breadboard",
"type": "eco.endstations.bernina_sample_environments:Organic_crystal_breadboard",
"kwargs": {"Id": "SARES23"},
},
{
+130 -66
View File
@@ -84,13 +84,13 @@ class High_field_thz_chamber:
def set_stage_config(self):
for name, config in self.motor_configuration.items():
mot = self.__dict__[name]._device
mot.put("NAME", config["pv_descr"])
mot.put("STAGE_TYPE", config["type"])
mot.put("SET_SENSOR_TYPE", config["sensor"])
mot.put("CL_MAX_FREQ", config["speed"])
mot = self.__dict__[name]
mot.caqtdm_name(config["pv_descr"])
mot.stage_type(config["type"])
mot.sensor_type(config["sensor"])
mot.speed(config["speed"])
sleep(0.5)
mot.put("CALIBRATE.PROC", 1)
mot.calibrate_sensor(1)
def home_smaract_stages(self, stages=None):
if stages == None:
@@ -99,7 +99,7 @@ class High_field_thz_chamber:
print(self.__repr__())
for name in stages:
config = self.motor_configuration[name]
mot = self.__dict__[name]._device
mot = self.__dict__[name]
print(
"#### Homing {} in {} direction ####".format(
name, config["home_direction"]
@@ -107,25 +107,25 @@ class High_field_thz_chamber:
)
sleep(1)
if config["home_direction"] == "back":
mot.put("FRM_BACK.PROC", 1)
while mot.get("STATUS") == 7:
mot.home_backward(1)
while mot.status_channel().value == 7:
sleep(1)
if mot.get("GET_HOMED") == 0:
if mot.is_homed() == 0:
print(
"Homing failed, try homing {} in forward direction".format(name)
)
mot.put("FRM_FORW.PROC", 1)
mot.home_forward(1)
elif config["home_direction"] == "forward":
mot.put("FRM_FORW.PROC", 1)
while mot.get("STATUS") == 7:
mot.home_forward(1)
while mot.status_channel().value == 7:
sleep(1)
if mot.get("GET_HOMED") == 0:
if mot.is_homed() == 0:
print(
"Homing failed, try homing {} in backward direction".format(
name
)
)
mot.put("FRM_BACK.PROC", 1)
mot.home_backward(1)
def get_adjustable_positions_str(self):
ostr = "*****THz chamber motor positions******\n"
@@ -148,64 +148,96 @@ class Organic_crystal_breadboard:
self.motor_configuration = {
"mirr2_x": {
"id": "-ESB1",
"pv_descr": "Motor3:1 THz mirror x ",
"id": "-LIC17",
"pv_descr": "Motor8:2 THz mirror x ",
"type": 1,
"sensor": 0,
"sensor": 13,
"speed": 250,
"home_direction": "back",
},
"mirr2_rz": {
"id": "-ESB2",
"pv_descr": "Motor3:2 THz mirror rz ",
"type": 2,
"sensor": 1,
"id": "-LIC18",
"pv_descr": "Motor8:3 THz mirror rz ",
"type": 1,
"sensor": 13,
"speed": 250,
"home_direction": "back",
},
"mirr2_ry": {
"id": "-ESB3",
"pv_descr": "Motor3:3 THz mirror ry ",
"id": "-ESB1",
"pv_descr": "Motor3:1 THz mirror ry ",
"type": 2,
"sensor": 1,
"speed": 250,
"home_direction": "back",
"home_direction": "forward",
},
"mirr2_z": {
"id": "-ESB4",
"pv_descr": "Motor4:1 THz mirror z",
"id": "-LIC16",
"pv_descr": "Motor8:1 THz mirror z",
"type": 1,
"sensor": 0,
"sensor": 13,
"speed": 250,
"home_direction": "back",
},
"par2_x": {
"id": "-ESB5",
"pv_descr": "Motor4:2 THz parabola2 x",
"id": "-ESB3",
"pv_descr": "Motor3:3 THz parabola2 x",
"type": 1,
"sensor": 0,
"speed": 250,
"home_direction": "back",
},
"mirr1_x": {
"id": "-ESB7",
"pv_descr": "Motor5:1 near IR mirror x",
"thz_delay": {
"id": "-ESB18",
"pv_descr": "Motor8:3 NIR delay stage",
"type": 1,
"sensor": 0,
"speed": 250,
"speed": 100,
"home_direction": "back",
},
"mirr1_ry": {
"id": "-ESB8",
"pv_descr": "Motor5:2 near IR mirror ry",
"nir_mirr1_ry": {
"id": "-ESB17",
"pv_descr": "Motor8:2 near IR mirror 1 ry",
"type": 2,
"sensor": 1,
"speed": 250,
"home_direction": "back",
},
"mirr1_rx": {
"nir_mirr1_rx": {
"id": "-ESB16",
"pv_descr": "Motor8:1 near IR mirror 1 rx",
"type": 2,
"sensor": 1,
"speed": 250,
"home_direction": "back",
},
"nir_mirr2_ry": {
"id": "-ESB9",
"pv_descr": "Motor5:3 near IR mirror rx",
"pv_descr": "Motor5:3 near IR mirror 2 ry",
"type": 2,
"sensor": 1,
"speed": 250,
"home_direction": "back",
},
"nir_mirr2_rx": {
"id": "-ESB4",
"pv_descr": "Motor4:1 near IR mirror 2 rx",
"type": 1,
"sensor": 13,
"speed": 250,
"home_direction": "back",
},
"crystal_stg": {
"id": "-ESB2",
"pv_descr": "Motor3:2 crystal rotation",
"type": 2,
"sensor": 1,
"speed": 250,
"home_direction": "back",
},
"wp_stg": {
"id": "-ESB7",
"pv_descr": "Motor5:1 waveplate rotation",
"type": 2,
"sensor": 1,
"speed": 250,
@@ -217,13 +249,10 @@ class Organic_crystal_breadboard:
for name, config in self.motor_configuration.items():
addSmarActRecordToSelf(self, Id=Id + config["id"], name=name)
addSmarActRecordToSelf(self, Id="SARES23-LIC7", name="polarizer_stg")
addSmarActRecordToSelf(self, Id="SARES23-LIC14", name="crystal_stg")
addSmarActRecordToSelf(self, Id="SARES23-LIC13", name="wp_stg")
self.polarizer = AdjustableVirtual(
[self.polarizer_stg], self.pol_get, self.pol_set, name="polarizer"
)
#self.polarizer = AdjustableVirtual(
# [self.polarizer_stg], self.pol_get, self.pol_set, name="polarizer"
#)
self.crystal = AdjustableVirtual(
[self.crystal_stg], self.xtal_wp_get, self.xtal_wp_set, name="crystal"
)
@@ -257,13 +286,13 @@ class Organic_crystal_breadboard:
def set_stage_config(self):
for name, config in self.motor_configuration.items():
mot = self.__dict__[name]._device
mot.put("NAME", config["pv_descr"])
mot.put("STAGE_TYPE", config["type"])
mot.put("SET_SENSOR_TYPE", config["sensor"])
mot.put("CL_MAX_FREQ", config["speed"])
mot = self.__dict__[name]
mot.caqtdm_name(config["pv_descr"])
mot.stage_type(config["type"])
mot.sensor_type(config["sensor"])
mot.speed(config["speed"])
sleep(0.5)
mot.put("CALIBRATE.PROC", 1)
mot.calibrate_sensor(1)
def home_smaract_stages(self, stages=None):
if stages == None:
@@ -272,7 +301,7 @@ class Organic_crystal_breadboard:
print(self.__repr__())
for name in stages:
config = self.motor_configuration[name]
mot = self.__dict__[name]._device
mot = self.__dict__[name]
print(
"#### Homing {} in {} direction ####".format(
name, config["home_direction"]
@@ -280,25 +309,25 @@ class Organic_crystal_breadboard:
)
sleep(1)
if config["home_direction"] == "back":
mot.put("FRM_BACK.PROC", 1)
while mot.get("STATUS") == 7:
mot.home_backward(1)
while mot.status_channel().value == 7:
sleep(1)
if mot.get("GET_HOMED") == 0:
if mot.is_homed() == 0:
print(
"Homing failed, try homing {} in forward direction".format(name)
)
mot.put("FRM_FORW.PROC", 1)
mot.home_forward(1)
elif config["home_direction"] == "forward":
mot.put("FRM_FORW.PROC", 1)
while mot.get("STATUS") == 7:
mot.home_forward(1)
while mot.status_channel().value == 7:
sleep(1)
if mot.get("GET_HOMED") == 0:
if mot.is_homed() == 0:
print(
"Homing failed, try homing {} in backward direction".format(
name
)
)
mot.put("FRM_BACK.PROC", 1)
mot.home_backward(1)
def get_adjustable_positions_str(self):
ostr = "*****Organic Crystal Breadboard positions******\n"
@@ -360,13 +389,48 @@ class LiNbO3_crystal_breadboard:
def set_stage_config(self):
for name, config in self.motor_configuration.items():
mot = self.__dict__[name]._device
mot.put("NAME", config["pv_descr"])
mot.put("STAGE_TYPE", config["type"])
mot.put("SET_SENSOR_TYPE", config["sensor"])
mot.put("CL_MAX_FREQ", config["speed"])
mot = self.__dict__[name]
mot.caqtdm_name(config["pv_descr"])
mot.stage_type(config["type"])
mot.sensor_type(config["sensor"])
mot.speed(config["speed"])
sleep(0.5)
mot.put("CALIBRATE.PROC", 1)
mot.calibrate_sensor(1)
def home_smaract_stages(self, stages=None):
if stages == None:
stages = self.motor_configuration.keys()
print("#### Positions before homing ####")
print(self.__repr__())
for name in stages:
config = self.motor_configuration[name]
mot = self.__dict__[name]
print(
"#### Homing {} in {} direction ####".format(
name, config["home_direction"]
)
)
sleep(1)
if config["home_direction"] == "back":
mot.home_backward(1)
while mot.status_channel().value == 7:
sleep(1)
if mot.is_homed() == 0:
print(
"Homing failed, try homing {} in forward direction".format(name)
)
mot.home_forward(1)
elif config["home_direction"] == "forward":
mot.home_forward(1)
while mot.status_channel().value == 7:
sleep(1)
if mot.is_homed() == 0:
print(
"Homing failed, try homing {} in backward direction".format(
name
)
)
mot.home_backward(1)
def get_adjustable_positions_str(self):
ostr = "*****LiNbO3 crystal breadboard positions******\n"
+28
View File
@@ -2,6 +2,34 @@ from time import sleep
import sys, select
from threading import Thread
from concurrent.futures import ThreadPoolExecutor, TimeoutError
from pathlib import Path
from typing import Any
class TimeoutPath:
executor = ThreadPoolExecutor(max_workers=1)
def __init__(self, *args, timeout: float = 1, **kwargs):
self._path = Path(*args, **kwargs)
self.timeout = timeout
def exists(self) -> bool:
future = TimeoutPath.executor.submit(self._path.exists)
try:
return future.result(self.timeout)
except TimeoutError:
return False
def get_path(self) -> Path:
return self._path
def __getattr__(self, name: str) -> Any:
return getattr(self._path, name)
def __str__(self) -> str:
return str(self._path)
class PropagatingThread(Thread):
def run(self):