PHOENIX Version 1 8.8.2024

This commit is contained in:
gac-x07mb
2024-08-08 17:11:31 +02:00
parent 47d5c315d1
commit 48f20434e6
9 changed files with 214 additions and 84 deletions

View File

@ -33,24 +33,36 @@ to setup the prompts.
logger.success("cSAXS session loaded.") logger.success("cSAXS session loaded.")
""" """
from IPython.core.magic import register_line_magic
# pylint: disable=invalid-name, unused-import, import-error, undefined-variable, unused-variable, unused-argument, no-name-in-module # pylint: disable=invalid-name, unused-import, import-error, undefined-variable, unused-variable, unused-argument, no-name-in-module
import sys import sys
# SETUP PROMPTS # SETUP PROMPTS
bec._ip.prompts.username = "PHOENIX" bec._ip.prompts.username = "PHOENIX"
bec._ip.prompts.status = 1 bec._ip.prompts.status = 1
"""
# make sure that edited modules are reloaded when changed # make sure that edited modules are reloaded when changed
print('post_startup.py : set autoreload of modules') print('post_startup.py : set autoreload of modules')
bec._ip.run_line_magic("load_ext","autoreload")
#def load_autoreload():
# bec._ip.run_line_magic("reload_ext","autoreload")
#try:
# #load_autoreload()
# bec._ip.run_line_magic("reload_ext","autoreload")
# print('1xn_line_magic("reload_ext","autoreload")
bec._ip.run_line_magic("autoreload", "2") bec._ip.run_line_magic("autoreload", "2")
print('autoreload loaded ')
# define some adional magic for PHOENIX
########### ###########
# #
# # next lines are not ideal and likely need to be removed they are a temporary fix as we had trouble finding certain paths.
# next lines are not ideal and likely need to be removed they are a temporaty fix as we had trouble finding certain paths.
# #
# we need to work in server_env, otherwise no server is found # we need to work in server_env, otherwise no server is found
# path to ophyd devices is only way to find default ophyd devices # path to ophyd devices is only way to find default ophyd devices
@ -73,31 +85,56 @@ if ophyd_devices_path not in sys.path:
if p_path not in sys.path: if p_path not in sys.path:
sys.path.insert(1, os.path.expandvars(p_path)) sys.path.insert(1, os.path.expandvars(p_path))
#endif #endif
print('init phoenix=PhoenixBL()')
phoenix=PhoenixBL()
#... provide info about currently uses paths and directories
phoenix.show_phoenix_setup()
""" #############################################################################
print('') #
print('Current setup for bec --- to be professionanlized ') #... register BL specific magic comands
print('use ') #
print('/phoenix_bec/phoenix_bec/bec_ipython_client/startup/post_startup.py') ##############################################################################
print('..................... for commands to start/init bec iphython shell')
print('......................here we init phoenix=PhoenixBL()') @register_line_magic
print('') def ph_reload(line):
print('/bec_deployment/phoenix_bec/phoenix_bec/scripts ') ##########################################################################
print(' --- autoloaded scripts directory ') #
print(' ... file PhoenixBL in phoenix.py defines BL core functions ') # this reloads certain phoenix related script to the iphython shell.
print('') # useful for debugging/development to be revised for production
print('/bec_deployment/phoenix_bec/phoenix_bec/devices') # aiom of this magic is to quickl reload BL related stuff for debugginf
print(' .... yamal files for device ') #
print('/bec_deployment/phoenix_bec/phoenix_bec/local_scripts') # #######################################################################
print(' .... collection of local scripts for testing purposes') print('reload phoenix_bec.scripts.phoenix to iphyhton console')
print('re run this file by ') print('to update version server restart server ')
print('phoenix_bec/bec_ipython_client/startup/post_startup.py') global PH,phoenix
""" print('from phoenix_bec.scripts import phoenix as PH')
from phoenix_bec.scripts import phoenix as PH
print('phoenix = PH.PhoenixBL()')
phoenix = PH.PhoenixBL()
#enddef
##@register_line_magic
#def ph_post_startup(line):
# print('import phoenix_bec.bec_ipython_client.startup.post_startup does not work caused loop ')
# #import phoenix_bec.bec_ipython_client.startup.post_startup
# does not work seems to build a infinite stack...
####################################################################################
#
# init phoenix.py from server version as
# .................. phoenix_server=PhoenixBL()
# and in ipython shell only as
# .............. phoenix = Ph.Pheonix(BL()
#
#####################################################################################
print('init phoenix_server = PhoenixBL() ... from server version ')
phoenix_server=PhoenixBL()
print('init phoenix=PH.PhoenixBL() ... on inpython shell onlz (for debugging)')
from phoenix_bec.scripts import phoenix as PH
phoenix = PH.PhoenixBL()
#from phoenix_bec.bec_ipython_client.plugins.phoenix import Phoenix #from phoenix_bec.bec_ipython_client.plugins.phoenix import Phoenix
#from phoenix_bec.devices.falcon_phoenix_no_hdf5 import FalconHDF5Plugins #from phoenix_bec.devices.falcon_phoenix_no_hdf5 import FalconHDF5Plugins
"""

