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.")
"""
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
import sys
# SETUP PROMPTS
bec._ip.prompts.username = "PHOENIX"
bec._ip.prompts.status = 1
"""
# make sure that edited modules are reloaded when changed
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")
print('autoreload loaded ')
# define some adional magic for PHOENIX
###########
#
#
# next lines are not ideal and likely need to be removed they are a temporaty fix as we had trouble finding certain paths.
# next lines are not ideal and likely need to be removed they are a temporary fix as we had trouble finding certain paths.
#
# we need to work in server_env, otherwise no server is found
# path to ophyd devices is only way to find default ophyd devices
@ -72,32 +84,57 @@ if ophyd_devices_path not in sys.path:
if p_path not in sys.path:
sys.path.insert(1, os.path.expandvars(p_path))
#endif
print('init phoenix=PhoenixBL()')
#endif
phoenix=PhoenixBL()
#... provide info about currently uses paths and directories
phoenix.show_phoenix_setup()
"""
print('')
print('Current setup for bec --- to be professionanlized ')
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()')
print('')
print('/bec_deployment/phoenix_bec/phoenix_bec/scripts ')
print(' --- autoloaded scripts directory ')
print(' ... file PhoenixBL in phoenix.py defines BL core functions ')
print('')
print('/bec_deployment/phoenix_bec/phoenix_bec/devices')
print(' .... yamal files for device ')
print('/bec_deployment/phoenix_bec/phoenix_bec/local_scripts')
print(' .... collection of local scripts for testing purposes')
print('re run this file by ')
print('phoenix_bec/bec_ipython_client/startup/post_startup.py')
"""
#############################################################################
#
#... register BL specific magic comands
#
##############################################################################
@register_line_magic
def ph_reload(line):
##########################################################################
#
# this reloads certain phoenix related script to the iphython shell.
# useful for debugging/development to be revised for production
# aiom of this magic is to quickl reload BL related stuff for debugginf
#
# #######################################################################
print('reload phoenix_bec.scripts.phoenix to iphyhton console')
print('to update version server restart server ')
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.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.
# """
# return ServiceConfig(redis={"host": "localhost", "port": 6379})

View File

@ -1,47 +1,23 @@
#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_devices.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
###################################################
#
# phoenix standard devices (motors)
#
#
#####################################################
#
# MOTORS ES1
#
ScanX:
ScanXX:
readoutPriority: baseline
description: 'Horizontal sample position'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:ScanX'
deviceConfig:
prefix: 'X07MB-ES-MA1:ScanX'
deviceTags:
- ES-MA1
- phoenix_devices.yaml
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry
enabled: true
readOnly: false
@ -55,7 +31,7 @@ ScanY:
prefix: 'X07MB-ES-MA1:ScanY'
deviceTags:
- ES-MA1
- phoenix_devices.yaml
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry
enabled: true
readOnly: false
@ -72,10 +48,10 @@ SAI_07_MEAN:
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_07:MEAN'
read_pv: 'X07MB-OP2-SAI_07:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: true
readOnly: true
@ -90,7 +66,7 @@ SAI_08_MEAN:
read_pv: 'X07MB-OP2-SAI_08:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: 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
dxp = Cpt(EpicsDXPXMAP, "dxp1:")
mca1 = Cpt(EpicsMCARecord, "mca1")
mca2 = Cpt(EpicsMCARecord, "mca2")
mca3 = Cpt(EpicsMCARecord, "mca3")
mca4 = Cpt(EpicsMCARecord, "mca4")
hdf5 = Cpt(XMAPHDF5Plugins, "HDF1:")
stop_all = Cpt(EpicsSignal, "StopAll")

View File

@ -28,3 +28,6 @@ to run startup file:
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_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.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.file_phoenix_devices_file = self.path_phoenix_bec+'phoenix_bec/device_configs/phoenix_devices.yaml'
#bec.config.update_session_with_file(self.file_device_conf)
# last command created yaml backup, for now just move it away
#os.system('mv *.yaml '+Devices_local+'/recovery_configs')
#os.system('mv *.yaml tmp')
self.path_phoenix_bec ='/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/'
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
def read_local_phoenix_config(self):
print('read file ')
print(self.file_phoenix_devices_file)
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):
print('read 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):
print(self.path_phoenix_bec)
os.system('cat '+self.path_phoenix_bec+'phoenix_bec/local_scripts/Documentation/Current_setup.txt')
def test_func():
print('ttpsssyt')
os.system('cat '+self.path_phoenix_bec+'phoenix_bec/scripts/Current_setup.txt')