View File

@ -21,3 +21,6 @@ def extend_command_line_args(parser):
# Create and return the service configuration. # Create and return the service configuration.
# """ # """
# return ServiceConfig(redis={"host": "localhost", "port": 6379}) # return ServiceConfig(redis={"host": "localhost", "port": 6379})

View File

@ -1,39 +1,15 @@
#falcon_nohdf5: ###################################################
# description: Falcon detector x-ray fluoresence II #
# deviceClass: phoenix_bec.devices.falcon_phoenix_no_hdf5.FalconcSAXS # phoenix standard devices (motors)
# deviceConfig: #
# prefix: 'X07MB-SITORO:' #
# deviceTags: #####################################################
# - phoenix
# - falcon
# - no hdf5
# - phoenix_devices.yaml
# onFailure: buffer
# enabled: true
# readoutPriority: async
# softwareTrigger: false
xmap_nohdf5:
description: Falcon detector x-ray fluoresence II
deviceClass: phoenix_bec.devices.xmap_phoenix_no_hdf5.XMAPphoenix
deviceConfig:
prefix: 'X07MB-XMAP:'
deviceTags:
- phoenix
- xmap
- no hdf5
- phoenix_devices.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
# #
# MOTORS ES1 # MOTORS ES1
# #
ScanX: ScanXX:
readoutPriority: baseline readoutPriority: baseline
description: 'Horizontal sample position' description: 'Horizontal sample position'
deviceClass: ophyd.EpicsMotor deviceClass: ophyd.EpicsMotor
@ -41,7 +17,7 @@ ScanX:
prefix: 'X07MB-ES-MA1:ScanX' prefix: 'X07MB-ES-MA1:ScanX'
deviceTags: deviceTags:
- ES-MA1 - ES-MA1
- phoenix_devices.yaml - phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry onFailure: retry
enabled: true enabled: true
readOnly: false readOnly: false
@ -55,7 +31,7 @@ ScanY:
prefix: 'X07MB-ES-MA1:ScanY' prefix: 'X07MB-ES-MA1:ScanY'
deviceTags: deviceTags:
- ES-MA1 - ES-MA1
- phoenix_devices.yaml - phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry onFailure: retry
enabled: true enabled: true
readOnly: false readOnly: false
@ -75,7 +51,7 @@ SAI_07_MEAN:
read_pv: 'X07MB-OP2-SAI_07:MEAN' read_pv: 'X07MB-OP2-SAI_07:MEAN'
deviceTags: deviceTags:
- PHOENIX - PHOENIX
- phoenix_devices.yaml - phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer onFailure: buffer
enabled: true enabled: true
readOnly: true readOnly: true
@ -90,7 +66,7 @@ SAI_08_MEAN:
read_pv: 'X07MB-OP2-SAI_08:MEAN' read_pv: 'X07MB-OP2-SAI_08:MEAN'
deviceTags: deviceTags:
- PHOENIX - PHOENIX
- phoenix_devices.yaml - phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer onFailure: buffer
enabled: true enabled: true
readOnly: true readOnly: true

View File

@ -0,0 +1,88 @@
falcon_nohdf5:
description: Falcon detector x-ray fluoresence II
deviceClass: phoenix_bec.devices.falcon_phoenix_no_hdf5.FalconcSAXS
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- no hdf5
- phoenix_devices.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
xmap_nohdf5:
description: Falcon detector x-ray fluoresence II
deviceClass: phoenix_bec.devices.xmap_phoenix_no_hdf5.XMAPphoenix
deviceConfig:
prefix: 'X07MB-XMAP:'
deviceTags:
- phoenix
- xmap
- no hdf5
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# MOTORS ES1
#
ScanXX:
readoutPriority: baseline
description: 'Horizontal sample position'
deviceClass: ophyd.EpicsMotor
deviceConfig:
ScanY:
readoutPriority: baseline
description: 'Horizontal sample position'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:ScanY'
deviceTags:
- ES-MA1
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry
enabled: true
readOnly: false
softwareTrigger: false
#
#
# DIODES from ES1 ADC
#
#
SAI_07_MEAN:
readoutPriority: monitored
description: DIODE
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_07:MEAN' a
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_08_MEAN:
readoutPriority: monitored
description: DIODE
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_08:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false

View File

@ -0,0 +1,14 @@
falcon_nohdf5:
description: Falcon detector x-ray fluoresence II
deviceClass: phoenix_bec.devices.falcon_phoenix_no_hdf5.FalconcSAXS
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- no hdf5
- phoenix_devices.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false

View File

@ -0,0 +1,14 @@
xmap_nohdf5:
description: Falcon detector x-ray fluoresence II
deviceClass: phoenix_bec.devices.xmap_phoenix_no_hdf5.XMAPphoenix
deviceConfig:
prefix: 'X07MB-XMAP:'
deviceTags:
- phoenix
- xmap
- no hdf5
- phoenix_bec/device_configs/phoenix_xmap.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false

View File

@ -334,10 +334,12 @@ class XMAPphoenix(PSIDetectorBase):
# specify class attributes # specify class attributes
dxp = Cpt(EpicsDXPXMAP, "dxp1:") dxp = Cpt(EpicsDXPXMAP, "dxp1:")
mca1 = Cpt(EpicsMCARecord, "mca1") mca1 = Cpt(EpicsMCARecord, "mca1")
mca2 = Cpt(EpicsMCARecord, "mca2") mca2 = Cpt(EpicsMCARecord, "mca2")
mca3 = Cpt(EpicsMCARecord, "mca3") mca3 = Cpt(EpicsMCARecord, "mca3")
mca4 = Cpt(EpicsMCARecord, "mca4") mca4 = Cpt(EpicsMCARecord, "mca4")
hdf5 = Cpt(XMAPHDF5Plugins, "HDF1:") hdf5 = Cpt(XMAPHDF5Plugins, "HDF1:")
stop_all = Cpt(EpicsSignal, "StopAll") stop_all = Cpt(EpicsSignal, "StopAll")

View File

@ -28,3 +28,6 @@ to run startup file:
phoenix_bec/bec_ipython_client/startup/post_startup.py phoenix_bec/bec_ipython_client/startup/post_startup.py
Magic commands defiend in post_startup.py (should all start with ph_)
%ph_reload : reloads module phoenix.py to ipython shell BUT not to server

View File

@ -64,30 +64,23 @@ class PhoenixBL():
self.path_scripts_local = '/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/phoenix_bec/local_scripts/' self.path_scripts_local = '/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/phoenix_bec/local_scripts/'
self.path_config_local = self.path_scripts_local + 'TEST_ConfigPhoenix/' # base dir for local configurations self.path_config_local = self.path_scripts_local + 'TEST_ConfigPhoenix/' # base dir for local configurations
self.path_devices_local = self.path_config_local + 'Local_device_config/' # local yamal file self.path_devices_local = self.path_config_local + 'Local_device_config/' # local yamal file
self.file_device_file_local = self.path_devices_local + 'phoenix_devices.yaml' self.file_devices_file_local = self.path_devices_local + 'phoenix_devices.yaml'
self.path_phoenix_bec ='/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/' self.path_phoenix_bec ='/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/'
self.file_phoenix_devices_file = self.path_phoenix_bec+'phoenix_bec/device_configs/phoenix_devices.yaml' self.path_devices = self.path_phoenix_bec + 'phoenix_bec/device_configs/' # local yamal file
self.file_devices_file = self.path_phoenix_bec + 'phoenix_bec/device_configs/phoenix_devices.yaml' # local yamal file
#bec.config.update_session_with_file(self.file_device_conf) def read_local_phoenix_config(self):
# last command created yaml backup, for now just move it away print('read file ')
#os.system('mv *.yaml '+Devices_local+'/recovery_configs') print(self.file_phoenix_devices_file)
#os.system('mv *.yaml tmp') bec.config.update_session_with_file(self.file_devices_file_local)
def read_def_config(self):
bec.config.update_session_with_file(self.file_device_conf)
def read_phoenix_config(self): def read_phoenix_config(self):
print('read file ') print('read file ')
print(self.file_phoenix_devices_file) print(self.file_phoenix_devices_file)
bec.config.update_session_with_file(self.file_phoenix_devices_file) bec.config.update_session_with_file(self.file_devices_file)
def show_phoenix_setup(self): def show_phoenix_setup(self):
print(self.path_phoenix_bec) print(self.path_phoenix_bec)
os.system('cat '+self.path_phoenix_bec+'phoenix_bec/local_scripts/Documentation/Current_setup.txt') os.system('cat '+self.path_phoenix_bec+'phoenix_bec/scripts/Current_setup.txt')
def test_func():
print('ttpsssyt')