22 Commits

Author SHA1 Message Date
77403aea1e add try to put full scan logig into one single device 2024-12-21 15:25:42 +01:00
03789c34f4 minor changes 2024-12-20 15:48:06 +01:00
c888c22da2 add curent code profile 2024-12-20 11:54:11 +01:00
010fefd11d add check for xmap to trigger 2024-12-20 11:40:26 +01:00
feb911ab68 add code settings file 2024-12-19 22:08:14 +01:00
cd81030430 add ph_ names to xmap to ease finding of epics channels 2024-12-19 18:41:55 +01:00
c021972d97 minor changes 2024-12-17 17:02:39 +01:00
3a45759f79 minor changes 2024-12-17 16:55:26 +01:00
da1c7bb4cf repair error due to code editor chaos 2024-12-17 16:44:13 +01:00
d4512c0fb1 minor syntax beauty changes 2024-12-17 16:36:57 +01:00
1654f7cfa4 minor changes 2024-12-17 16:28:15 +01:00
3c618b431e minor changes add functions to phoenix.py 2024-12-17 16:13:36 +01:00
a36a0a9189 improve phoenix_help, update dxp_loc.py, revise scan scripts 2024-12-06 15:31:10 +01:00
c944d5da69 small fix 2024-11-21 17:45:36 +01:00
c86a5e3f4b Add help functionality for BL specific information on BEC command line 2024-11-21 17:38:36 +01:00
61b1385976 move dxp.py temporarilty to local dir to avoid git error messages 2024-11-20 08:34:48 +01:00
42ec7d64f2 move dxp.py temporarilty to local dir to avoid git error messages 2024-11-20 08:27:23 +01:00
2da6af2b50 test upload for debugging 2024-11-19 16:48:41 +01:00
bde88ec5ce test upload for debugging 2024-11-19 16:38:02 +01:00
10c512604a bugfix 2024-11-19 15:36:06 +01:00
4ef08b9b99 remove not needed files 2024-11-19 15:21:39 +01:00
7a28dd3ca8 clean up of path and filenames for xmap and falcon 2024-11-19 15:14:44 +01:00
48 changed files with 4747 additions and 502 deletions

View File

@ -71,6 +71,7 @@ print("autoreload loaded ")
@register_line_magic
def ph_reload(line):
"""reloads certain phoenix related script to the iphython shell"""
##########################################################################
#
@ -88,7 +89,9 @@ def ph_reload(line):
print("to update version server restart server ")
# need to use global statement here, as I like to reload into space on
# iphyton consoel
global PH, phoenix
print("from phoenix_bec.scripts import phoenix as PH")
print("phoenix = PH.PhoenixBL()")
phoenix = PH.PhoenixBL()
@ -115,7 +118,7 @@ def ph_add_xmap(line):
# enddef
print("...... %ph_load_falcon ... to reload falcon configuration")
print("...... %ph_add_falcon ... to addd falcon to configuration")
@register_line_magic
@ -130,6 +133,8 @@ def ph_add_falcon(line):
## enddef
print("...... %ph_load_falcon ... to load falcon ")
@register_line_magic
def ph_load_falcon(line):
@ -141,7 +146,35 @@ def ph_load_falcon(line):
print("elapsed time:", tt.time() - t0)
print("...... %ph_load_config ... to reload phoenix default configuration")
print("...... %ph_add_xmap ... to add xmap to default configuration")
@register_line_magic
def ph_add_xmap(line):
"""
magic to add falcon to existing configuration
"""
t0 = tt.time()
phoenix.add_xmap()
print("elapsed time:", tt.time() - t0)
## enddef
print("...... %ph_load_xmap ... to load xmap ")
@register_line_magic
def ph_load_xmap(line):
"""
magic to load falcon as sole detector
"""
t0 = tt.time()
phoenix.load_xmap()
print("elapsed time:", tt.time() - t0)
print("...... %ph_create_base_config ...load base devices ")
@register_line_magic
@ -158,13 +191,18 @@ def ph_create_base_config(line):
### enddef
print("...... %ph_restart_bec_server restarts bec-server in new terminal ")
@register_line_magic
def ph_restart_bec_server(line):
os.system("bec-server restart")
os.system(
'gnome-terminal --geometry 170X50 -- bash -c "source /data/test/x07mb-test-bec/bec_deployment/bec_venv/bin/activate ; bec-server attach; exec bash"'
'gnome-terminal --geometry 100X30 -- bash -c "source /data/test/x07mb-test-bec/production/bec_venv/bin/activate ; bec-server attach ; exec bash"'
)
# os.system(
# "gnome-terminal --geometry 170X50 -- bash -c "source / tmux attach -t bec ; exec bash""
# )
# #import phoenix_bec.bec_ipython_client.startup.post_startup
@ -179,11 +217,11 @@ def ph_restart_bec_server(line):
##
#####################################################################################
print("###############################################################")
#############################################")
print(" ")
print("init phoenix_bec/scripts/phoenix.py in two different ways")
print(" 1) phoenix_server = PhoenixBL() ... takes code from server version ")
print("SERVR VERSION DOES NOT WORK ANYMORE ")
print("FOLDER SCRIPT SEEMS TO BE NON_STANDARD!!!!!!! ")
phoenix_server = PhoenixBL()
@ -192,7 +230,9 @@ print(" 2) phoenix=PH.PhoenixBL() ... on inpython shell only! (for debuggin
from phoenix_bec.scripts import phoenix as PH
phoenix = PH.PhoenixBL()
pheonix = phoenix # take care os a frequent typo
# from phoenix_bec.bec_ipython_client.plugins.phoenix import Phoenix
# from phoenix_bec.devices.falcon_phoenix_no_hdf5 import FalconHDF5Plugins
print("")
print("## HELP ########### HELP #### HELP ")
print("")
print(" for help type phoenix.help() ")

View File

@ -8,6 +8,7 @@ PH_TTL:
- phoenix
- TTL Trigger
- phoenix_devices.yaml
- class PhoenixTrigger
onFailure: buffer
enabled: true
readoutPriority: monitored
@ -29,7 +30,8 @@ PH_Dummy:
name: 'Dummy_Detector_PSI_Detector'
deviceTags:
- phoenix
- phoenix_devices.yamllass
- phoenix_devices.yaml
- class Dummy_PSIDetector
- reads channel X07MB-PC-PSCAN.P-P0D0
- Dummy class to test PSI detector c from DAQ GUI
onFailure: buffer
@ -45,7 +47,7 @@ PH_Dummy:
#
############################
ScanX:
MA1_ScanX:
readoutPriority: baseline
description: 'Vertical sample position ES-MA1.ScanX'
deviceClass: ophyd.EpicsMotor
@ -53,12 +55,13 @@ ScanX:
prefix: 'X07MB-ES-MA1:ScanX'
deviceTags:
- ES-MA1.ScanX
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: true
enabled: false
readOnly: false
ScanY:
MA1_ScanY:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ScanY'
deviceClass: ophyd.EpicsMotor
@ -66,17 +69,166 @@ ScanY:
prefix: 'X07MB-ES-MA1:ScanY'
deviceTags:
- ES-MA1.ScanY
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: true
enabled: false
readOnly: false
softwareTrigger: false
MA1_ROT:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ROT'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:ROT'
deviceTags:
- ES-MA1.ROT
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
MA1_TRZ1:
readoutPriority: baseline
description: 'position ES-MA1.ROT'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:TRZ1'
deviceTags:
- ES-MA1.TRZ1
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
MA1_TRX1:
readoutPriority: baseline
description: 'position ES-MA1.TRX1'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:TRX1'
deviceTags:
- ES-MA1.TRX1
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
#
#
#
# DIODES from ES1 ADC
#
#
SAI_01_MEAN:
readoutPriority: monitored
description: DIODE SAI01
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_01:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_02_MEAN:
readoutPriority: monitored
description: DIODE SAI02
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_02:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_03_MEAN:
readoutPriority: monitored
description: DIODE SAI03
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_03:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_04_MEAN:
readoutPriority: monitored
description: DIODE SAI04
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_04:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_05_MEAN:
readoutPriority: monitored
description: DIODE SAI05
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_05:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_06_MEAN:
readoutPriority: monitored
description: DIODE SAI06
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_06:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_07_MEAN:
readoutPriority: monitored
description: DIODE SAI07
@ -86,7 +238,8 @@ SAI_07_MEAN:
read_pv: 'X07MB-OP2-SAI_07:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
@ -101,7 +254,8 @@ SAI_08_MEAN:
read_pv: 'X07MB-OP2-SAI_08:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
@ -111,303 +265,18 @@ SAI_08_MEAN:
# END OF STANDARD CONFIG
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
MA1_TRZ1:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ROT'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-SITORO:'
prefix: 'X07MB-ES-MA1:TRZ1'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
- ES-MA1.TRZ1
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#
#
# falcon without hdf5
#
falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
- phoenix
- falcon
- with hdf5
- phoenix_falcon.yaml
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false
#
# END FALCON with HDF5
#

View File

@ -1,6 +1,6 @@
PH_TTL:
description: PHOENIX TTL trigger
description: PHOENIX TTL TRIGGER
deviceClass: phoenix_bec.devices.phoenix_trigger.PhoenixTrigger
deviceConfig:
prefix: 'X07MB-OP2:'
@ -8,12 +8,26 @@ PH_TTL:
- phoenix
- TTL Trigger
- phoenix_devices.yaml
- class PhoenixTrigger
onFailure: buffer
enabled: true
enabled: false
readoutPriority: monitored
softwareTrigger: true
PH_SCAN_1:
description: PHOENIX Scan_1 (Experimental)
deviceClass: phoenix_bec.devices.phoenix_scan_1.PhoenixScan_1
deviceConfig:
prefix: 'X07MB-OP2:'
deviceTags:
- phoenix
- TTL Trigger
- phoenix_devices.yaml
- class PhoenixTrigger
onFailure: buffer
enabled: false
readoutPriority: monitored
softwareTrigger: true
###################################################
#
# phoenix standard devices (motors)
@ -29,7 +43,8 @@ PH_Dummy:
name: 'Dummy_Detector_PSI_Detector'
deviceTags:
- phoenix
- phoenix_devices.yamllass
- phoenix_devices.yaml
- class Dummy_PSIDetector
- reads channel X07MB-PC-PSCAN.P-P0D0
- Dummy class to test PSI detector c from DAQ GUI
onFailure: buffer
@ -45,7 +60,7 @@ PH_Dummy:
#
############################
ScanX:
MA1_ScanX:
readoutPriority: baseline
description: 'Vertical sample position ES-MA1.ScanX'
deviceClass: ophyd.EpicsMotor
@ -53,12 +68,13 @@ ScanX:
prefix: 'X07MB-ES-MA1:ScanX'
deviceTags:
- ES-MA1.ScanX
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: true
enabled: false
readOnly: false
ScanY:
MA1_ScanY:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ScanY'
deviceClass: ophyd.EpicsMotor
@ -66,19 +82,186 @@ ScanY:
prefix: 'X07MB-ES-MA1:ScanY'
deviceTags:
- ES-MA1.ScanY
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: true
enabled: false
readOnly: false
softwareTrigger: false
MA1_ROT:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ROT'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:ROT'
deviceTags:
- ES-MA1.ROT
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
MA1_TRZ1:
readoutPriority: baseline
description: 'position ES-MA1.ROT'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:TRZ1'
deviceTags:
- ES-MA1.TRZ1
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
MA1_TRX1:
readoutPriority: baseline
description: 'position ES-MA1.TRX1'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:TRX1'
deviceTags:
- ES-MA1.TRX1
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false
#
#
#
# DIODES from ES1 ADC
#
#
PP2_VO5:
readoutPriority: baseline
description: Chamber light
deviceClass: ophyd.EpicsSignal
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-ES1-PP2:VO5'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignal
onFailure: buffer
enabled: true
readOnly: false
softwareTrigger: false
SAI_01_MEAN:
readoutPriority: baseline
description: DIODE SAI01
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_01:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_02_MEAN:
readoutPriority: baseline
description: DIODE SAI02
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_02:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_03_MEAN:
readoutPriority: baseline
description: DIODE SAI03
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_03:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_04_MEAN:
readoutPriority: baseline
description: DIODE SAI04
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_04:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_05_MEAN:
readoutPriority: baseline
description: DIODE SAI05
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_05:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_06_MEAN:
readoutPriority: baseline
description: DIODE SAI06
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_06:MEAN'
deviceTags:
- PHOENIX
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_07_MEAN:
readoutPriority: monitored
readoutPriority: baseline
description: DIODE SAI07
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
@ -86,14 +269,15 @@ SAI_07_MEAN:
read_pv: 'X07MB-OP2-SAI_07:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_08_MEAN:
readoutPriority: monitored
readoutPriority: baseline
description: DIODE
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
@ -101,7 +285,8 @@ SAI_08_MEAN:
read_pv: 'X07MB-OP2-SAI_08:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
- phoenix_devices.yaml
- class EpicsSignalRO
onFailure: buffer
enabled: true
readOnly: true
@ -110,3 +295,19 @@ SAI_08_MEAN:
#
# END OF STANDARD CONFIG
#
MA1_TRZ1:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ROT'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:TRZ1'
deviceTags:
- ES-MA1.TRZ1
- phoenix_devices.yaml
- class EpicsMotor
onFailure: retry
enabled: false
readOnly: false
softwareTrigger: false

View File

@ -2,9 +2,9 @@
#
# falcon without hdf5
#
falcon_hdf5:
falcon:
description: Falcon detector x-ray fluoresence with hdf5 plugin from device class phoenix_bec.devices. falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.falcon_phoenix.FalconPhoenix
deviceClass: phoenix_bec.devices.phoenix_falcon.FalconPhoenix
deviceConfig:
prefix: 'X07MB-SITORO:'
deviceTags:
@ -12,6 +12,8 @@ falcon_hdf5:
- falcon
- with hdf5
- phoenix_falcon.yaml
- class FalconPhoenix
- file:phoenix_falcon.py
onFailure: buffer
enabled: true
readoutPriority: async

View File

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

View File

@ -1,18 +1,19 @@
#
# Configuration XMAP without hdf5
# Configuration XMAP
#
xmap_nohdf5:
description: XMAP detector x-ray fluoresence II
deviceClass: phoenix_bec.devices.xmap_phoenix_no_hdf5.XMAPPhoenix
xmap:
description: XMAP detector x-ray fluoresence
deviceClass: phoenix_bec.devices.phoenix_xmap.XMAPPhoenix
deviceConfig:
prefix: 'X07MB-XMAP:'
deviceTags:
- phoenix
- xmap
- no hdf5
- phoenix_bec/device_configs/phoenix_xmap.yaml
- class XMAPPhoenix
- file phoenix_xmap
onFailure: buffer
enabled: true
readoutPriority: async
softwareTrigger: false

View File

@ -1,6 +1,6 @@
// This file was autogenerated. Do not edit it manually.
## Device List
### phoenix_bec
### phoenix_bec
| Device | Documentation | Module |
| :----- | :------------- | :------ |
| Dummy_PSIDetector | <br> Abstract base class for SLS detectors<br><br> Class attributes:<br> custom_prepare_cls (object): class for custom prepare logic (BL specific)<br><br> Args:<br> prefix (str): EPICS PV prefix for component (optional)<br> name (str): name of the device, as will be reported via read()<br> kind (str): member of class 'ophydobj.Kind', defaults to Kind.normal<br> omitted -> reado_PSIDetectorBase<br> | [phoenix_bec.devices.dummy_devices](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/dummy_devices.py) |
@ -12,7 +12,7 @@
| FalconPhoenix | <br> Falcon detector for phoenix<br> custom_prepare_cls (XMAPSetu<br> custom_prepare_cls (XMAPSetup) : Custom detector setup class for cSAXS,<br> inherits from CustomDetectorMixin<br> in __init__ of PSIDetecor base<br> PSIDetectorBase.set_min_readout (float) : Minimum readout time for the detector<br> dxp (EpicsDXPXMAP) : DXP parameters for XMAP detector<br> mca (EpicsMCARecord) : MCA parameters for XMAP detector<br> hdf5 (XMAPHDF5Plugins) : HDF5 parameters for XMAP detector<br> MIN_READOUT (float) : Minimum readout time for the detector<br> | [phoenix_bec.devices.falcon_phoenix_no_hdf5](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/falcon_phoenix_no_hdf5.py) |
| PhoenixTrigger | <br> Class for PHOENIX TTL hardware trigger: 'X07MB-OP2:'<br><br> This device is used to trigger communicate with an ADC card<br> that creates TTL signals to trigger cameras and detectors at Phoenix.<br><br> | [phoenix_bec.devices.phoenix_trigger](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/phoenix_trigger.py) |
| ROI | | [phoenix_bec.devices.sitoro](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/sitoro.py) |
| SitoroEpicsDXP | All high-level DXP parameters for each channel | [phoenix_bec.devices.sitoro](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/sitoro.py) |
| SitoroEpicsDXP | All high-level DXP parameters for each channel | [phoenix_bec.devices.sitoro](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/maiself.file_devices_tmn/phoenix_bec/devices/sitoro.py) |
| SitoroEpicsDXP_OLD | <br> DXP parameters for Sitoro detector<br><br> Base class to map EPICS PVs from DXP parameters to ophyd signals.<br> | [phoenix_bec.devices.sitoro_phoenix](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/sitoro_phoenix.py) |
| SitoroEpicsDXPBaseSystem | | [phoenix_bec.devices.sitoro](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/sitoro.py) |
| SitoroEpicsDXPLowLevel | | [phoenix_bec.devices.sitoro](https://gitlab.psi.ch/bec/phoenix_bec/-/blob/main/phoenix_bec/devices/sitoro.py) |

View File

@ -297,7 +297,7 @@ class SetupDummy(CustomDetectorMixin):
class Dummy_PSIDetector(PSIDetectorBase):
"""
Abstract base class for SLS detectors
Abstract base class for SLS detasyn_pipeline_configectors
Class attributes:
custom_prepare_cls (object): class for custom prepare logic (BL specific)

View File

@ -0,0 +1,207 @@
"""
This file dxp_loc.py is a local copy of dxp.py, as relased by Christian on Dec 5th 2024, as take from git
https://gitlab.psi.ch/bec/ophyd_devices/-/tree/main/ophyd_devices/devices?ref_type=heads
use local copy for now, as we likely need new deploymen... to complicated for me for now.
Base classes for XIA xMAP and FalconX dxp system.
Falcon interfaces with the dxpSITORO epics driver, https://github.com/epics-modules/dxpSITORO.
xMAP interfaces with the dxp epics driver, https://github.com/epics-modules/dxp.
An example usage for a 4-element FalconX system. ::
from ophyd import Component as Cpt
from ophyd_devices.devices.dxp import Falcon, EpicsMCARecord, EpicsDXPFalcon
from ophyd_devices.devices.areadetector.plugins import HDF5Plugin_V35 as HDF5Plugin
class FalconX4(Falcon):
# DXP parameters
dxp1 = Cpt(EpicsDXPFalcon, "dxp1:")
dxp2 = Cpt(EpicsDXPFalcon, "dxp2:")
dxp3 = Cpt(EpicsDXPFalcon, "dxp3:")
dxp4 = Cpt(EpicsDXPFalcon, "dxp4:")
# MCA record with spectrum data
mca1 = Cpt(EpicsMCARecord, "mca1")
mca2 = Cpt(EpicsMCARecord, "mca2")
mca3 = Cpt(EpicsMCARecord, "mca3")
mca4 = Cpt(EpicsMCARecord, "mca4")
# optionally with a HDF5 writer plugin
hdf = Cpt(HDF5Plugin, "HDF1:")
falcon = FalconX4("X07MB-SITORO:", name="falcon")
falcon.collect_mode.put(0) # 0: MCA spectra, 1: MCA mapping
falcon.preset_mode.put("Real time")
falcon.preset_real_time.put(1)
status = falcon.erase_start.set(1)
status.wait()
falcon.mca1.spectrum.get()
"""
from ophyd import Component as Cpt
from ophyd import Device, EpicsSignal, EpicsSignalRO, Kind
from ophyd.areadetector import ADBase
from ophyd.areadetector import ADComponent as ADCpt
from ophyd.areadetector import EpicsSignalWithRBV
from ophyd.mca import EpicsDXP, EpicsDXPBaseSystem, EpicsDXPMapping
from ophyd.mca import EpicsDXPMultiElementSystem as _EpicsDXPMultiElementSystem
from ophyd.mca import EpicsMCARecord as _EpicsMCARecord
__all__ = ("EpicsMCARecord", "EpicsDXP", "EpicsDXPFalcon", "Falcon", "Mercury", "xMAP")
class EpicsMCARecord(_EpicsMCARecord):
"""EpicsMCARecord with addtional fields"""
# Calibration values
calo = Cpt(EpicsSignal, ".CALO", kind=Kind.config)
cals = Cpt(EpicsSignal, ".CALS", kind=Kind.config)
calq = Cpt(EpicsSignal, ".CALQ", kind=Kind.config)
tth = Cpt(EpicsSignal, ".TTH", kind=Kind.config)
class EpicsDXPFalcon(Device):
"""All high-level DXP parameters for each channel"""
# Detection
detection_filter = Cpt(EpicsSignalWithRBV, "DetectionFilter")
detection_threshold = Cpt(EpicsSignalWithRBV, "DetectionThreshold")
min_pulse_pair_separation = Cpt(EpicsSignalWithRBV, "MinPulsePairSeparation")
# Pre-amp and energe range
detector_polarity = Cpt(EpicsSignalWithRBV, "DetectorPolarity")
decay_time = Cpt(EpicsSignalWithRBV, "DecayTime")
risetime_optimization = Cpt(EpicsSignalWithRBV, "RisetimeOptimization")
scale_factor = Cpt(EpicsSignalWithRBV, "ScaleFactor")
# Presets
preset_events = Cpt(EpicsSignalWithRBV, "PresetEvents")
preset_mode = Cpt(EpicsSignalWithRBV, "PresetMode", string=True)
preset_triggers = Cpt(EpicsSignalWithRBV, "PresetTriggers")
preset_real_time = Cpt(EpicsSignalWithRBV, "PresetReal")
# Couting statistics
elapsed_live_time = Cpt(EpicsSignalRO, "ElapsedLiveTime", lazy=True)
elapsed_real_time = Cpt(EpicsSignalRO, "ElapsedRealTime", lazy=True)
elapsed_trigger_live = Cpt(EpicsSignalRO, "ElapsedTriggerLiveTime", lazy=True)
triggers = Cpt(EpicsSignalRO, "Triggers", lazy=True)
events = Cpt(EpicsSignalRO, "Events", lazy=True)
input_count_rate = Cpt(EpicsSignalRO, "InputCountRate", lazy=True)
output_count_rate = Cpt(EpicsSignalRO, "OutputCountRate", lazy=True)
# Mapping
current_pixel = Cpt(EpicsSignal, "CurrentPixel")
# Diagnostic trace
trace_data = Cpt(EpicsSignal, "TraceData")
class EpicsDXPFalconMultiElementSystem(EpicsDXPBaseSystem):
"""System-wide parameters as defined in dxpMED.template"""
# Preset control
preset_events = Cpt(EpicsSignal, "PresetEvents")
preset_real_time = Cpt(EpicsSignal, "PresetReal")
preset_mode = Cpt(EpicsSignal, "PresetMode", string=True)
preset_triggers = Cpt(EpicsSignal, "PresetTriggers")
# Acquisition control
erase_all = Cpt(EpicsSignal, "EraseAll")
erase_start = Cpt(EpicsSignal, "EraseStart", put_complete=True, trigger_value=1)
start_all = Cpt(EpicsSignal, "StartAll", put_complete=True, trigger_value=1)
stop_all = Cpt(EpicsSignal, "StopAll")
# Status
set_acquire_busy = Cpt(EpicsSignal, "SetAcquireBusy")
acquire_busy = Cpt(EpicsSignal, "AcquireBusy")
status_all = Cpt(EpicsSignal, "StatusAll")
status_all_once = Cpt(EpicsSignal, "StatusAllOnce")
acquiring = Cpt(EpicsSignal, "Acquiring")
# Reading
read_all = Cpt(EpicsSignal, "ReadAll", kind=Kind.omitted)
read_all_once = Cpt(EpicsSignal, "ReadAllOnce", kind=Kind.omitted)
# As a debugging note, if snl_connected is not '1', your IOC is
# misconfigured:
snl_connected = Cpt(EpicsSignal, "SNL_Connected")
# High-level parameters
copy_decay_time = Cpt(EpicsSignal, "CopyDecayTime", kind=Kind.omitted)
copy_detection_filter = Cpt(EpicsSignal, "CopyDetectionFilter", kind=Kind.omitted)
copy_detection_threshold = Cpt(EpicsSignal, "CopyDetectionThreshold", kind=Kind.omitted)
copy_detector_polarity = Cpt(EpicsSignal, "CopyDetectorPolarity", kind=Kind.omitted)
copy_min_pulse_pair_separation = Cpt(
EpicsSignal, "CopyMinPulsePairSeparation", kind=Kind.omitted
)
copt_risetime_optimization = Cpt(EpicsSignal, "CopyRisetimeOptimization", kind=Kind.omitted)
copy_scale_factor = Cpt(EpicsSignal, "CopyScaleFactor", kind=Kind.omitted)
read_traces = Cpt(EpicsSignal, "ReadTraces", kind=Kind.omitted)
# ROI and SCA
copy_roi_channel = Cpt(EpicsSignal, "CopyROIChannel", kind=Kind.omitted)
copy_roi_energy = Cpt(EpicsSignal, "CopyROIEnergy", kind=Kind.omitted)
copy_roi_sca = Cpt(EpicsSignal, "CopyROI_SCA", kind=Kind.omitted)
# do_* executes the process:
do_read_all = Cpt(EpicsSignal, "DoReadAll", kind=Kind.omitted)
do_status_all = Cpt(EpicsSignal, "DoStatusAll", kind=Kind.omitted)
do_read_traces = Cpt(EpicsSignal, "DoReadTraces", kind=Kind.omitted)
# Statistics
dead_time = Cpt(EpicsSignal, "DeadTime")
idead_time = Cpt(EpicsSignal, "IDeadTime")
max_elapsed_live = Cpt(EpicsSignal, "MaxElapsedLive")
max_elapsed_real = Cpt(EpicsSignal, "MaxElapsedReal")
max_elapsed_trigger_live = Cpt(EpicsSignal, "MaxElapsedTriggerLive")
max_triggers = Cpt(EpicsSignal, "MaxTriggers")
max_events = Cpt(EpicsSignal, "MaxEvents")
max_input_count_rate = Cpt(EpicsSignal, "MaxInputCountRate")
max_output_count_rate = Cpt(EpicsSignal, "MaxOutputCountRate")
class EpicsDxpFalconMapping(EpicsDXPMapping):
"""Mapping mode parameters as defined in dxpMapping.template"""
auto_apply = None
apply = None
nd_array_mode = Cpt(EpicsSignalWithRBV, "NDArrayMode")
class Falcon(EpicsDXPFalconMultiElementSystem, EpicsDxpFalconMapping, ADBase):
"""Falcon base device"""
# attribute required by ADBase
port_name = ADCpt(EpicsSignalRO, "Asyn.PORT", string=True)
class EpicsDXPMultiElementSystem(_EpicsDXPMultiElementSystem):
"""System-wide parameters as defined in dxpMED.template"""
# Override some action signals, so calling `set`` method
# returns a waitable Status object. Otherwise the Status object is immediately done.
erase_start = Cpt(EpicsSignal, "EraseStart", put_complete=True, trigger_value=1)
start_all = Cpt(EpicsSignal, "StartAll", put_complete=True, trigger_value=1)
# mca.EpicsDXPMultiElementSystem maps the EPICS records under wrong names, i.e.
# copy_adcp_ercent_rule, copy_roic_hannel and copy_roie_nergy
copy_adc_percent_rule = Cpt(EpicsSignal, "CopyADCPercentRule")
copy_roi_channel = Cpt(EpicsSignal, "CopyROIChannel")
copy_roi_energy = Cpt(EpicsSignal, "CopyROIEnergy")
class Mercury(EpicsDXPMultiElementSystem, ADBase):
"""Mercury base device"""
# attribute required by ADBase
port_name = ADCpt(EpicsSignalRO, "Asyn.PORT", string=True)
class xMAP(EpicsDXPMultiElementSystem, EpicsDXPMapping, ADBase):
"""xMAP base device"""
# attribute required by ADBase
port_name = ADCpt(EpicsSignalRO, "Asyn.PORT", string=True)

View File

@ -0,0 +1,171 @@
"""
Base classes for XIA xMAP and FalconX dxp system.
Falcon interfaces with the dxpSITORO epics driver, https://github.com/epics-modules/dxpSITORO.
xMAP interfaces with the dxp epics driver, https://github.com/epics-modules/dxp.
An example usage for a 4-element FalconX system. ::
from ophyd import Component as Cpt
from ophyd_devices.devices.dxp import Falcon, EpicsMCARecord, EpicsDXPFalcon
from ophyd_devices.devices.areadetector.plugins import HDF5Plugin_V35 as HDF5Plugin
class FalconX4(Falcon):
# DXP parameters
dxp1 = Cpt(EpicsDXPFalcon, "dxp1:")
dxp2 = Cpt(EpicsDXPFalcon, "dxp2:")
dxp3 = Cpt(EpicsDXPFalcon, "dxp3:")
dxp4 = Cpt(EpicsDXPFalcon, "dxp4:")
# MCA record with spectrum data
mca1 = Cpt(EpicsMCARecord, "mca1")
mca2 = Cpt(EpicsMCARecord, "mca2")
mca3 = Cpt(EpicsMCARecord, "mca3")
mca4 = Cpt(EpicsMCARecord, "mca4")
# optionally with a HDF5 writer plugin
hdf = Cpt(HDF5Plugin, "HDF1:")
falcon = FalconX4("X07MB-SITORO:", name="falcon")
falcon.collect_mode.put(0) # 0: MCA spectra, 1: MCA mapping
falcon.preset_mode.put("Real time")
falcon.preset_real_time.put(1)
status = falcon.erase_start.set(1)
status.wait()
falcon.mca1.spectrum.get()
"""
from ophyd import Component as Cpt
from ophyd import Kind, EpicsSignal, EpicsSignalRO, Device
from ophyd.mca import (
EpicsMCARecord as _EpicsMCARecord,
EpicsDXPBaseSystem,
EpicsDXPMultiElementSystem,
EpicsDXPMapping,
)
from ophyd.areadetector import EpicsSignalWithRBV
__all__ = ("EpicsMCARecord", "EpicsDXPFalcon", "Falcon", "xMAP")
class EpicsMCARecord(_EpicsMCARecord):
"""EpicsMCARecord with addtional fields"""
calo = Cpt(EpicsSignal, ".CALO")
cals = Cpt(EpicsSignal, ".CALS")
calq = Cpt(EpicsSignal, ".CALQ")
tth = Cpt(EpicsSignal, ".TTH")
class EpicsDXPFalcon(Device):
"""All high-level DXP parameters for each channel"""
# Detection
detection_filter = Cpt(EpicsSignalWithRBV, "DetectionFilter")
detection_threshold = Cpt(EpicsSignalWithRBV, "DetectionThreshold")
min_pulse_pair_separation = Cpt(EpicsSignalWithRBV, "MinPulsePairSeparation")
# Pre-amp and energe range
detector_polarity = Cpt(EpicsSignalWithRBV, "DetectorPolarity")
decay_time = Cpt(EpicsSignalWithRBV, "DecayTime")
risetime_optimization = Cpt(EpicsSignalWithRBV, "RisetimeOptimization")
scale_factor = Cpt(EpicsSignalWithRBV, "ScaleFactor")
# Presets
preset_events = Cpt(EpicsSignalWithRBV, "PresetEvents")
preset_mode = Cpt(EpicsSignalWithRBV, "PresetMode", string=True)
preset_triggers = Cpt(EpicsSignalWithRBV, "PresetTriggers")
preset_real_time = Cpt(EpicsSignalWithRBV, "PresetReal")
# Couting statistics
elapsed_live_time = Cpt(EpicsSignalRO, "ElapsedLiveTime", lazy=True)
elapsed_real_time = Cpt(EpicsSignalRO, "ElapsedRealTime", lazy=True)
elapsed_trigger_live = Cpt(EpicsSignalRO, "ElapsedTriggerLiveTime", lazy=True)
triggers = Cpt(EpicsSignalRO, "Triggers", lazy=True)
events = Cpt(EpicsSignalRO, "Events", lazy=True)
input_count_rate = Cpt(EpicsSignalRO, "InputCountRate", lazy=True)
output_count_rate = Cpt(EpicsSignalRO, "OutputCountRate", lazy=True)
# Mapping
current_pixel = Cpt(EpicsSignal, "CurrentPixel")
# Diagnostic trace
trace_data = Cpt(EpicsSignal, "TraceData")
class EpicsDXPFalconMultiElementSystem(EpicsDXPBaseSystem):
# Preset control
preset_events = Cpt(EpicsSignal, "PresetEvents")
preset_real_time = Cpt(EpicsSignal, "PresetReal")
preset_mode = Cpt(EpicsSignal, "PresetMode", string=True)
preset_triggers = Cpt(EpicsSignal, "PresetTriggers")
# Acquisition control
erase_all = Cpt(EpicsSignal, "EraseAll")
erase_start = Cpt(EpicsSignal, "EraseStart", put_complete=True, trigger_value=1)
start_all = Cpt(EpicsSignal, "StartAll", put_complete=True, trigger_value=1)
stop_all = Cpt(EpicsSignal, "StopAll")
# Status
set_acquire_busy = Cpt(EpicsSignal, "SetAcquireBusy")
acquire_busy = Cpt(EpicsSignal, "AcquireBusy")
status_all = Cpt(EpicsSignal, "StatusAll")
status_all_once = Cpt(EpicsSignal, "StatusAllOnce")
acquiring = Cpt(EpicsSignal, "Acquiring")
# Reading
read_all = Cpt(EpicsSignal, "ReadAll", kind=Kind.omitted)
read_all_once = Cpt(EpicsSignal, "ReadAllOnce", kind=Kind.omitted)
# As a debugging note, if snl_connected is not '1', your IOC is
# misconfigured:
snl_connected = Cpt(EpicsSignal, "SNL_Connected")
# High-level parameters
copy_decay_time = Cpt(EpicsSignal, "CopyDecayTime", kind=Kind.omitted)
copy_detection_filter = Cpt(EpicsSignal, "CopyDetectionFilter", kind=Kind.omitted)
copy_detection_threshold = Cpt(EpicsSignal, "CopyDetectionThreshold", kind=Kind.omitted)
copy_detector_polarity = Cpt(EpicsSignal, "CopyDetectorPolarity", kind=Kind.omitted)
copy_min_pulse_pair_separation = Cpt(
EpicsSignal, "CopyMinPulsePairSeparation", kind=Kind.omitted
)
copt_risetime_optimization = Cpt(EpicsSignal, "CopyRisetimeOptimization", kind=Kind.omitted)
copy_scale_factor = Cpt(EpicsSignal, "CopyScaleFactor", kind=Kind.omitted)
read_traces = Cpt(EpicsSignal, "ReadTraces", kind=Kind.omitted)
# ROI and SCA
copy_roic_hannel = Cpt(EpicsSignal, "CopyROIChannel", kind=Kind.omitted)
copy_roie_nergy = Cpt(EpicsSignal, "CopyROIEnergy", kind=Kind.omitted)
copy_roi_sca = Cpt(EpicsSignal, "CopyROI_SCA", kind=Kind.omitted)
# do_* executes the process:
do_read_all = Cpt(EpicsSignal, "DoReadAll", kind=Kind.omitted)
do_status_all = Cpt(EpicsSignal, "DoStatusAll", kind=Kind.omitted)
do_read_traces = Cpt(EpicsSignal, "DoReadTraces", kind=Kind.omitted)
# Statistics
dead_time = Cpt(EpicsSignal, "DeadTime")
idead_time = Cpt(EpicsSignal, "IDeadTime")
max_elapsed_live = Cpt(EpicsSignal, "MaxElapsedLive")
max_elapsed_real = Cpt(EpicsSignal, "MaxElapsedReal")
max_elapsed_trigger_live = Cpt(EpicsSignal, "MaxElapsedTriggerLive")
max_triggers = Cpt(EpicsSignal, "MaxTriggers")
max_events = Cpt(EpicsSignal, "MaxEvents")
max_input_count_rate = Cpt(EpicsSignal, "MaxInputCountRate")
max_output_count_rate = Cpt(EpicsSignal, "MaxOutputCountRate")
class EpicsDxpFalconMapping(EpicsDXPMapping):
auto_apply = None
apply = None
nd_array_mode = Cpt(EpicsSignalWithRBV, "NDArrayMode")
class Falcon(EpicsDXPFalconMultiElementSystem, EpicsDxpFalconMapping): ...
class xMAP(EpicsDXPMultiElementSystem, EpicsDXPMapping):
# Override signals from EpicsDXPMultiElementSystem, so calling `set`` method
# returns a waitable Status object. Otherwise the Status object is immediately done.
erase_start = Cpt(EpicsSignal, "EraseStart", put_complete=True, trigger_value=1)
start_all = Cpt(EpicsSignal, "StartAll", put_complete=True, trigger_value=1)

View File

@ -65,7 +65,7 @@ from ophyd import Device, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV
# import ophyd.mca as Mca
from .sitoro import (
from ..sitoro import (
SitoroEpicsMCARecord,
SitoroEpicsMCA,
SitoroEpicsMCAReadNotify,

View File

@ -0,0 +1,380 @@
"""
Implementation for falcon at PHOENIX, derived from
implementation on csaxs (file falcon_csaxs.py)
17.10.2024 try to streamline implementation with mca record
Differences to implement
1) we consider EPICS initialization as standard implementaion,
so no reinitialization when bec device is initrialized ... DONE ...
2) in EpicsDXPFalcon(Device) add ICR and OCR for individual detectors
3) can we make this generic to make it suited for both falcon and XMAP ?
3) make easy switching between mca spectra an mca mapping
fix defiend relation bwetween variables and names used here for example DONE
aquiring is currently called 'state' --> should be renamed to aquiring
Currently state = Cpt(EpicsSignal, "Acquiring")
should be acquiring = Cpt(EpicsSignal, "Acquiring")
hdf5 = Cpt(FalconHDF5Plugins, "HDF1:")
def arm_aquisition
raise FalconTimeoutError(
f"Failed to arm the acquisition. Detector state {signal_conditions[0][0]}"
)
CHANGES LOG and
System as taken from cSAXS some times works for one element need about 7 second
There seem to be still serious timout issues
changes log
TIMEOUT_FOR_SIGNALs from 5 to 10
"""
import enum
import os
import threading
import time
from bec_lib.logger import bec_logger
from ophyd import Component as Cpt
from ophyd import Device, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV
# from ophyd_devices.devices.dxp import Falcon, EpicsMCARecord, EpicsDXPFalcon
from phoenix_bec.devices.dxp_loc import Falcon, EpicsMCARecord, EpicsDXPFalcon
from ophyd_devices.devices.areadetector.plugins import HDF5Plugin_V35 as HDF5Plugin #
from ophyd_devices.interfaces.base_classes.psi_detector_base import (
CustomDetectorMixin,
PSIDetectorBase,
)
logger = bec_logger.logger
class FalconError(Exception):
"""Base class for exceptions in this module."""
class FalconTimeoutError(FalconError):
"""Raised when the Falcon does not respond in time."""
class DetectorState(enum.IntEnum):
"""Detector states for Falcon detector"""
DONE = 0
ACQUIRING = 1
class TriggerSource(enum.IntEnum):
"""Trigger source for Falcon detector"""
USER = 0
GATE = 1
SYNC = 2
class MappingSource(enum.IntEnum):
"""Mapping source for Falcon detector"""
SPECTRUM = 0
MAPPING = 1
class FalconSetup(CustomDetectorMixin):
"""
Falcon setup class for Phoenix
Parent class: CustomDetectorMixin
"""
# Specify which functions are revealed to the user in BEC client
USER_ACCESS = ["My_routine"]
def __init__(self, *args, parent: Device = None, **kwargs) -> None:
super().__init__(*args, parent=parent, **kwargs)
self._lock = threading.RLock()
def on_init(self) -> None:
"""Initialize Falcon detector"""
# self.initialize_default_parameter()
# self.initialize_detector()
# self.initialize_detector_backend()
def initialize_default_parameter(self) -> None:
"""
Set default parameters for Falcon
This will set:
- readout (float): readout time in seconds
- value_pixel_per_buffer (int): number of spectra in buffer of Falcon Sitoro
"""
# self.parent.value_pixel_per_buffer = 20
self.update_readout_time()
def update_readout_time(self) -> None:
"""Set readout time for Eiger9M detector"""
readout_time = (
self.parent.scaninfo.readout_time
if hasattr(self.parent.scaninfo, "readout_time")
else self.parent.MIN_READOUT
)
self.parent.readout_time = max(readout_time, self.parent.MIN_READOUT)
def initialize_detector(self) -> None:
"""Initialize Falcon detector"""
pass
"""
THIS IS THE OLD CSACS CODE. uncomment for now, as we consider EPICS as the boss
for initialization
self.stop_detector()
self.stop_detector_backend()
self.set_trigger(
mapping_mode=MappingSource.MAPPING, trigger_source=TriggerSource.GATE, ignore_gate=0
)
# 1 Realtime
self.parent.preset_mode.put(1)
# 0 Normal, 1 Inverted
self.parent.input_logic_polarity.put(0)
# 0 Manual 1 Auto
self.parent.auto_pixels_per_buffer.put(0)
# Sets the number of pixels/spectra in the buffer
self.parent.pixels_per_buffer.put(self.parent.value_pixel_per_buffer)
"""
def initialize_detector_backend(self) -> None:
"""Initialize the detector backend for Falcon."""
self.parent.hdf5.enable.put(1)
# file location of h5 layout for cSAXS
self.parent.hdf5.xml_file_name.put("layout.xml")
# TODO Check if lazy open is needed and wanted!
self.parent.hdf5.lazy_open.put(1)
self.parent.hdf5.temp_suffix.put("")
# size of queue for number of spectra allowed in the buffer,
# if too small at high throughput, data is lost
self.parent.hdf5.queue_size.put(2000)
# Segmentation into Spectra within EPICS, 1 is activate, 0 is deactivate
self.parent.nd_array_mode.put(1)
def on_stage(self) -> None:
"""Prepare detector and backend for acquisition"""
self.prepare_detector()
self.prepare_data_backend()
self.publish_file_location(done=False, successful=False)
self.arm_acquisition()
def prepare_detector(self) -> None:
"""Prepare detector for acquisition"""
self.set_trigger(
mapping_mode=MappingSource.MAPPING, trigger_source=TriggerSource.GATE, ignore_gate=0
)
self.parent.preset_real.put(self.parent.scaninfo.exp_time)
self.parent.pixels_per_run.put(
int(self.parent.scaninfo.num_points * self.parent.scaninfo.frames_per_trigger)
)
def prepare_data_backend(self) -> None:
"""Prepare data backend for acquisition"""
self.parent.filepath.set(
self.parent.filewriter.compile_full_filename(f"{self.parent.name}.h5")
).wait()
file_path, file_name = os.path.split(self.parent.filepath.get())
self.parent.hdf5.file_path.put(file_path)
self.parent.hdf5.file_name.put(file_name)
self.parent.hdf5.file_template.put("%s%s")
self.parent.hdf5.num_capture.put(
int(self.parent.scaninfo.num_points * self.parent.scaninfo.frames_per_trigger)
)
self.parent.hdf5.file_write_mode.put(2)
# Reset spectrum counter in filewriter, used for indexing & identifying missing triggers
self.parent.hdf5.array_counter.put(0)
# Start file writing
self.parent.hdf5.capture.put(1)
def arm_acquisition(self) -> None:
"""Arm detector for acquisition"""
self.parent.start_all.put(1)
signal_conditions = [
(
lambda: self.parent.acquiring.read()[self.parent.acquiring.name]["value"],
DetectorState.ACQUIRING,
)
]
if not self.wait_for_signals(
signal_conditions=signal_conditions,
timeout=self.parent.TIMEOUT_FOR_SIGNALS,
check_stopped=True,
all_signals=False,
):
raise FalconTimeoutError(
f"Failed to arm the acquisition. Detector state {signal_conditions[0][0]}"
)
def on_unstage(self) -> None:
"""Unstage detector and backend"""
pass
def on_complete(self) -> None:
"""Complete detector and backend"""
self.finished(timeout=self.parent.TIMEOUT_FOR_SIGNALS)
self.publish_file_location(done=True, successful=True)
def on_stop(self) -> None:
"""Stop detector and backend"""
self.stop_detector()
self.stop_detector_backend()
def stop_detector(self) -> None:
"""Stops detector"""
self.parent.stop_all.put(1)
time.sleep(0.5)
self.parent.erase_all.put(1)
time.sleep(0.5)
signal_conditions = [
(
lambda: self.parent.acquiring.read()[self.parent.acquiring.name]["value"],
DetectorState.DONE,
)
]
if not self.wait_for_signals(
signal_conditions=signal_conditions,
timeout=self.parent.TIMEOUT_FOR_SIGNALS - self.parent.TIMEOUT_FOR_SIGNALS // 2,
all_signals=False,
):
# Retry stop detector and wait for remaining time
raise FalconTimeoutError(
f"Failed to stop detector, timeout with state {signal_conditions[0][0]}"
)
def stop_detector_backend(self) -> None:
"""Stop the detector backend"""
self.parent.hdf5.capture.put(0)
def finished(self, timeout: int = 5) -> None:
"""Check if scan finished succesfully"""
with self._lock:
total_frames = int(
self.parent.scaninfo.num_points * self.parent.scaninfo.frames_per_trigger
)
signal_conditions = [
(self.parent.dxp.current_pixel.get, total_frames),
(self.parent.hdf5.array_counter.get, total_frames),
]
if not self.wait_for_signals(
signal_conditions=signal_conditions,
timeout=timeout,
check_stopped=True,
all_signals=True,
):
logger.debug(
f"Falcon missed a trigger: received trigger {self.parent.dxp.current_pixel.get()},"
f" send data {self.parent.hdf5.array_counter.get()} from total_frames"
f" {total_frames}"
)
self.stop_detector()
self.stop_detector_backend()
def set_trigger(
self, mapping_mode: MappingSource, trigger_source: TriggerSource, ignore_gate: int = 0
) -> None:
"""
Set triggering mode for detector
Args:
mapping_mode (MappingSource): Mapping mode for the detector
trigger_source (TriggerSource): Trigger source for the detector, pixel_advance_signal
ignore_gate (int): Ignore gate from TTL signal; defaults to 0
"""
mapping = int(mapping_mode)
trigger = trigger_source
self.parent.collect_mode.put(mapping)
self.parent.pixel_advance_mode.put(trigger)
self.parent.ignore_gate.put(ignore_gate)
def My_routine(self):
print("My routine in Falcon mixing class ")
class FalconPhoenix(PSIDetectorBase, Falcon):
"""
FalconX4 Sitoro detector for Phoenixdef My_routine(self):
print('My_routine')
Parent class: PSIDetectorBase, Falcon
class attributes:
custom_prepare_cls (FalconSetup) : Custom detector setup class for cSAXS,
inherits from CustomDetectorMixin
PSIDetectorBase.set_min_readout (float) : Minimum readout time for the detector
dxp<n> (EpicsDXPFalcon) : DXP parameters for Falcon detector
mca<n> (EpicsMCARecord) : MCA parameters for Falcon detector
hdf5 (FalconHDF5Plugins) : HDF5 parameters for Falcon detector
MIN_READOUT (float)"""
# Specify which functions are revealed to the user in BEC client
USER_ACCESS = ["describe", "help"]
# specify Setup class
custom_prepare_cls = FalconSetup
# specify minimum readout time for detector
MIN_READOUT = 3e-3
TIMEOUT_FOR_SIGNALS = 1
# specify class attributes
# DXP parameters
dxp1 = Cpt(EpicsDXPFalcon, "dxp1:")
# dxp2 = Cpt(EpicsDXPFalcon, "dxp2:")
# dxp3 = Cpt(EpicsDXPFalcon, "dxp3:")
# dxp4 = Cpt(EpicsDXPFalcon, "dxp4:")
# MCA record with spectrum data
mca1 = Cpt(EpicsMCARecord, "mca1")
# mca2 = Cpt(EpicsMCARecord, "mca2")
# mca3 = Cpt(EpicsMCARecord, "mca3")
# mca4 = Cpt(EpicsMCARecord, "mca4")
# optionally with a HDF5 writer plugin
# hdf5 = Cpt(HDF5Plugin, "HDF1:")
def help(self):
help_text = """
PHOENIX FALCON
"""
print(help_text)
if __name__ == "__main__":
falcon = FalconPhoenix(name="falcon_hdf5", prefix="X07MB-SITORO:", sim_mode=True)

View File

@ -0,0 +1,433 @@
"""
This module serve to test whether we can abuse the device concept to
Define the scan logic in a device which collects EPICS Channels whic operate the
dat aaquisition from several devices, such as
such as trigger channel, xmap falcon, etc.
Aim is to define the data aquisition logic in the on_trigger() routine in this file,
but leave data reading in the device definitions.
Hops is to create an easy to maintain/ edit setup.
The module is bases on the PhoenixTrigger class to connect to the ADC card
that creates TTL signals to trigger cameras and detectors at Phoenix.
TO Do
-- allow for variable dwell times
-- add erase/Start for XMAP and FALCON
-- check values for time.sleep()
-- check in on_triggerthe status check for Falcon
-- rework togther with Xiaoquiang the functionality of involved EPICS channels
(Callbacks etc.) to minimize the need of sleeping times.
"""
import enum
import time
import numpy as np
from bec_lib import bec_logger
from ophyd import Component as Cpt
from ophyd import DeviceStatus, EpicsSignal, EpicsSignalRO, Kind, Device
from ophyd_devices.interfaces.base_classes.psi_detector_base import (
CustomDetectorMixin,
PSIDetectorBase,
)
from ophyd_devices.devices.dxp import xMAP
#, EpicsMCARecord
#from phoenix_bec.scripts.phoenix import PhoenixBL
logger = bec_logger.logger
DETECTOR_TIMEOUT = 5
"""
#class ph_Logger():
# PHOENIX Logger to my Logfile #
# p_s = PhoenixBL.my_log
"""
class PhoenixTriggerError(Exception):
"""PhoenixTrigger specific error"""
class SAMPLING(int, enum.Enum):
"""Sampling Done PV
This class serves redabilty of missinx class and ensure correct setting of
certain conditions.
defiend preset values for certain states to be called in the
mixing class, where we for example check whether the sampling is done of not
by comparing with SAMPLING.DONE
xxx==SAMPLING.DONE
"""
RUNNING = 0
DONE = 1
class PhoenixScan_1Setup(CustomDetectorMixin):
"""
Mixin Class to setup the PhoenixTrigger device
"""
def on_stage(self) -> None:
"""
On stage actions which are executed upon staging the device
"""
if self.parent.scaninfo.scan_type == "step": # check whether we use step scanning
###############
# next lines ensure that TTL trigger is on single sampling mode (posible )
##############
self.parent.start_csmpl.set(0)
time.sleep(0.1)
self.parent.total_cycles.set(1)
self.parent.smpl.put(1)
time.sleep(0.5)
#####
# set sampling to dwell time of scan
######
self.parent.total_cycles.set(np.ceil(self.parent.scaninfo.exp_time * 5))
logger.info(f"Device {self.parent.name} was staged for step scan")
def on_unstage(self) -> None:
"""On unstage actions which are executed upon unstaging the device"""
self.on_stop()
def on_trigger(self) -> DeviceStatus:
"""On trigger actions which are executed upon triggering the device"""
# TODO Test the proper check for the falcon state
# Check first that falcon is set to acquiring
# check for falcon
print('on_trigger')
falcon = self.parent.device_manager.devices.get("falcon", None) # get device
timeout = 20
print('ss')
print('Check for falcon')
if falcon is not None:
# TODO Check that falcon.aquiring.get() == 1 is the correct check.
# --> When is the falcon acquiring, this assumes 1?
# self.wait_for_signals is defined in PSI_detector_base.CustomDetectorMixin
# ALSO check for enabled or not here!!!
#
if not self.wait_for_signals([(falcon.acquiring.get, 1)], timeout=timeout):
raise PhoenixTriggerError(
f"Device {self.parent.name} is not ready to take trigger, timeout due to waiting for Falcon to get ready. Timeout after {timeout}s"
)
#endif
else:
print('Falcon is None')
#endif
print(self.parent.simulate_step_logic)
if ( self.parent.scaninfo.scan_type == "step") or self.parent.simulate_step_logic==True:
print('stepscan')
time.sleep(0.2)
self.parent.smpl.put(1)
self.parent.xmap_erase_start.put(1)
# Minimum of 1 cycle has to be waited. Cycle == 0.2s
time.sleep(0.2)
# Trigger function from ophyd.Device returns a DeviceStatus. This function
# starts a process that creates a DeviceStatus, and waits for the signal_conditions
# self.parent.smpl_done.get to change to the value SAMPLING.DONE
# Once this takes place, the DeviceStatus.done flag will be set to True.
# When BEC calls trigger() on the devices, this method will be called assuming that
# the devices config softwareTrigger=True is set.
# In ScanBase, the _at_each_point function calls
# self.stubs.wait(wait_type="trigger", group="trigger", wait_time=self.exp_time)
# which ensures that the DeviceStatus object resolves before continuing,
# i.e. DeviceStatus.done = True
#calling this does not seem to wait, but seem sto call on_stop
#status = self.wait_with_status(
# signal_conditions=[(self.parent.smpl_done.get, SAMPLING.DONE)],
# timeout=5 * self.parent.scaninfo.exp_time, # Check if timeout is appropriate
# check_stopped=True,
#)
print('dd',self.parent.smpl_done.get())
# explanation of last line (self.parent.smpl_done.get, SAMPLINGDONE.DONE)
# creates a tuple which defines a
# condition, which is tested in self.wait_with_status, here it tests for :
# (self.parent.smpl_done.get() == SAMPLINGDONE.DONE),
# where SAMPLINGDONE.DONE =1, as set in code above
# As this is in mixing class (PhoenixtriggerSetup), parent.sample_done is defined in
# main class as smpl_done = Cpt(EpicsSignalRO, "SMPL-DONE", kind=Kind.config)
# the wait for status did not work so explicit, make own routine later
#ii=0
#while (self.parent.smpl_done.get() == 0 and ii< 10000):
# time.sleep(0.05)
# ii=ii+1
# print(ii,self.parent.smpl_done.get())
##endwhile
self.parent.xmap_stop_all.put(1)
print('leave on trigger')
time.sleep(4)
return
#return status # should this be in if clause level or outside?
# endif
def on_stop(self) -> None:
"""
Actions to stop the Device
Here the device is switched back to continuous sampling.
"""
print('phoenix_scan_1 on_stop')
self.parent.total_cycles.set(5)
self.parent.start_csmpl.set(1)
time.sleep(0.5)
self.parent.smpl.put(1)
time.sleep(0.5)
self.parent.smpl.put(1)
time.sleep(0.2)
if self.parent.smpl_done.get() == SAMPLING.RUNNING:
return
self.parent.smpl.put(1)
class PhoenixScan_1(PSIDetectorBase):
"""
Class for PHOENIX TTL hardware trigger: 'X07MB-OP2:'
This device is used to trigger communicate with an ADC card
that creates TTL signals to trigger cameras and detectors at Phoenix.
"""
##################################################################
#
# The Variable USER_ACCESS contains an ascii list of functions which will be
# visible in dev.TTL. Here, this list is empty.
# note that components are alway public
#
##################################################################
USER_ACCESS = ["describe", "help"]
####################################################################
#
# # specify Setup class into variable custom_prepare_cls
#
####################################################################
custom_prepare_cls = PhoenixScan_1Setup
###################################################################
# in __init__ of PSIDetectorBase will the initialzed by
# self.custom_prepare = self.custom_prepare_cls(parent=self, **kwargs)
# making the instance of PSIDetectorBase availble to functions
# in PhoenixTriggerSetup.
#
# This inherits, among other things, the input parameters, such as
# the notable prefix, which is here 'X07MB-OP2:'
#
# The input of Component=Cpt is Cpt(deviceClass,suffix)
# if Cpt is used in a class, which has interited Device, here via:
#
# (Here PhoenixTrigger <-- PSIDetectorBase <- Device
#
# intr_count = Cpt(
# EpicsSignal, "INTR-COUN
# then Cpt will construct - magically- the
# Epics channel name = prefix+suffix,
#
# for example
# 'X07MB-OP2:' + 'START-CSMPL' -> 'X07MB-OP2:' + 'START-CSMPL'
#
# to construct names, for now we keep the convention to derive
# them from the EPICS NAMES (such as ) X07MB-OP2:SMPL-DONE --> smpl_done
#
# this mean access to channel using dev.PH_TTL.smpl_done.get()
#
#
###################################################################
simulate_step_logic=True # set to true for debugging should be false in operation
# SIGNALS FOR TRIGGER
start_csmpl = Cpt(
EpicsSignal, "START-CSMPL", kind=Kind.config, put_complete=True
) # cont on / off
# intr_count = Cpt(
# EpicsSignal, "INTR-COUNT", kind=Kind.config, put_complete=True
# ) # conter run up
intr_count = Cpt(EpicsSignal, "INTR-COUNT") # counter run up NEEDS TO BE READ OUT !!!!
total_cycles = Cpt(
EpicsSignal, "TOTAL-CYCLES", kind=Kind.config, put_complete=True
) # cycles set
smpl = Cpt(
EpicsSignal, "SMPL", kind=Kind.config, put_complete=True
) # start sampling --> aquire
csmpl = Cpt(
EpicsSignal, "START-CSMPL", kind=Kind.config, put_complete=True
) # start sampling --> aquire
smpl_done = Cpt(
EpicsSignalRO, "SMPL-DONE", kind=Kind.config
) # show trigger is done, consider using string=True
# create subset in name spacs
ph_start_csmpl = start_csmpl
ph_intr_count = intr_count
ph_total_cycles = total_cycles
ph_smpl = smpl
ph_csmpl = csmpl
ph_smpl_done = smpl_done
##################################################################
# channels for xmap
##################################################################
class xmap_local(Device):
"""
subclass to PhoenixScan_1
local class for xmap controll
consider importing general xmap setup ??
less channels might be less risk free and faster!
cannot import on higher level as it takes wron prefix,
possibly import here and set prefic in def __init__
for now we keep it simple
"""
erase_start = Cpt(EpicsSignal,'EraseStart',kind=Kind.config)
start_all = Cpt(EpicsSignal,'StartAll',kind=Kind.config)
stop_all = Cpt(EpicsSignal,'StopAll',kind=Kind.config)
erase_all = Cpt(EpicsSignal,'EraseAll',kind=Kind.config)
acquiring = Cpt(EpicsSignal,'Acquiring',kind=Kind.config)
#endclass
xmap_control=xmap_local(name='ddd',prefix='X07MB-XMAP:')
xmap_erase_start = xmap_control.erase_start
xmap_start_all = xmap_control.start_all
xmap_stop_all = xmap_control.stop_all
xmap_erase_all = xmap_control.erase_all
xmap_acquiring = xmap_control.acquiring
ph_xmap_erase_start = xmap_erase_start
ph_xmap_start_all = xmap_start_all
ph_xmap_stop_all = xmap_stop_all
ph_xmap_erase_all = xmap_erase_all
ph_xmap_aquiring = xmap_acquiring
def help(self):
"""
Help function for phoenix_trigger
"""
help_text = """
PHOENIXScan_1
HELP NT CORRECT NEEDSA to be updated
signal attributes vs Epics Channels
description device Epics Channel
attribute
Cont sampling on/off .start_csmpl ~ X07MB-OP2:SMPL
1: continous
0: continous off
Counter run up .intr_count ~ " :INTR-COUNT
Cycles set .total_cycles ~ " :TOTAL-CYCLES
1 cycle = 200 ms
Start sampling (aquiring) .smpl ~ " :SMPL
Show trigger is done .smpl_done ~ " :SMPL-DONE
1: aquiring
0: not aquiring
Assuming device is called dev.PH_TTL
Read Channel dev.PH_TTL.start_csmpl.get()
Write into Channel dev.PH_TTL.total_cycles.put(1)
dev.PH_TTL.total_cycles.set(1)
For further general help try the attributes
.describe() considered as stable dict
.describe_confguration()
.summary()
._config ._info
Important channel are collected with prefix ph, to ease finding of the channels
for example
dev.PH_TTl.ph_total_cycles = dev.PH_TTl.total_cycles
.. etc
"""
print("Name of device is", self.name)
print("")
print(help_text)
# end def help
if __name__ == "__main__":
# Test the PhoenixTrigger class
trigger = PhoenixScan_1(name="Scan_1", prefix="X07MB-OP2:")
trigger.wait_for_connection(all_signals=True)
trigger.read()
trigger.read_configuration()
trigger.stage()
device_status = trigger.trigger()
device_status.wait()
trigger.unstage()

View File

@ -24,11 +24,18 @@ from ophyd_devices.interfaces.base_classes.psi_detector_base import (
CustomDetectorMixin,
PSIDetectorBase,
)
#from phoenix_bec.scripts.phoenix import PhoenixBL
logger = bec_logger.logger
DETECTOR_TIMEOUT = 5
"""
#class ph_Logger():
# PHOENIX Logger to my Logfile #
# p_s = PhoenixBL.my_log
"""
class PhoenixTriggerError(Exception):
"""PhoenixTrigger specific error"""
@ -56,6 +63,7 @@ class PhoenixTriggerSetup(CustomDetectorMixin):
"""
def on_stage(self) -> None:
"""
@ -89,18 +97,53 @@ class PhoenixTriggerSetup(CustomDetectorMixin):
# TODO Test the proper check for the falcon state
# Check first that falcon is set to acquiring
falcon = self.parent.device_manager.devices.get("falcon_nohdf5", None) # get device
timeout = 1
# check for falcon
print('on_trigger')
falcon = self.parent.device_manager.devices.get("falcon", None) # get device
timeout = 20
print('ss')
if falcon is not None:
# TODO Check that falcon.state.get() == 1 is the correct check.
# TODO Check that falcon.aquiring.get() == 1 is the correct check.
# --> When is the falcon acquiring, this assumes 1?
# self.wait_for_signals is defined in PSI_detector_base.CustomDetectorMixin
# ALSO check for enabled or not here!!!
#
if not self.wait_for_signals([(falcon.state.get, 1)], timeout=timeout):
if not self.wait_for_signals([(falcon.acquiring.get, 1)], timeout=timeout):
raise PhoenixTriggerError(
f"Device {self.parent.name} is not ready to take trigger, timeout due to waiting for Falcon to get ready. Timeout after {timeout}s"
)
#endif
#endif
xmap = self.parent.device_manager.devices.get("xmap", None) # get device
timeout = 20 # 21.17 change to 20 sec
print('ss2')
if xmap is not None:
print('xmap erase start')
xmap.erase_start.put(1) # .. should be in phoenix_xmap?
print('xmap erase start')
ww=xmap.acquiring.get()
print(ww)
time.sleep(0.1)
w2=xmap.acquiring.get()
print(w2)
if not self.wait_for_signals([(xmap.acquiring.get, 1)], timeout=timeout):
raise PhoenixTriggerError(
f"Device {self.parent.name} is not ready to take trigger, timeout due to waiting for xmap to get ready. Timeout after {timeout}s"
)
if self.parent.scaninfo.scan_type == "step":
time.sleep(0.2)
@ -174,7 +217,7 @@ class PhoenixTrigger(PSIDetectorBase):
#
##################################################################
USER_ACCESS = []
USER_ACCESS = ["describe", "help"]
####################################################################
#
@ -198,6 +241,8 @@ class PhoenixTrigger(PSIDetectorBase):
#
# (Here PhoenixTrigger <-- PSIDetectorBase <- Device
#
# intr_count = Cpt(
# EpicsSignal, "INTR-COUN
# then Cpt will construct - magically- the
# Epics channel name = prefix+suffix,
#
@ -215,9 +260,13 @@ class PhoenixTrigger(PSIDetectorBase):
start_csmpl = Cpt(
EpicsSignal, "START-CSMPL", kind=Kind.config, put_complete=True
) # cont on / off
intr_count = Cpt(
EpicsSignal, "INTR-COUNT", kind=Kind.config, put_complete=True
) # conter run up
# intr_count = Cpt(
# EpicsSignal, "INTR-COUNT", kind=Kind.config, put_complete=True
# ) # conter run up
intr_count = Cpt(EpicsSignal, "INTR-COUNT") # counter run up NEEDS TO BE READ OUT !!!!
total_cycles = Cpt(
EpicsSignal, "TOTAL-CYCLES", kind=Kind.config, put_complete=True
) # cycles set
@ -229,10 +278,74 @@ class PhoenixTrigger(PSIDetectorBase):
) # show trigger is done, consider using string=True
ph_start_csmpl = start_csmpl
ph_intr_count = intr_count
ph_total_cycles = total_cycles
ph_smpl = smpl
ph_smpl_done = smpl_done
# create subset in name spacs
def help(self):
"""
Help function for phoenix_trigger
"""
help_text = """
PHOENIX TRIGGER
signal attributes vs Epics Channels
description device Epics Channel
attribute
Cont sampling on/off .start_csmpl ~ X07MB-OP2:SMPL
1: continous
0: continous off
Counter run up .intr_count ~ " :INTR-COUNT
Cycles set .total_cycles ~ " :TOTAL-CYCLES
1 cycle = 200 ms
Start sampling (aquiring) .smpl ~ " :SMPL
Show trigger is done .smpl_done ~ " :SMPL-DONE
1: aquiring
0: not aquiring
Assuming device is called dev.PH_TTL
Read Channel dev.PH_TTL.start_csmpl.get()
Write into Channel dev.PH_TTL.total_cycles.put(1)
dev.PH_TTL.total_cycles.set(1)
For further general help try the attributes
.describe() considered as stable dict
.describe_confguration()
.summary()
._config ._info
Important channel are collected with prefix ph, to ease finding of the channels
for example
dev.PH_TTl.ph_total_cycles = dev.PH_TTl.total_cycles
.. etc
"""
print("Name of device is", self.name)
print("")
print(help_text)
# end def help
if __name__ == "__main__":
# Test the PhoenixTrigger class
trigger = PhoenixTrigger(name="trigger", prefix="X07MB-OP2:")
trigger.wait_for_connection(all_signals=True)
trigger.read()

View File

@ -0,0 +1,366 @@
#
#
# changes version for PHOENIX WITHOUT HDF5 plugin to be revised/renamed...
#
#
import enum
import os
import threading
import time
from bec_lib.logger import bec_logger
from ophyd import Component as Cpt
from ophyd import Device, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV
from ophyd.mca import EpicsMCARecord
from ophyd_devices.interfaces.base_classes.psi_detector_base import (
CustomDetectorMixin,
PSIDetectorBase,
)
from ophyd.mca import EpicsDXP
from ophyd_devices.devices.dxp import xMAP, EpicsMCARecord
#from phoenix_bec.devices.dxp_loc import xMAP, EpicsMCARecord
from ophyd_devices.devices.areadetector.plugins import HDF5Plugin_V35 as HDF5Plugin
logger = bec_logger.logger
# bec_logger.level = bec_logger.LOGLEVEL.TRACE
bec_logger.level = bec_logger.LOGLEVEL.INFO
class XMAPError(Exception):
"""Base class for exceptions in this module."""
class XMAPTimeoutError(XMAPError):
"""Raised when the XMAP does not respond in time."""
class DetectorState(enum.IntEnum):
"""Detector states for XMAP detector"""
DONE = 0
ACQUIRING = 1
class TriggerSource(enum.IntEnum):
"""Trigger source for XMAP detector"""
USER = 0
GATE = 1
SYNC = 2
class MappingSource(enum.IntEnum):
"""Mapping source for XMAP detector"""
SPECTRUM = 0
MAPPING = 1
class XMAPSetup(CustomDetectorMixin):
"""
XMAP setup class for phoenix
Parent class: CustomDetectorMixin
"""
def __init__(self, *args, parent: Device = None, **kwargs) -> None:
super().__init__(*args, parent=parent, **kwargs)
self._lock = threading.RLock()
def on_init(self) -> None:
"""Initialize XMAP detector"""
self.initialize_default_parameter()
self.initialize_detector()
self.initialize_detector_backend()
def initialize_default_parameter(self) -> None:
"""
Set default parameters for XMAP
This will set:
- readout (float): readout time in seconds
- value_pixel_per_buffer (int): number of spectra in buffer of XMAP
"""
# self.parent.value_pixel_per_buffer = 20
# self.update_readout_time()
pass
def update_readout_time(self) -> None:
"""Set readout time for Eiger9M detector"""
"""
readout_time = (
self.parent.scaninfo.readout_time
if hasattr(self.parent.scaninfo, "readout_time")
else self.parent.MIN_READOUT
)
self.parent.readout_time = max(readout_time, self.parent.MIN_READOUT)
"""
def initialize_detector(self) -> None:
"""Initialize XMAP detector"""
"""
self.stop_detector()
self.stop_detector_backend()
self.set_trigger(
mapping_mode=MappingSource.MAPPING, trigger_source=TriggerSource.GATE, ignore_gate=0
)
# 1 Realtime
self.parent.preset_mode.put(1)
# 0 Normal, 1 Inverted
self.parent.input_logic_polarity.put(0)
# 0 Manual 1 Auto
self.parent.auto_pixels_per_buffer.put(0)
# Sets the number of pixels/spectra in the buffer
self.parent.pixels_per_buffer.put(self.parent.value_pixel_per_buffer)
"""
pass
def initialize_detector_backend(self) -> None:
"""
Initialize the detector backend for XMAP.
currently no function
"""
pass
# ----------------------------------------------------------------------
# self.parent.hdf5.enable.put(1)
# file location of h5 layout for cSAXS
# self.parent.hdf5.xml_file_name.put("layout.xml")
# TODO Check if lazy open is needed and wanted!
# self.parent.hdf5.lazy_open.put(1)
# self.parent.hdf5.temp_suffix.put("")
# size of queue for number of spectra a time.sleep(0.05)llowed in the buffer, if too small at high throughput, data is lost
# self.parent.hdf5.queue_size.put(2000)
# Segmentation into Spectra within EPICS, 1 is activate, 0 is deactivate
# self.parent.nd_array_mode.put(1)
def on_stage(self) -> None:
"""
Prepare detector and backend for acquisition
"""
# staging for XMAP as used in FDA this is for step scan
# make sure that detector is ready to measure
self.parent.stop_all.set(1)
time.sleep(0.05)
self.parent.collect_mode.set(0)
time.sleep(0.05)
self.parent.apply.set(0)
time.sleep(0.05)
self.parent.preset_mode.set(0)
time.sleep(0.05)
# self.prepare_detector()
# self.prepare_data_backend()
# self.publish_file_location(done=False, successful=False)
# self.arm_acquisition() time.sleep(0.05)
def prepare_detector(self) -> None:
"""Prepare detector for acquisition.. originally called from on stage """
pass
"""
self.set_trigger(
mapping_mode=MappingSource.MAPPING, trigger_source=TriggerSource.GATE, ignore_gate=0
)
self.parent.preset_real.put(self.parent.scaninfo.exp_time)
self.parent.pixels_per_run.put(
int(self.parent.scaninfo.num_points * self.parent.scaninfo.frames_per_trigger)
)
"""
def prepare_data_backend(self) -> None:
"""Prepare data backend for acquisition.. originally called from on_stage """
pass
""" --------------------------------------------------------------
self.parent.filepath.set(
self.parent.filewriter.compile_full_filename(f"{self.parent.name}.h5")
).wait()
file_path, file_name = os.path.split(self.parent.filepath.get())
self.parent.hdf5.file_path.put(file_path)
self.parent.hdf5.file_name.put(file_name)
self.parent.hdf5.file_template.put("%s%s")
self.parent.hdf5.num_capture.put(
int(self.parent.scaninfo.num_points * self.parent.scaninfo.frames_per_trigger)
)
self.parent.hdf5.file_write_mode.put(2)
# Reset spectrum counter in filewriter, used for indexing & identifying missing triggers
self.parent.hdf5.array_counter.put(0)
# Start file writing
self.parent.hdf5.capture.put(1)
"""
def arm_acquisition(self) -> None:
"""Arm detector for acquisition called fron on stage """
pass
"""
self.parent.start_all.put(1)
signal_conditions = [
(
lambda: self.parent.acquiring.read()[self.parent.acquiring.name]["value"],
DetectorState.ACQUIRING,
)
]
if not self.wait_for_signals(
signal_conditions=signal_conditions,
timeout=self.parent.TIMEOUT_FOR_SIGNALS,
check_stopped=True,
all_signals=False,
):
raise XMAPTimeoutError(
f"Failed to arm the acquisition. Detector state {signal_conditions[0][0]}"
)
"""
def on_unstage(self) -> None:
"""Unstage detector and backend"""
pass
def on_complete(self) -> None:
"""Complete detector and backend"""
# ------------------------------------------------------------------
# self.finished(timeout=self.parent.TIMEOUT_FOR_SIGNALS)
# self.publish_file_location(done=True, successful=True)
w = 9
def on_stop(self) -> None:
"""Stop detector and backend"""
self.stop_detector()
# self.stop_detector_backend()
def stop_detector(self) -> None:
"""Stops detector called from on _sttop"""
self.parent.stop_all.put(1)
self.parent.erase_all.put(1)
# -------------------------------------------------------------------
# signal_conditions = [
# (lambda: self.parent.acquiring.read()[self.parent.acquiring.name]["value"], DetectorState.DONE)
# ]stage2 = StageXY(prefix='X07MB',name='-ES-MA1', name='stage2')
# timeout=self.parent.TIMEOUT_FOR_SIGNALS - self.parent.TIMEOUT_FOR_SIGNALS // 2,
# all_signals=False,
# ):
# # Retry stop detector and wait for remaining time
# raise XMAPTimeoutError(
# f"Failed to stop detector, timeout with state {signal_conditions[0][0]}"
# )
def stop_detector_backend(self) -> None:
"""Stop the detector backend"""
self.parent.hdf5.capture.put(0)
def finished(self, timeout: int = 5) -> None:
"""Check if scan finished succesfully called fon on _complete """
with self._lock:
total_frames = int(
self.parent.scaninfo.num_points * self.parent.scaninfo.frames_per_trigger
)
signal_conditions = [
(self.parent.dxp.current_pixel.get, total_frames),
# (self.parent.hdf5.array_counter.get, total_frames), ---------------------
]
if not self.wait_for_signals(
signal_conditions=signal_conditions,
timeout=timeout,
check_stopped=True,
all_signals=True,
):
logger.debug(
f"XMAP missed a trigger: received trigger {self.parent.dxp.current_pixel.get()},"
f" send data {self.parent.hdf5.array_counter.get()} from total_frames"
f" {total_frames}"
)
self.stop_detector()
self.stop_detector_backend()
def set_trigger(
self, mapping_mode: MappingSource, trigger_source: TriggerSource, ignore_gate: int = 0
) -> None:
"""
Set triggering mode for finisheddetector
Args:
mapping_mode (MappingSource): Mapping mode for the detector
trigger_source (TriggerSource): Trigger source for the detector, pixel_advance_signal
ignore_gate (int): Ignore gate from TTL signal; defaults to 0
"""
pass
"""
mapping = int(mapping_mode)
trigger = trigger_source
self.parent.collect_mode.put(mapping)
self.parent.pixel_advance_mode.put(trigger)
self.parent.ignore_gate.put(ignore_gate)
"""
class XMAPPhoenix(PSIDetectorBase, xMAP):
"""
XMAP 4-element detector for phoenix
custom_prepare_cls (XMAPSetup) : Custom detector setup class for PHOENIX,
inherits from CustomDetectorMixin
in __init__ of PSIDetecor base
PSIDetectorBase.set_min_readout (float) : Minimum readout time for the detector
dxp<n> (EpicsDXPXMAP) : DXP parameters for XMAP detector
mca<n> (EpicsMCARecord) : MCA parameters for XMAP detector
hdf5 (XMAPHDF5Plugins) : HDF5 parameters for XMAP detector
MIN_READOUT (float) : Minimum readout time for the detector
"""
# Specify which functions are revealed to the user in BEC client
USER_ACCESS = ["describe", "ep"]
# specify Setup class
custom_prepare_cls = XMAPSetup
# specify minimum readout time for detector
MIN_READOUT = 3e-3
TIMEOUT_FOR_SIGNALS = 5
# for fast loading uncomment dxp and mca for now
# dxp1 = Cpt(EpicsDXP, "dxp1:")
# dxp2 = Cpt(EpicsDXP, "dxp2:")
# dxp3 = Cpt(EpicsDXP, "dxp3:")
# dxp4 = Cpt(EpicsDXP, "dxp4:")
# mca1 = Cpt(EpicsMCARecord, "mca1")
# mca2 = Cpt(EpicsMCARecord, "mca2")
# mca3 = Cpt(EpicsMCARecord, "mca3")
# mca4 = Cpt(EpicsMCARecord, "mca4")
hdf5 = Cpt(HDF5Plugin, "HDF1:")
# for compatibility and mapping ruke EPICS --> bec
preset_real = xMAP.preset_real_time
preset_live = xMAP.preset_live_time
# create some easy to find names for frequently used channels
ph_erase_start = xMAP.erase_start
ph_start_all = xMAP.start_all
ph_stop_all = xMAP.stop_all
ph_erase_all = xMAP.erase_all
ph_collect_mode = xMAP.collect_mode
ph_preset_mode = xMAP.preset_mode
ph_preset_real = xMAP.preset_real_time
ph_preset_live = xMAP.preset_live_time
ph_elapsed_real = xMAP.elapsed_real
ph_elapsed_live = xMAP.elapsed_live

View File

@ -0,0 +1,63 @@
class X:
def print_dict(self,dict,level=4,_level=0):
"""
Utility to print structure of a dictionary
"""
_level=_level+1
if _level==3:
return
#print('............... LEVEL'+str(level))
for key in dict:
print(_level,'...'*(_level-1),key)
#print(dict[key])
if 'dict' in str(type(dict[key])):
print(' ')
self.print_dict(dict[key],level=level,_level=_level)
#endfor
if _level==1:
print('...... main level keys....')
print(dict.keys())
#endif
def print_signale(self,dict,level=1,_level=0):
"""
Utility to print structure of a dictionary
"""
_level=_level+1
if _level==3:
return
#print('............... LEVEL'+str(level))
for key in dict:
print(_level,'...'*(_level-1),key)
#print(dict[key])
if 'dict' in str(type(dict[key])):
print(' ')
self.print_dict(dict[key],level=level,_level=_level)
#endfor
if _level==1:
print('...... main level keys....')
print(dict.keys())
#endif
this_dev_ttl=dev.PH_TTL
this_dev_fa=dev.falcon
this_dev=this_dev_fa
w_dict=this_dev.__dict__
w_dir=this_dev.__dir__()
w_info=this_dev._info
print('Structure of dict')
print(w_dict.keys())
keys=w_dict.keys()
x=X()
x.print_dict(w_dict,level=1)

View File

@ -6,12 +6,43 @@ ff = 0
falcon = 0
from ophyd import Component as Cpt
import phoenix_bec.devices.falcon_phoenix as ff
import phoenix_bec.devices.phoenix_falcon as ff
falcon = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-SITORO:")
falcon = ff.FalconPhoenix(name="falcon", prefix="X07MB-SITORO:")
# xmap = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-XMAP:")
# make a 'get to read all epics channels
# there will be an error message, if device contains a channel whcih does not exist
w = falcon.get()
print(w)
#print(w)
# for attr in falcon.hdf5.component_names:
# if not attr.startswith("_"):
# print(attr)
# signal = getattr(falcon, attr)
# signal.get()
"""
print(this_scan.scan.data.keys())
for outer_key in this_scan.scan.data.keys():
print("outer_key", outer_key)
n_outer = len(this_scan.scan.data.keys())
for inner_key in this_scan.scan.data[outer_key].keys():
print("inner_key", inner_key)
# calculate nunber of points
n_inner = len(this_scan.scan.data[outer_key][inner_key].keys())
value = np.zeros(n_inner)
timestamp = np.zeros(n_inner)
for i in range(n_inner):
try:
value[i] = this_scan.scan.data[outer_key][inner_key][i]["value"]
except:
value = None
try:
timestamp[i] = this_scan.scan.data[outer_key][inner_key][i]["timestamp"]
except:
timestamp[i] = None
# endfor
self.add(inner_key + "_" + outer_key + "_val", value)
self.add(innerprint("test")
"""

View File

@ -0,0 +1,17 @@
import time
from phoenix_bec.scripts.phoenix import PhoenixBL
print("imported")
time.sleep(2)
ph = PhoenixBL()
# ph.read_phoenix_config()
#
# how do we get this to iphython command line ?
# print('........... falkon.mca1 '
##
# ph.list_signals_falcon()
# ph.list_signals_xmap()
ph.run_shell("ls")
ph.run_shell(["ls -altr ", "pwd"])

View File

@ -0,0 +1,9 @@
import time
from phoenix_bec.scripts.phoenix import PhoenixBL
from ophyd import Component as Cpt
import phoenix_bec.devices.phoenix_trigger as pt
trig = pt.PhoenixTrigger(name="phoenixTrigger", prefix="X07MB-OP2:")
trig.describe()
trig.custom_prepare.on_trigger

View File

@ -0,0 +1,19 @@
import time
from phoenix_bec.scripts.phoenix import PhoenixBL
from ophyd import Component as Cpt
import phoenix_bec.devices.phoenix_scan_1 as sc_1
ss = sc_1.PhoenixScan_1(name="phoenixTrigger", prefix="X07MB-OP2:")
print('s')
ss.describe()
print('o')
ss.ph_xmap_stop_all.put(1)
ss.csmpl.set(0)
time.sleep(1.4)
ss.custom_prepare.on_trigger()

View File

@ -0,0 +1,15 @@
# against all rues, make sure ff and falcon are really
# creates newly
ff = 0
falcon = 0
from ophyd import Component as Cpt
import phoenix_bec.devices.phoenix_xmap as ff
xmap = ff.XMAPPhoenix(name="xmap", prefix="X07MB-XMAP:")
#HOw to test function in mixing layer
xmap.custom_prepare.on_stage()

View File

@ -1,9 +1,9 @@
from phoenix_bec.devices.xmap_phoenix_no_hdf5 import XMAPphoenix
from phoenix_bec.devices.obsolete.xmap_phoenix_no_hdf5 import XMAPphoenix
from phoenix_bec.scripts.phoenix import PhoenixBL
phoenix=PhoenixBL()
phoenix.read_phoenix_config()
#
# how do we get this to iphython command line ?
# how do we get this to iphython command line ?
#

View File

@ -0,0 +1,45 @@
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
BEC_PATH='/data/test/x07mb-test-bec/production'
alias cd_bec='cd '$BEC_PATH
alias bec_env='source 'BEC_PATH'/bec_venv/bin/activate'
alias cd_bec_ph='cd '$BEC_PATH'/phoenix_bec/phoenix_bec'
alias cd_bec_local_scripts='cd '$BEC_PATH'/phoenix_bec/phoenix_bec/local_scripts'
alias cd_bec_devices='cd '$BEC_PATH'/phoenix_bec/phoenix_bec/devices'
alias cd_bec_devices='cd '$BEC_PATH'/phoenix_bec/phoenix_bec/device_configs'
alias cd_bec_device_configs='cd /data/test/x07mb-test-bec/production/phoenix_bec/phoenix_bec/device_configs'
alias cd_bec_scripts='cd /data/test/x07mb-test-bec/production/phoenix_bec/phoenix_bec/scripts'
alias cd_bec_venv_bin='cd /data/test/x07mb-test-bec/production/bec_venv/bin'
#alias activate_bec_venv='source /data/test/x07mb-test-bec/bec_deployment/bec_venv/bin/activate'
#alias activate_bec_venv='source /data/test/x07mb-test-bec/production/bec_venv/bin/activate'
alias bec_env='source /data/test/x07mb-test-bec/production/bec_venv/bin/activate'

View File

@ -0,0 +1,26 @@
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
from ophyd import Component as Cpt
# option I via direct acces to classes
def print_dic(clname, cl):
print("")
print("-------- ", clname)
for ii in cl.__dict__:
if "_" not in ii:
try:
print(ii, " ---- ", cl.__getattribute__(ii))
except:
print(ii)
ScanX = EpicsMotor(name="ScanX", prefix="X07MB-ES-MA1:ScanX")
ScanX_RBV = EpicsMotor(name="ScanX", prefix="X07MB-ES-MA1:ScanX.RBV")
ScanY = EpicsMotor(name="ScanY", prefix="X07MB-ES-MA1:ScanY")
DIODE = EpicsSignal(name="SI", read_pv="X07MB-OP2-SAI_07:MEAN")
SMPL = EpicsSignal(name="SMPL", read_pv="X07MB-OP2:SMPL")
CYCLES = EpicsSignal(
name="SMPL", read_pv="X07MB-OP2:TOTAL-CYCLES", write_pv="X07MB-OP2:TOTAL-CYCLES"
)

View File

@ -1,85 +0,0 @@
#from unittest import mock
import numpy as np
#import pandas
#import pytest
#from bec_lib import messages
#import device_server
#from ophyd import Component as Cpt
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
#from ophyd import FormattedComponent as FCpt
#from ophyd import Kind, PVPositioner, Signal
#from ophyd.flyers import FlyerInterface
#from ophyd.pv_positioner import PVPositionerComparator
#from ophyd.status import DeviceStatus, SubscriptionStatus
import time as tt
#import ophyd
import os
import sys
#logger = bec_logger.logger
# load simulation
#bec.config.load_demo_config()
bec.config.update_session_with_file("config/config_1.yaml")
os.system('mv *.yaml tmp')
class PhoenixBL:
#define some epics channels
def __init__(self):
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
from ophyd import Component as Cpt
self.ScanX = EpicsMotor(name='ScanX',prefix='X07MB-ES-MA1:ScanX')
self.ScanY = EpicsMotor(name='ScanY',prefix='X07MB-ES-MA1:ScanY')
self.DIODE = EpicsSignal(name='SI',read_pv='X07MB-OP2-SAI_07:MEAN')
self.SIG = Cpt(EpicsSignal,name='we',read_pv="X07MB-OP2-SAI_07:MEAN")
self.SMPL = EpicsSignal(name='SMPL',read_pv='X07MB-OP2:SMPL')
self.CYCLES = EpicsSignal(name='SMPL',read_pv='X07MB-OP2:TOTAL-CYCLES',write_pv='X07MB-OP2:TOTAL-CYCLES')
self.fielda =EpicsSignal(name='SMPL',read_pv='X07MB-SCAN:scan1.P1SP',write_pv='X07MB-SCAN:scan1.P1SP')
#end class
ph=PhoenixBL()
print('---------------------------------')
# scan will not diode
print(' SCAN DO NOT READ DIODE ')
dev.PH_curr_conf.readout_priority='baseline' # do not read detector
ti=tt.time_ns()
s1=scans.line_scan(dev.PH_ScanX_conf,0,0.002,steps=4,exp_time=.01,relative=False,delay=2)
tf=tt.time_ns()
print('elapsed time',(tf-ti)/1e9)
# scan will read diode
print(' SCAN READ DIODE ')
tt.sleep(2)
dev.PH_curr_conf.readout_priority='monitored' # read detector
s2=scans.line_scan(dev.PH_ScanX_conf,0,0.002,steps=11,exp_time=.3,relative=False,delay=2)
"""
next lines do not work as pandas is not installed on test system
res1 = s1.scan.to_pandas()
re1 = res1.to_numpy()
print('Scana')
print(res1)
print('')
print('Scan2 at pandas ')
print(res2)
print('Scan2 as numpy ')
print(res2)
"""

View File

@ -0,0 +1,522 @@
#! /usr/bin/env python
#
#
# old python library for pure python aplicatoins
#
# ===========================================================================
import os
import sys
import numpy as np
#from CaChannel import *
import epics as ep
#from EpicsMotor import *
#from epicsPV import *
import time
import string
def init_PV():
#
# routine initialzed all EPIC channels used in the Phoenix beamline
#
global PV
PV = {} # define EPICS CHANNEL (PV) directory
# define one channel
try:
PV['X07MB_MB_ScanX_VAL'] = ep.PV('X07MB-MA1_ScanX.VAL')
except:
print( "*** Error finding EPICS channel: ")
sys.exit("*** Program STOP ***")
print ('init PV done')
def get_epicsPV(channel):
b=-1
# first check fro channel existence
#print '.................................. enter get_epicsPV from X_X07MB_lib_dev.py' ,channel
#print('try ',channel)
try:
#print ' try reading channel X_X07MB_lib_dev.py' ,channel
b=PV[channel].getw()
except:
# channel not defined / found now created in PV list this channel into PV LIST
print ('trouble reading epics PV..',channel,'likely PV undefined')
n_tries=0
tt=0
while tt==0:
print ('in while loop ')
try:
print ('try============= ',channel)
PV[channel]=epicsPV(channel)
#print PV
tt=1
print (PV[channel].getw())
except:
#print 'set tt back to zero as something went wrong here'
tt=0
#print 'except somthing is wrong here, likely time out, now retry channels'
#print b
n_tries=n_tries+1
time.sleep(.3)
print( 'next try',n_tries)
if n_tries==25:
tt=1
print( 'too many tries for channel acces')
print( 'Channel',channel)
sys.exit("*** Program STOP ***")
# endif
# endtry
# now try again and set monitor to reduce chanel accesscalls
PV[channel].setMonitor()
b=PV[channel].getw()
# end while
# endtry
return b
def put_epicsPV(channel,val,delay={}):
print(channel,val,delay)
#try:
# from CaChannel import *
# from epicsMotor import *
# from epicsPV import *
# import time
# import string
#except:
# try:
# sys.path.insert(0, os.path.expandvars("$SLSBASE/sls/lib/python22/CaChannel"))
# sys.path.insert(0, os.path.expandvars("/exchange/share/mXAS/pyth/mod"))
# from CaChannel import *
# from epicsPV import *
# except:
# os.system ("xkbbell")
# os.system ("xmessage -nearmouse -timeout 30 \
# -buttons \"\" \"epicsPV or CaChannel module cannot be found\"")
# sys.exit(1)
# # endtry
# endtry
#print '------------------------------------------' , val
#print ' *delay) ', delay
#print ' *delay) '
#print ' locals',locals()
if delay == {}:
#print 'in if use predefined delay of 0 '
set_delay=0.0
else:
#print ' set delay to input value',delay
set_delay = delay
#endelse
n_tries=0
tt=0
b=-1
while tt==0:
try:
#print ' try writing into ' ,channel
epicsPV(channel).putw(val)
tt=1
except:
print( 'trouble reading epics PV..')
print( b)
n_tries=n_tries+1
tt=0
time.sleep(.5)
if n_tries==50:
tt=1
print ('too many tries for channel acces')
#sys.exit("*** Program STOP ***")
# endtry
# finally perform delay
time.sleep(set_delay)
return b
# ======================================================
def move_and_wait_bk(Ch_motor,value,backlash):
global phoenix_no_move
global phoenix_no_scan
# print ch_motor
if phoenix_no_move==1:
print (' ')
print ('in move_and_wait_bk ')
print ('should move motor ',Ch_motor,' to ', value)
print ('BL in no move debugging state. DO NOT MOVE MOTOR')
print (' ')
return
# move to new position with backlash correction
move_and_wait(Ch_motor,value-backlash)
move_and_wait(Ch_motor,value)
# ======================================================
def move_and_wait_old(Ch_motor,value,check_moving):
global phoenix_no_move
global phoenix_no_scan
# print 'in move and waqit',phoenix_no_move
# print Ch_motor
if phoenix_no_move==1:
print (' ')
print ('in move_and_wait ')
print ('should move motor ',Ch_motor,' to ', value)
print ('BL in no move debugging state. DO NOT MOVE MOTOR')
print (' ')
return
Ch_motor_use=Ch_motor
if (Ch_motor[len(Ch_motor)-4:len(Ch_motor)] == '.VAL'):
Ch_motor_use=Ch_motor[0:len(Ch_motor)-4]
# print Ch_motor_use
if Ch_motor_use[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if Ch_motor_use[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
Ch_motor_val = Ch_motor_use +'.VAL'
Ch_motor_done = Ch_motor_use +'.DMOV'
#print Ch_motor_val
epicsPV(Ch_motor_val).putw(value)
print( 'wait for movement of', Ch_motor_val)
while not epicsPV(Ch_motor_done).getw() :
time.sleep(0.1)
get_epicsPV(Ch_motor_val)
#print 'Motor ',Ch_motor_val,' still moving, wait '
print ( 'movement finished')
# ===========================================================
def move_and_wait(motor,value,check_moving=0):
global phoenix_no_move
global phoenix_no_scan
# print 'in move and waqit',phoenix_no_move
# print Ch_motor
if phoenix_no_move==1:
print( ' ')
print( 'in move_and_wait ')
print( 'should move motor ',Ch_motor,' to ', value)
print( 'BL in no move debugging state. DO NOT MOVE MOTOR')
print( ' ')
return
# some safety checks...
if motor.val[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if motor.val[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
put_epicsPV(motor.val,value,delay=0.2)
print ('wait for movement of', motor.val)
if check_moving == 0:
while not get_epicsPV(motor.dmov):
time.sleep(0.1)
print( get_epicsPV(motor.val))
print( 'Motor ',motor.val,' still moving, wait ')
#endwhile
else: # case with check of movement of encoders
print ('else....')
while not get_epicsPV(motor.dmov):
enc1= get_epicsPV(motor.rep)
time.sleep(0.25)
enc2= get_epicsPV(motor.rep)
diff=enc2-enc1
print( get_epicsPV(motor.val))
if (abs(diff) < 5 and (get_epicsPV(motor.dmov) == 0)) :
print ( 'suspect hanging of motor. monitor')
enc1= get_epicsPV(motor.rep)
time.sleep(0.5)
enc2= get_epicsPV(motor.rep)
diff=enc2-enc1
time.sleep(0.5)
if ((abs(diff) < 3) and (get_epicsPV(motor.dmov) == 0)):
print (' ===================================== diff',diff )
print ('difference encoder to motor too large')
print (' STOP movement')
put_epicsPV(motor.spmg,0,delay=0.1)
stop
# endif
#endif
print( 'Motor ',motor.val,' still moving, wait ')
print( 'difference subsequent encoder positions ',diff)
# endwhile
# endif
print( 'movement finished')
# =======================================================================
def Wait_for_Value(Channel,value):
while get_epicsPV(Channel) != value:
#print(Channel)
#print get_epicsPV(Channel)
time.sleep(.02)
#endwhile
def move_and_wait_2motors(mot1,mot2,val_1,val_2,check_moving=0):
global phoenix_no_move
global phoenix_no_scan
# print 'in move and waqit',phoenix_no_move
# print Ch_motor
if phoenix_no_move==1:
print( ' ')
print( 'in move_and_wait ')
print( 'should move motor ',Ch_motor,' to ', value)
print( 'BL in no move debugging state. DO NOT MOVE MOTOR')
print( ' ')
return
# some safety checks...
if mot1.val[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if mot2.val[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if mot1.val[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
if mot2.val[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
put_epicsPV(mot1.val,val_1,delay=0.2)
put_epicsPV(mot2.val,val_2,delay=0.2)
print( 'wait for movement of', mot1.val,'and ', mot2.val)
if check_moving == 0:
print (not get_epicsPV(mot1.dmov))
print (not get_epicsPV(mot2.dmov))
while ((not get_epicsPV(mot1.dmov)) or (not get_epicsPV(mot2.dmov))):
time.sleep(0.25)
#endwhile
print( get_epicsPV(mot1.val),get_epicsPV(mot2.val))
print( 'Motor ',mot1.val,mot2.val,' still moving, wait ')
else: # case with check of movement of encoders
print ( 'else....')
while (not get_epicsPV(mot1.dmov)) or (not get_epicsPV(mot2.dmov)):
#print ' in while '
# for motor 1
enc_1_a= get_epicsPV(mot1.rep)
enc_2_a= get_epicsPV(mot2.rep)
time.sleep(0.25)
enc_1_b= get_epicsPV(mot1.rep)
enc_2_b= get_epicsPV(mot2.rep)
diff_1=enc_1_b-enc_1_a
diff_2=enc_2_b-enc_2_a
#print ' encoder diffs',diff_1,diff_2
# check encoder movement for motor 1:
if (abs(diff_1) < 5 and (get_epicsPV(mot1.dmov) == 0)) :
print( 'suspect hanging of motor 1 monitor')
enc_1_a= get_epicsPV(mot1.rep)
time.sleep(0.25)
enc_1_b= get_epicsPV(mot1.rep)
diff_1=enc_1_b-enc_1_a
time.sleep(0.5)
if ((abs(diff_1) < 3) and (get_epicsPV(mot1.dmov) == 0)):
print( ' ===================================== diff',diff_1 )
print( 'difference subsequent encoder steps too small')
print( 'Motor 1 hanging???? STOP movement for safety ')
put_epicsPV(mot_1.spmg,0,delay=0.1)
stop
# endif
#endif
# Now checlk motor 2
if (abs(diff_2) < 5 and (get_epicsPV(mot2.dmov) == 0)) :
print ('suspect hanging of motor 2: monitor')
enc_2_a= get_epicsPV(mot2.rep)
time.sleep(0.25)
enc_2_b= get_epicsPV(mot2.rep)
diff_2=enc_2_b-enc_2_a
time.sleep(0.5)
if ((abs(diff_2) < 3) and (get_epicsPV(mot2.dmov) == 0)):
print( ' ===================================== diff',diff_2 )
print( 'difference subsequent encoder steps too small')
print( 'Motor 2 hanging???? STOP movement for safety ')
put_epicsPV(mot2.spmg,0,delay=0.1)
stop
# endif
#endif
print( 'Motors ',mot1.val, 'and',mot2.val,' still moving, wait ')
print( 'difference subsequent encoder positions ',diff_1, diff_2)
# endwhile
# endif
print( 'movement finished')
# =======================================================================
# Generate all names
class Motor():
#define extensions for all channels
e_val = '.VAL'
e_dval = '.DVAL'
e_rbv = '.RBV'
e_drbv = '.DRBV'
e_off ='.OFF'
e_twv = '.TWV'
e_twf = '.TWF'
e_twr = '.TWR'
e_jogr ='.JOGR' # jog rev
e_jogf ='.JOGF' # jog forw
e_jomf ='.HOMF' # home forward
e_jomr ='.HOMR' # home reverse
e_hlm ='.HLM' #High limit
e_llm ='.LLM' #lower limit
e_hls ='.HLS' #High limit
e_lls ='.LLS' #lower limit
e_dmov ='.DMOV' # moving done
e_movn ='.MOVN' # moving
e_spmg ='.SPMG' # stop pause move go (0,1,2,3)
e_ueip ='.UEIP' # encoder on / off
e_diff ='.DIFF'
e_rep = '.REP'
e_foff ='.FOFF' #FOFF (1 = Frozen / 0 = variable)
e_set = '.SET' # 0 = use 1 = set
e_mres = '.MRES'
e_eres = '.ERES'
def create_Ch(self,ch):
# this routine creates all channel names
self.val=ch+self.e_val
self.dval=ch+self.e_dval
self.rbv=ch+self.e_rbv
self.drbv=ch+self.e_drbv
self.off=ch+self.e_off
self.twv=ch+self.e_twv
self.twf=ch+self.e_twf
self.twr=ch+self.e_twr
self.jogr=ch+self.e_jogr
self.jogf=ch+self.e_jogf
self.hlm=ch+self.e_hlm
self.llm=ch+self.e_llm
self.hls=ch+self.e_hls
self.lls=ch+self.e_lls
self.dmov = ch+self.e_dmov
self.movn = ch+self.e_movn
self.spmg = ch+self.e_spmg
self.ueip = ch+self.e_ueip
self.rep = ch+self.e_rep
self.mres = ch+self.e_mres
self.eres = ch+self.e_eres
self.diff = ch+self.e_diff
self.foff = ch+self.e_foff
self.set = ch+self.e_set
# end create_Chnames
# endclass
def define_motor(ch):
g=Motor()
g.create_Ch(ch)
return g
# end define_motor
def define_motor_kb(ch):
g=Motor()
g.create_Ch(ch)
# set offset to variable as default setting
# this keeps the dval always constant
put_epicsPV(g.foff,1,delay=0.2) # offset to frozen as we do not initialize
put_epicsPV(g.set,0,delay=0.2) # make sure that coos are on use
return g
# end define_motor
def Next_Point():
sp1=np.zeros(2048)
sp2=np.zeros(2048)
sp3=np.zeros(2048)
sp4=np.zeros(2048)
d1 = 0
d2 = 0
d3 = 0
d4 = 0
#print('erasestart')
put_epicsPV('X07MB-XMAP:EraseStart',1,delay=.03)
#print('erasestart')
#time.sleep(.1)
put_epicsPV('X07MB-OP2:SMPL',1,delay=.03)
Wait_for_Value("X07MB-OP2:SMPL-DONE",1)
put_epicsPV('X07MB-XMAP:StopAll',1,delay=.03)
sp1_old=sp1
sp2_old=sp2
sp3_old=sp3
sp4_old=sp4
d1_old=d1
d2_old=d2
d3_old=d3
d4_old=d4
sp1=get_epicsPV('X07MB-XMAP:mca1.VAL')
sp2=get_epicsPV('X07MB-XMAP:mca2.VAL')
sp3=get_epicsPV('X07MB-XMAP:mca3.VAL')
sp4=get_epicsPV('X07MB-XMAP:mca4.VAL')
d1=get_epicsPV('X07MB-XMAP:mca1.DTIM')
d2=get_epicsPV('X07MB-XMAP:mca2.DTIM')
d3=get_epicsPV('X07MB-XMAP:mca3.DTIM')
d4=get_epicsPV('X07MB-XMAP:mca4.DTIM')
print('differences',max(sp1-sp1_old),max(sp2-sp2_old),max(sp3-sp3_old),max(sp4-sp4_old))
print('differences',d1-d1_old,d2-d2_old,d3-d3_old,d4-d4_old)
time.sleep(.5)
# end
init_PV()

View File

@ -0,0 +1,789 @@
#! /usr/bin/env python
#
#
# old python library for pure python aplicatoins
#
# ===========================================================================
# for now still use the old python installation .....
try:
from CaChannel import *
from epicsMotor import *
from epicsPV import *
import time
import string
except:
try:
sys.path.insert(0, os.path.expandvars("$SLSBASE/sls/lib/python22/CaChannel"))
sys.path.insert(0, os.path.expandvars("/exchange/share/mXAS/pyth/mod"))
from CaChannel import *
from epicsPV import *
except:
os.system ("xkbbell")
os.system ("xmessage -nearmouse -timeout 30 \
-buttons \"\" \"epicsPV or CaChannel module cannot be found\"")
sys.exit(1)
# endtry
#endtry
import numpy as np
def stop_if_phoenix_is_offline():
if (epicsPV('X07MB-OP-MI1:ONLINE').getw() <> 4) or ( epicsPV('X07MA-OP-CMU:ONLINE').getw() <>6 ):
print ' '
print 'PHOENIX NOT ONLINE ACCESS DENIED'
print 'Status PHOENIX ',epicsPV("X07MB-OP-MI1:ONLINE.VAL").getw()
print 'Status XTREME ',epicsPV("X07MA-OP-CMU:ONLINE.VAL").getw()
print ' '
print ' =========================================================== '
print ' '
print ' SCRIPT STOPPED '
print ' '
print ' ========================================================== '
print ' '
stop
# ======================================================
def init_PV():
#
# routine initialzed all EPIC channels used in the Phoenix beamline
#
global PV
PV = {} # define EPICS CHANNEL (PV) directory
# define one channel
try:
PV['X07MB-OP-MO:TC1'] = epicsPV('X07MB-OP-MO:TC1')
except:
print "*** Error finding EPICS channel: "
sys.exit("*** Program STOP ***")
print 'init PV done'
def get_epicsPV(channel):
b=-1
# first check fro channel existence
#print '.................................. enter get_epicsPV from X_X07MB_lib_dev.py' ,channel
#print('try ',channel)
try:
#print ' try reading channel X_X07MB_lib_dev.py' ,channel
b=PV[channel].getw()
except:
# channel not defined / found now created in PV list this channel into PV LIST
print 'trouble reading epics PV..',channel,'likely PV undefined'
n_tries=0
tt=0
while tt==0:
print 'in while loop '
try:
print 'try============= ',channel
PV[channel]=epicsPV(channel)
#print PV
tt=1
print PV[channel].getw()
except:
#print 'set tt back to zero as something went wrong here'
tt=0
#print 'except somthing is wrong here, likely time out, now retry channels'
#print b
n_tries=n_tries+1
time.sleep(.3)
print 'next try',n_tries
if n_tries==25:
tt=1
print 'too many tries for channel acces'
print 'Channel',channel
sys.exit("*** Program STOP ***")
# endif
# endtry
# now try again and set monitor to reduce chanel accesscalls
PV[channel].setMonitor()
b=PV[channel].getw()
# end while
# endtry
return b
def put_epicsPV(channel,val,delay={}):
print(channel,val,delay)
#try:
# from CaChannel import *
# from epicsMotor import *
# from epicsPV import *
# import time
# import string
#except:
# try:
# sys.path.insert(0, os.path.expandvars("$SLSBASE/sls/lib/python22/CaChannel"))
# sys.path.insert(0, os.path.expandvars("/exchange/share/mXAS/pyth/mod"))
# from CaChannel import *
# from epicsPV import *
# except:
# os.system ("xkbbell")
# os.system ("xmessage -nearmouse -timeout 30 \
# -buttons \"\" \"epicsPV or CaChannel module cannot be found\"")
# sys.exit(1)
# # endtry
# endtry
#print '------------------------------------------' , val
#print ' *delay) ', delay
#print ' *delay) '
#print ' locals',locals()
if delay == {}:
#print 'in if use predefined delay of 0 '
set_delay=0.0
else:
#print ' set delay to input value',delay
set_delay = delay
#endelse
n_tries=0
tt=0
b=-1
while tt==0:
try:
#print ' try writing into ' ,channel
epicsPV(channel).putw(val)
tt=1
except:
print 'trouble reading epics PV..'
print b
print b
n_tries=n_tries+1
tt=0
time.sleep(.5)
if n_tries==50:
tt=1
print 'too many tries for channel acces'
#sys.exit("*** Program STOP ***")
# endtry
# finally perform delay
time.sleep(set_delay)
return b
# ======================================================
def move_and_wait_bk(Ch_motor,value,backlash):
global phoenix_no_move
global phoenix_no_scan
# print ch_motor
if phoenix_no_move==1:
print ' '
print 'in move_and_wait_bk '
print 'should move motor ',Ch_motor,' to ', value
print 'BL in no move debugging state. DO NOT MOVE MOTOR'
print ' '
return
# move to new position with backlash correction
move_and_wait(Ch_motor,value-backlash)
move_and_wait(Ch_motor,value)
# ======================================================
def move_and_wait_old(Ch_motor,value,check_moving):
global phoenix_no_move
global phoenix_no_scan
# print 'in move and waqit',phoenix_no_move
# print Ch_motor
if phoenix_no_move==1:
print ' '
print 'in move_and_wait '
print 'should move motor ',Ch_motor,' to ', value
print 'BL in no move debugging state. DO NOT MOVE MOTOR'
print ' '
return
Ch_motor_use=Ch_motor
if (Ch_motor[len(Ch_motor)-4:len(Ch_motor)] == '.VAL'):
Ch_motor_use=Ch_motor[0:len(Ch_motor)-4]
# print Ch_motor_use
if Ch_motor_use[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if Ch_motor_use[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
Ch_motor_val = Ch_motor_use +'.VAL'
Ch_motor_done = Ch_motor_use +'.DMOV'
#print Ch_motor_val
epicsPV(Ch_motor_val).putw(value)
print 'wait for movement of', Ch_motor_val
while not epicsPV(Ch_motor_done).getw() :
time.sleep(0.1)
get_epicsPV(Ch_motor_val)
#print 'Motor ',Ch_motor_val,' still moving, wait '
print 'movement finished'
# ===========================================================
def move_and_wait(motor,value,check_moving=0):
global phoenix_no_move
global phoenix_no_scan
# print 'in move and waqit',phoenix_no_move
# print Ch_motor
if phoenix_no_move==1:
print ' '
print 'in move_and_wait '
print 'should move motor ',Ch_motor,' to ', value
print 'BL in no move debugging state. DO NOT MOVE MOTOR'
print ' '
return
# some safety checks...
if motor.val[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if motor.val[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
put_epicsPV(motor.val,value,delay=0.2)
print 'wait for movement of', motor.val
if check_moving == 0:
while not get_epicsPV(motor.dmov):
time.sleep(0.1)
print get_epicsPV(motor.val)
print 'Motor ',motor.val,' still moving, wait '
#endwhile
else: # case with check of movement of encoders
print 'else....'
while not get_epicsPV(motor.dmov):
print ' in while '
enc1= get_epicsPV(motor.rep)
time.sleep(0.25)
enc2= get_epicsPV(motor.rep)
diff=enc2-enc1
print get_epicsPV(motor.val)
if (abs(diff) < 5 and (get_epicsPV(motor.dmov) == 0)) :
print 'suspect hanging of motor. monitor'
enc1= get_epicsPV(motor.rep)
time.sleep(0.5)
enc2= get_epicsPV(motor.rep)
diff=enc2-enc1
time.sleep(0.5)
if ((abs(diff) < 3) and (get_epicsPV(motor.dmov) == 0)):
print ' ===================================== diff',diff
print 'difference encoder to motor too large'
print ' STOP movement'
put_epicsPV(motor.spmg,0,delay=0.1)
stop
# endif
#endif
print 'Motor ',motor.val,' still moving, wait '
print 'difference subsequent encoder positions ',diff
# endwhile
# endif
print 'movement finished'
# =======================================================================
def Wait_for_Value(Channel,value):
while get_epicsPV(Channel) <> value:
#print(Channel)
#print get_epicsPV(Channel)
time.sleep(.02)
#endwhile
def move_and_wait_2motors(mot1,mot2,val_1,val_2,check_moving=0):
global phoenix_no_move
global phoenix_no_scan
# print 'in move and waqit',phoenix_no_move
# print Ch_motor
if phoenix_no_move==1:
print ' '
print 'in move_and_wait '
print 'should move motor ',Ch_motor,' to ', value
print 'BL in no move debugging state. DO NOT MOVE MOTOR'
print ' '
return
# some safety checks...
if mot1.val[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if mot2.val[0:5] == 'X07MA':
stop_if_phoenix_is_offline()
if mot1.val[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
if mot2.val[0:11] == 'X07MB-OP-MI1':
stop_if_phoenix_is_offline()
put_epicsPV(mot1.val,val_1,delay=0.2)
put_epicsPV(mot2.val,val_2,delay=0.2)
print 'wait for movement of', mot1.val,'and ', mot2.val
if check_moving == 0:
print (not get_epicsPV(mot1.dmov))
print (not get_epicsPV(mot2.dmov))
while ((not get_epicsPV(mot1.dmov)) or (not get_epicsPV(mot2.dmov))):
time.sleep(0.25)
#endwhile
print get_epicsPV(mot1.val),get_epicsPV(mot2.val)
print 'Motor ',mot1.val,mot2.val,' still moving, wait '
else: # case with check of movement of encoders
print 'else....'
while (not get_epicsPV(mot1.dmov)) or (not get_epicsPV(mot2.dmov)):
#print ' in while '
# for motor 1
enc_1_a= get_epicsPV(mot1.rep)
enc_2_a= get_epicsPV(mot2.rep)
time.sleep(0.25)
enc_1_b= get_epicsPV(mot1.rep)
enc_2_b= get_epicsPV(mot2.rep)
diff_1=enc_1_b-enc_1_a
diff_2=enc_2_b-enc_2_a
#print ' encoder diffs',diff_1,diff_2
# check encoder movement for motor 1:
if (abs(diff_1) < 5 and (get_epicsPV(mot1.dmov) == 0)) :
print 'suspect hanging of motor 1 monitor'
enc_1_a= get_epicsPV(mot1.rep)
time.sleep(0.25)
enc_1_b= get_epicsPV(mot1.rep)
diff_1=enc_1_b-enc_1_a
time.sleep(0.5)
if ((abs(diff_1) < 3) and (get_epicsPV(mot1.dmov) == 0)):
print ' ===================================== diff',diff_1
print 'difference subsequent encoder steps too small'
print 'Motor 1 hanging???? STOP movement for safety '
put_epicsPV(mot_1.spmg,0,delay=0.1)
stop
# endif
#endif
# Now checlk motor 2
if (abs(diff_2) < 5 and (get_epicsPV(mot2.dmov) == 0)) :
print 'suspect hanging of motor 2: monitor'
enc_2_a= get_epicsPV(mot2.rep)
time.sleep(0.25)
enc_2_b= get_epicsPV(mot2.rep)
diff_2=enc_2_b-enc_2_a
time.sleep(0.5)
if ((abs(diff_2) < 3) and (get_epicsPV(mot2.dmov) == 0)):
print ' ===================================== diff',diff_2
print 'difference subsequent encoder steps too small'
print 'Motor 2 hanging???? STOP movement for safety '
put_epicsPV(mot2.spmg,0,delay=0.1)
stop
# endif
#endif
print 'Motors ',mot1.val, 'and',mot2.val,' still moving, wait '
print 'difference subsequent encoder positions ',diff_1, diff_2
# endwhile
# endif
print 'movement finished'
# =======================================================================
# Generate all names
class Motor():
#define extensions for all channels
e_val = '.VAL'
e_dval = '.DVAL'
e_rbv = '.RBV'
e_drbv = '.DRBV'
e_off ='.OFF'
e_twv = '.TWV'
e_twf = '.TWF'
e_twr = '.TWR'
e_jogr ='.JOGR' # jog rev
e_jogf ='.JOGF' # jog forw
e_jomf ='.HOMF' # home forward
e_jomr ='.HOMR' # home reverse
e_hlm ='.HLM' #High limit
e_llm ='.LLM' #lower limit
e_hls ='.HLS' #High limit
e_lls ='.LLS' #lower limit
e_dmov ='.DMOV' # moving done
e_movn ='.MOVN' # moving
e_spmg ='.SPMG' # stop pause move go (0,1,2,3)
e_ueip ='.UEIP' # encoder on / off
e_diff ='.DIFF'
e_rep = '.REP'
e_foff ='.FOFF' #FOFF (1 = Frozen / 0 = variable)
e_set = '.SET' # 0 = use 1 = set
e_mres = '.MRES'
e_eres = '.ERES'
def create_Ch(self,ch):
# this routine creates all channel names
self.val=ch+self.e_val
self.dval=ch+self.e_dval
self.rbv=ch+self.e_rbv
self.drbv=ch+self.e_drbv
self.off=ch+self.e_off
self.twv=ch+self.e_twv
self.twf=ch+self.e_twf
self.twr=ch+self.e_twr
self.jogr=ch+self.e_jogr
self.jogf=ch+self.e_jogf
self.hlm=ch+self.e_hlm
self.llm=ch+self.e_llm
self.hls=ch+self.e_hls
self.lls=ch+self.e_lls
self.dmov = ch+self.e_dmov
self.movn = ch+self.e_movn
self.spmg = ch+self.e_spmg
self.ueip = ch+self.e_ueip
self.rep = ch+self.e_rep
self.mres = ch+self.e_mres
self.eres = ch+self.e_eres
self.diff = ch+self.e_diff
self.foff = ch+self.e_foff
self.set = ch+self.e_set
# end create_Chnames
# endclass
def define_motor(ch):
g=Motor()
g.create_Ch(ch)
return g
# end define_motor
def define_motor_kb(ch):
g=Motor()
g.create_Ch(ch)
# set offset to variable as default setting
# this keeps the dval always constant
put_epicsPV(g.foff,1,delay=0.2) # offset to frozen as we do not initialize
put_epicsPV(g.set,0,delay=0.2) # make sure that coos are on use
return g
# end define_motor
def init_one_motor(init_motor,HHL=0,LHL=0,LIM='low',set_offset='variable'):
# initialization for givrn location of limit switch (1 motor)
motor=define_motor_kb(init_motor)
total_range = abs(HHL-LHL)
# general settings
if set_offset == 'frozen':
put_epicsPV(motor.foff,1,delay=0.2) # offset to frozen as we do not initialize
else:
put_epicsPV(motor.foff,0,delay=0.2) # offset to variable if needed
#endif
put_epicsPV(motor.twv,0.1,delay=0.2) # set tweak value to 100 mum as default
put_epicsPV(motor.ueip , 0 ,delay=.5) # switch encoder off
# first remember start value
x_ini=get_epicsPV(motor.val)
print x_ini
# now remove soft limits allow start value plus total range as maximum
put_epicsPV(motor.hlm ,x_ini+ total_range*1.15 ,delay=.5) # switch encoder off
put_epicsPV(motor.llm ,x_ini-total_range*1.15 ,delay=.5) # switch encoder off
# now move to lower limit
if LIM == 'low':
move_and_wait(motor ,x_ini-total_range*1.07,check_moving=1)
# now check whether we are in the limit
if get_epicsPV(motor.lls) == 0:
print(' hard limit not reached',motor.val)
stop
else:
print(' hard limit reached',motor.val)
#endelse
# now set coordinate system according to limits
# endcoder on / off twice to account for bug in motor record
put_epicsPV(motor.ueip ,1,delay=.5) # encoder on
put_epicsPV(motor.ueip ,0,delay=.5) # encoder on
put_epicsPV(motor.ueip ,1,delay=.5) # encoder on
# widen soft limits temporally around aimed position
# in case the correct value is outside the current soft limits
put_epicsPV(motor.llm , LHL-10000 , delay=1) # st lower soft limit according to table
put_epicsPV(motor.hlm , LHL+10000 , delay=1) # st higher soft limit according to table
put_epicsPV(motor.set ,1,delay=1) # now allow change of coo syste cal to set m
put_epicsPV(motor.val ,LHL,delay=1) # set current position to lower limit
put_epicsPV(motor.set ,0,delay=0.5) # set co system to use
# finally drive motor out of hard limits and set the correct soft limits
put_epicsPV(motor.twv,0.1,delay=1.) # set tweak value to 100 mum as default
put_epicsPV(motor.twf ,1,delay=2.) # tweak out of hard limit
put_epicsPV(motor.llm , LHL+0.05 , delay=0.5) # st lower soft limit according to table
put_epicsPV(motor.hlm , HHL-0.05 , delay=0.5) # st higher soft limit according to table
#endif
if LIM == 'high':
move_and_wait(motor ,x_ini+total_range*1.07,check_moving=1) # move to high limits
# now check whether we are in the limit
if get_epicsPV(motor.hls) == 0:
print(' hard limit not reached',motor.val)
stop
else:
print(' hard limit reached',motor.val)
#endelse
# now set coordinate system according to limits
put_epicsPV(motor.ueip ,1,delay=.5) # encoder on
# widen soft limits temporally around aimed position
# in case the correct value is outside the current soft limits
put_epicsPV(motor.llm , LHL-10000 , delay=1) # st lower soft limit according to table
put_epicsPV(motor.hlm , LHL+10000 , delay=1) # st higher soft limit according to table
put_epicsPV(motor.set ,1,delay=0.5) # now allow change of coo syste cal to set m
put_epicsPV(motor.val ,HHL,delay=0.5) # set current position to lower limit
put_epicsPV(motor.set ,0,delay=0.5) # set coo system to use
# finally set the soft limits
put_epicsPV(motor.twv,0.1,delay=0.5) # set tweak value to 100 mum as default
put_epicsPV(motor.twr ,1,delay=2.) # tweak out of hard limit to lower values
put_epicsPV(motor.llm , LHL+0.05 , delay=0.2) # st lower soft limit according to table
put_epicsPV(motor.hlm , HHL-0.05 , delay=0.2) # st higher soft limit according to table
#endif
#end
def init_two_motors(mot1=' ',mot2=' ',HHL_1=0,LHL_1=0,HHL_2=0,LHL_2=0,LIM='low',set_offset='variable'):
# initialization for givrn location of limit switch
# initializes 2 motors with simultaneous movemnets into the same direction
#
motor_1=define_motor_kb(mot1)
motor_2=define_motor_kb(mot2)
total_range_1 = abs(HHL_1-LHL_1)
total_range_2 = abs(HHL_2-LHL_2)
# general settings
if set_offset == 'frozen':
put_epicsPV(motor_1.foff,1,delay=0.2) # offset to frozen as we do not initialize
put_epicsPV(motor_2.foff,1,delay=0.2) # offset to frozen as we do not initialize
else:
put_epicsPV(motor_1.foff,0,delay=0.2) # offset to variable if needed
put_epicsPV(motor_2.foff,0,delay=0.2) # offset to variable if needed
#endif
put_epicsPV(motor_1.twv,0.1,delay=0.2) # set tweak value to 100 mum as default
put_epicsPV(motor_2.twv,0.1,delay=0.2) # set tweak value to 100 mum as default
put_epicsPV(motor_1.ueip , 0 ,delay=.5) # switch encoder off
put_epicsPV(motor_2.ueip , 0 ,delay=.5) # switch encoder off
# first remember start values
x_ini_1=get_epicsPV(motor_1.val)
x_ini_2=get_epicsPV(motor_2.val)
print x_ini_1,x_ini_2
# now remove soft limits allow start value plus total range as maximum
put_epicsPV(motor_1.hlm ,x_ini_1 + total_range_1*1.15 ,delay=.5) # switch encoder off
put_epicsPV(motor_1.llm ,x_ini_1 - total_range_1*1.15 ,delay=.5) # switch encoder off
put_epicsPV(motor_2.hlm ,x_ini_2 + total_range_2*1.15 ,delay=.5) # switch encoder off
put_epicsPV(motor_2.llm ,x_ini_2 - total_range_2*1.15 ,delay=.5) # switch encoder off
# now move to lower limit
if LIM == 'low':
move_and_wait_2motors(motor_1,motor_2 ,x_ini_1-total_range_1*1.07,x_ini_2-total_range_2*1.07,check_moving=1)
# now check whether we are in the limit
if ((get_epicsPV(motor_1.lls) == 0 ) or (get_epicsPV(motor_2.lls) == 0 )) :
print(' hard limit not reached',motor_1.val)
print(' hard limit not reached',motor_2.val)
stop
else:
print(' hard limit reached',motor_1.val)
print(' hard limit reached',motor_2.val)
#endelse
# Now both motors are in the hard limit
# now set coordinate system according to limits
# endcoder on / off twice to account for bug in motor record
put_epicsPV(motor_1.ueip ,1,delay=.5) # encoder on
put_epicsPV(motor_1.ueip ,0,delay=.5) # encoder on
put_epicsPV(motor_1.ueip ,1,delay=.5) # encoder on
put_epicsPV(motor_2.ueip ,1,delay=.5) # encoder on
put_epicsPV(motor_2.ueip ,0,delay=.5) # encoder on
put_epicsPV(motor_2.ueip ,1,delay=.5) # encoder on
# widen soft limits temporally around aimed position
# in case the correct value is outside the current soft limits
put_epicsPV(motor_1.llm , LHL_1-10000 , delay=1) # st lower soft limit according to table
put_epicsPV(motor_1.hlm , LHL_1+10000 , delay=1) # st higher soft limit according to table
put_epicsPV(motor_2.llm , LHL_2-10000 , delay=1) # st lower soft limit according to table
put_epicsPV(motor_2.hlm , LHL_2+10000 , delay=1) # st higher soft limit according to table
put_epicsPV(motor_1.set ,1,delay=1) # now allow change of coo syste cal to set m
put_epicsPV(motor_2.set ,1,delay=1) # now allow change of coo syste cal to set m
put_epicsPV(motor_1.val ,LHL_1,delay=1) # set current position to lower limit
put_epicsPV(motor_2.val ,LHL_2,delay=1) # set current position to lower limit
put_epicsPV(motor_1.set ,0,delay=0.5) # set co system to use
put_epicsPV(motor_2.set ,0,delay=0.5) # set co system to use
# finally drive motor out of hard limits and set the correct soft limits
put_epicsPV(motor_1.twv,0.1,delay=1.) # set tweak value to 100 mum as default
put_epicsPV(motor_1.twf ,1,delay=2.) # tweak out of hard limit
put_epicsPV(motor_1.llm , LHL_1+0.05 , delay=0.5) # st lower soft limit according to table
put_epicsPV(motor_1.hlm , HHL_1-0.05 , delay=0.5) # st higher soft limit according to table
put_epicsPV(motor_2.twv,0.1,delay=1.) # set tweak value to 100 mum as default
put_epicsPV(motor_2.twf ,1,delay=2.) # tweak out of hard limit
put_epicsPV(motor_2.llm , LHL_2+0.05 , delay=0.5) # st lower soft limit according to table
put_epicsPV(motor_2.hlm , HHL_2-0.05 , delay=0.5) # st higher soft limit according to table
#endif
if LIM == 'high':
print ' not implemented yet'
stop
move_and_wait(motor ,x_ini+total_range*1.07,check_moving=1) # move to high limits
# now check whether we are in the limit
if get_epicsPV(motor.hls) == 0:
print(' hard limit not reached',motor.val)
stop
else:
print(' hard limit reached',motor.val)
#endelse
# now set coordinate system according to limits
put_epicsPV(motor.ueip ,1,delay=.5) # encoder on
# widen soft limits temporally around aimed position
# in case the correct value is outside the current soft limits
put_epicsPV(motor.llm , LHL-10000 , delay=1) # st lower soft limit according to table
put_epicsPV(motor.hlm , LHL+10000 , delay=1) # st higher soft limit according to table
put_epicsPV(motor.set ,1,delay=0.5) # now allow change of coo syste cal to set m
put_epicsPV(motor.val ,HHL,delay=0.5) # set current position to lower limit
put_epicsPV(motor.set ,0,delay=0.5) # set coo system to use
# finally set the soft limits
put_epicsPV(motor.twv,0.1,delay=0.5) # set tweak value to 100 mum as default
put_epicsPV(motor.twr ,1,delay=2.) # tweak out of hard limit to lower values
put_epicsPV(motor.llm , LHL+0.05 , delay=0.2) # st lower soft limit according to table
put_epicsPV(motor.hlm , HHL-0.05 , delay=0.2) # st higher soft limit according to table
#endif
#end
def Next_Point():
sp1=np.zeros(2048)
sp2=np.zeros(2048)
sp3=np.zeros(2048)
sp4=np.zeros(2048)
d1 = 0
d2 = 0
d3 = 0
d4 = 0
#print('erasestart')
put_epicsPV('X07MB-XMAP:EraseStart',1,delay=.03)
#print('erasestart')
#time.sleep(.1)
put_epicsPV('X07MB-OP2:SMPL',1,delay=.03)
Wait_for_Value("X07MB-OP2:SMPL-DONE",1)
put_epicsPV('X07MB-XMAP:StopAll',1,delay=.03)
sp1_old=sp1
sp2_old=sp2
sp3_old=sp3
sp4_old=sp4
d1_old=d1
d2_old=d2
d3_old=d3
d4_old=d4
sp1=get_epicsPV('X07MB-XMAP:mca1.VAL')
sp2=get_epicsPV('X07MB-XMAP:mca2.VAL')
sp3=get_epicsPV('X07MB-XMAP:mca3.VAL')
sp4=get_epicsPV('X07MB-XMAP:mca4.VAL')
d1=get_epicsPV('X07MB-XMAP:mca1.DTIM')
d2=get_epicsPV('X07MB-XMAP:mca2.DTIM')
d3=get_epicsPV('X07MB-XMAP:mca3.DTIM')
d4=get_epicsPV('X07MB-XMAP:mca4.DTIM')
print('differences',max(sp1-sp1_old),max(sp2-sp2_old),max(sp3-sp3_old),max(sp4-sp4_old))
print('differences',d1-d1_old,d2-d2_old,d3-d3_old,d4-d4_old)
time.sleep(.5)
# end
init_PV()
N=10000000
for i in range(N):
Next_Point()
#endwhile

View File

@ -0,0 +1,33 @@
import time
import MyLib as ML
channels=['X07MB-MA:ScanX.RBV']
import epics as ep
def init_PV(channels):
PV = []
for i in range(len(channels)):
print('init',i,)
PV.append(ep.camonitor(channels[i]))
#endfor
return PV
#end
def read_all(channels):
res=[]
for i in range(len(channels)):
print('read',i)
res.append(PV[i].get())
#endfor
#end
PV=init_PV(channels)
n_ch=len(channels)
print(PV)
asdasd
for i in range(n_ch):
print(i)
w=read_all(channels)
print(w)
#endfor

View File

@ -0,0 +1 @@
camon X07MB-ES-MA1:ScanX.RBV

View File

@ -0,0 +1 @@
camon X07MB-ES1-MA1:ScanX.RBV

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,73 @@
"""
test script for linescans
"""
# from unittest import mock
import numpy as np
# import pandas
# import pytest
# from bec_lib import messages
# import device_server
# from ophyd import Component as Cpt
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
# from ophyd import FormattedComponent as FCpt
# from ophyd import Kind, PVPositioner, Signal
# from ophyd.flyers import FlyerInterface
# from ophyd.pv_positioner import PVPositionerComparator
# from ophyd.status import DeviceStatus, SubscriptionStatus
import time as tt
# import ophyd
import os
import sys
logger = bec_logger.logger
# load simulation
# bec.config.load_demo_config()
# bec.config.update_session_with_file("config/config_1.yaml")
# create PHOENIX base configuration
load_data=True
if load_data == True:
phoenix.create_base_config()
phoenix.add_xmap()
#endif
bec.queue.request_queue_reset()
dev.MA1_ScanX.enabled = True
dev.xmap.enabled=True
dev.xmap.unstage() # needed in case scan went wrong
print("---------------------------------")
# scan will not diode
print(" SCAN DO NOT READ DIODE ")
dev.SAI_01_MEAN.readout_priority = "monitored" # do not read detector
ti = tt.time_ns()
s1 = scans.line_scan(
dev.PP2_VO5, 0, 1, steps=4, exp_time=1, relative=False, delay=2)
#s1 = scans.line_scan(dev.MA1_ScanX, 0, 0.1, steps=4, exp_time=1, relative=False, delay=2)
tf = tt.time_ns()
dev.PH_TTL.start_csmpl.put(0)
print("elapsed time", (tf - ti) / 1e9)
# scan will read diode
print(" SCAN READ DIODE ")
tt.sleep(2)
# next lines do not work as pandas is not installed on test system
res1 = s1.scan.to_pandas()
re1 = res1.to_numpy()
print("Scana")
print(res1)
print("")

View File

@ -0,0 +1,72 @@
"""
test script for linescans
"""
# from unittest import mock
import numpy as np
# import pandas
# import pytest
# from bec_lib import messages
# import device_server
# from ophyd import Component as Cpt
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
# from ophyd import FormattedComponent as FCpt
# from ophyd import Kind, PVPositioner, Signal
# from ophyd.flyers import FlyerInterface
# from ophyd.pv_positioner import PVPositionerComparator
# from ophyd.status import DeviceStatus, SubscriptionStatus
import time as tt
# import ophyd
import os
import sys
# logger = bec_logger.logger
# load simulation
# bec.config.load_demo_config()
# bec.config.update_session_with_file("config/config_1.yaml")
# create PHOENIX base configuration
phoenix.create_base_config()
dev.MA1_ScanX.enabled = True
print("---------------------------------")
# scan will not diode
print(" SCAN DO NOT READ DIODE ")
dev.SAI_01_MEAN.readout_priority = "baseline" # do not read detector
ti = tt.time_ns()
phoenix.run_shell("sh monitor.sh > monitor.out & ")
asdhjk
s1 = scans.line_scan(dev.MA1_ScanX, 0, 0.002, steps=4, exp_time=1, relative=False, delay=2)
tf = tt.time_ns()
print("elapsed time", (tf - ti) / 1e9)
# scan will read diode
print(" SCAN READ DIODE ")
tt.sleep(2)
dev.SAI_01_MEAN.readout_priority = "monitored" # read detector
s2 = scans.line_scan(dev.MA1_ScanX, 0, 0.002, steps=11, exp_time=0.01, relative=False, delay=2)
dev.MA1_ScanX.enabled = False
# next lines do not work as pandas is not installed on test system
res1 = s1.scan.to_pandas()
re1 = res1.to_numpy()
print("Scana")
print(res1)
print("")
print("Scan2 at pandas ")
print(res2)
print("Scan2 as numpy ")
print(res2)

View File

@ -0,0 +1,513 @@
258.3017885684967 sec Dummy_device Dummy_PSIDetector.__init__
258.3085923194885 sec Dummy_device Dummy_PSIDetector._update_scaninfo
258.315456867218 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
258.3181173801422 sec Dummy_device Dummy_PSIDetector._update_filewriter
258.3209879398346 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
258.32397651672363 sec Dummy_device Dummy_PSIDetector._init
258.3270974159241 sec Dummy_device Dummy_PSIDetector._init ... done
258.3299674987793 sec Dummy_device Dummy_PSIDetector._update_service_config
258.33247351646423 sec Dummy_device Dummy_PSIDetector._update_scaninfo
258.33590173721313 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
258.3385784626007 sec Dummy_device Dummy_PSIDetector._update_filewriter
258.34114718437195 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
258.34365034103394 sec Dummy_device Dummy_PSIDetector._init
258.3460626602173 sec Dummy_device Dummy_PSIDetector._init ... done
258.348486661911 sec Dummy_device Dummy_PSIDetector.__init__ .. done
273.28097581863403 sec Dummy_device Dummy_PSIDetector.__init__
273.2839708328247 sec Dummy_device Dummy_PSIDetector._update_scaninfo
273.28703570365906 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
273.28923439979553 sec Dummy_device Dummy_PSIDetector._update_filewriter
273.29163694381714 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
273.2945909500122 sec Dummy_device Dummy_PSIDetector._init
273.29863691329956 sec Dummy_device Dummy_PSIDetector._init ... done
273.3010427951813 sec Dummy_device Dummy_PSIDetector._update_service_config
273.3033182621002 sec Dummy_device Dummy_PSIDetector._update_scaninfo
273.3065254688263 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
273.3088366985321 sec Dummy_device Dummy_PSIDetector._update_filewriter
273.31172704696655 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
273.31443309783936 sec Dummy_device Dummy_PSIDetector._init
273.3175792694092 sec Dummy_device Dummy_PSIDetector._init ... done
273.31978011131287 sec Dummy_device Dummy_PSIDetector.__init__ .. done
318.5410006046295 sec Dummy_device Dummy_PSIDetector.__init__
318.5440480709076 sec Dummy_device Dummy_PSIDetector._update_scaninfo
318.5478036403656 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
318.5504558086395 sec Dummy_device Dummy_PSIDetector._update_filewriter
318.5526340007782 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
318.5549247264862 sec Dummy_device Dummy_PSIDetector._init
318.5572078227997 sec Dummy_device Dummy_PSIDetector._init ... done
318.55954241752625 sec Dummy_device Dummy_PSIDetector._update_service_config
318.5614619255066 sec Dummy_device Dummy_PSIDetector._update_scaninfo
318.56455636024475 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
318.56680154800415 sec Dummy_device Dummy_PSIDetector._update_filewriter
318.56896591186523 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
318.5713827610016 sec Dummy_device Dummy_PSIDetector._init
318.57353615760803 sec Dummy_device Dummy_PSIDetector._init ... done
318.5840895175934 sec Dummy_device Dummy_PSIDetector.__init__ .. done
319.48665595054626 sec Dummy_device Dummy_PSIDetector.stage
319.4943518638611 sec Dummy_device Dummy_PSIDetector.stage done
320.14649772644043 sec Dummy_device Dummy_PSIDetector.pre_scan
320.1493499279022 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
322.0216338634491 sec Dummy_device Dummy_PSIDetector.complete
322.02455163002014 sec Dummy_device Dummy_PSIDetector.complete ... done
322.0301237106323 sec Dummy_device Dummy_PSIDetector.unstage
322.0323655605316 sec Dummy_device Dummy_PSIDetector.check_scan_id
322.03556275367737 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
322.0434696674347 sec Dummy_device Dummy_PSIDetector.unstage .. done
322.0462124347687 sec Dummy_device Dummy_PSIDetector.check_scan_id
322.049613237381 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
325.49065828323364 sec Dummy_device Dummy_PSIDetector.stage
325.49778604507446 sec Dummy_device Dummy_PSIDetector.stage done
326.2169315814972 sec Dummy_device Dummy_PSIDetector.pre_scan
326.2199287414551 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
333.2339792251587 sec Dummy_device Dummy_PSIDetector.complete
333.2387444972992 sec Dummy_device Dummy_PSIDetector.complete ... done
333.2450532913208 sec Dummy_device Dummy_PSIDetector.unstage
333.2477023601532 sec Dummy_device Dummy_PSIDetector.check_scan_id
333.252215385437 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
333.2547912597656 sec Dummy_device Dummy_PSIDetector.unstage .. done
333.25732684135437 sec Dummy_device Dummy_PSIDetector.check_scan_id
333.2605242729187 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
383.52448415756226 sec Dummy_device Dummy_PSIDetector.__init__
383.5282344818115 sec Dummy_device Dummy_PSIDetector._update_scaninfo
383.53171586990356 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
383.5346601009369 sec Dummy_device Dummy_PSIDetector._update_filewriter
383.53747296333313 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
383.5405652523041 sec Dummy_device Dummy_PSIDetector._init
383.5436053276062 sec Dummy_device Dummy_PSIDetector._init ... done
383.5470070838928 sec Dummy_device Dummy_PSIDetector._update_service_config
383.5498764514923 sec Dummy_device Dummy_PSIDetector._update_scaninfo
383.553973197937 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
383.5567262172699 sec Dummy_device Dummy_PSIDetector._update_filewriter
383.5595018863678 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
383.5622727870941 sec Dummy_device Dummy_PSIDetector._init
383.56509137153625 sec Dummy_device Dummy_PSIDetector._init ... done
383.56781673431396 sec Dummy_device Dummy_PSIDetector.__init__ .. done
384.4197027683258 sec Dummy_device Dummy_PSIDetector.stage
384.4258131980896 sec Dummy_device Dummy_PSIDetector.stage done
385.1663706302643 sec Dummy_device Dummy_PSIDetector.pre_scan
385.17092657089233 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
387.17647194862366 sec Dummy_device Dummy_PSIDetector.complete
387.1801919937134 sec Dummy_device Dummy_PSIDetector.complete ... done
387.18778562545776 sec Dummy_device Dummy_PSIDetector.unstage
387.19075655937195 sec Dummy_device Dummy_PSIDetector.check_scan_id
387.1947159767151 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
387.19729018211365 sec Dummy_device Dummy_PSIDetector.unstage .. done
387.2002501487732 sec Dummy_device Dummy_PSIDetector.check_scan_id
387.2042922973633 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
390.5967915058136 sec Dummy_device Dummy_PSIDetector.stage
390.6016550064087 sec Dummy_device Dummy_PSIDetector.stage done
391.31412744522095 sec Dummy_device Dummy_PSIDetector.pre_scan
391.317245721817 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
398.2885682582855 sec Dummy_device Dummy_PSIDetector.complete
398.2922840118408 sec Dummy_device Dummy_PSIDetector.complete ... done
398.2986834049225 sec Dummy_device Dummy_PSIDetector.unstage
398.3014578819275 sec Dummy_device Dummy_PSIDetector.check_scan_id
398.305011510849 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
398.30738377571106 sec Dummy_device Dummy_PSIDetector.unstage .. done
398.30989623069763 sec Dummy_device Dummy_PSIDetector.check_scan_id
398.313679933548 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
55.712119579315186 sec Dummy_device Dummy_PSIDetector.__init__
55.71538472175598 sec Dummy_device Dummy_PSIDetector._update_scaninfo
55.72820711135864 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
55.73171591758728 sec Dummy_device Dummy_PSIDetector._update_filewriter
55.734644651412964 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
55.73781394958496 sec Dummy_device Dummy_PSIDetector._init
55.74082565307617 sec Dummy_device Dummy_PSIDetector._init ... done
55.743837118148804 sec Dummy_device Dummy_PSIDetector._update_service_config
55.74670958518982 sec Dummy_device Dummy_PSIDetector._update_scaninfo
55.75890302658081 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
55.76187348365784 sec Dummy_device Dummy_PSIDetector._update_filewriter
55.76482844352722 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
55.767723083496094 sec Dummy_device Dummy_PSIDetector._init
55.77075743675232 sec Dummy_device Dummy_PSIDetector._init ... done
55.77365469932556 sec Dummy_device Dummy_PSIDetector.__init__ .. done
56.55250263214111 sec Dummy_device Dummy_PSIDetector.stage
56.56144142150879 sec Dummy_device Dummy_PSIDetector.stage done
57.29970669746399 sec Dummy_device Dummy_PSIDetector.pre_scan
57.30306386947632 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
59.22956824302673 sec Dummy_device Dummy_PSIDetector.complete
59.23271870613098 sec Dummy_device Dummy_PSIDetector.complete ... done
59.2375168800354 sec Dummy_device Dummy_PSIDetector.unstage
59.23973989486694 sec Dummy_device Dummy_PSIDetector.check_scan_id
59.24262094497681 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
59.244933128356934 sec Dummy_device Dummy_PSIDetector.unstage .. done
59.24763607978821 sec Dummy_device Dummy_PSIDetector.check_scan_id
59.25109386444092 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
62.65221810340881 sec Dummy_device Dummy_PSIDetector.stage
62.656172037124634 sec Dummy_device Dummy_PSIDetector.stage done
63.31900715827942 sec Dummy_device Dummy_PSIDetector.pre_scan
63.32232117652893 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
70.31378293037415 sec Dummy_device Dummy_PSIDetector.complete
70.31722259521484 sec Dummy_device Dummy_PSIDetector.complete ... done
70.32310819625854 sec Dummy_device Dummy_PSIDetector.unstage
70.32593488693237 sec Dummy_device Dummy_PSIDetector.check_scan_id
70.32954263687134 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
70.3320255279541 sec Dummy_device Dummy_PSIDetector.unstage .. done
70.33445334434509 sec Dummy_device Dummy_PSIDetector.check_scan_id
70.33776235580444 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
230.2806589603424 sec Dummy_device Dummy_PSIDetector.__init__
230.2841832637787 sec Dummy_device Dummy_PSIDetector._update_scaninfo
230.28762674331665 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
230.2903938293457 sec Dummy_device Dummy_PSIDetector._update_filewriter
230.29354524612427 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
230.29628920555115 sec Dummy_device Dummy_PSIDetector._init
230.2988178730011 sec Dummy_device Dummy_PSIDetector._init ... done
230.30137276649475 sec Dummy_device Dummy_PSIDetector._update_service_config
230.30426454544067 sec Dummy_device Dummy_PSIDetector._update_scaninfo
230.30788803100586 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
230.3148958683014 sec Dummy_device Dummy_PSIDetector._update_filewriter
230.31744003295898 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
230.3200912475586 sec Dummy_device Dummy_PSIDetector._init
230.32251811027527 sec Dummy_device Dummy_PSIDetector._init ... done
230.3249213695526 sec Dummy_device Dummy_PSIDetector.__init__ .. done
95.54364109039307 sec Dummy_device Dummy_PSIDetector.__init__
95.55088138580322 sec Dummy_device Dummy_PSIDetector._update_scaninfo
95.55566167831421 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
95.55822157859802 sec Dummy_device Dummy_PSIDetector._update_filewriter
95.56095170974731 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
95.56354069709778 sec Dummy_device Dummy_PSIDetector._init
95.56620073318481 sec Dummy_device Dummy_PSIDetector._init ... done
95.56886649131775 sec Dummy_device Dummy_PSIDetector._update_service_config
95.57119488716125 sec Dummy_device Dummy_PSIDetector._update_scaninfo
95.57833242416382 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
95.58116269111633 sec Dummy_device Dummy_PSIDetector._update_filewriter
95.58369874954224 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
95.58608078956604 sec Dummy_device Dummy_PSIDetector._init
95.58928394317627 sec Dummy_device Dummy_PSIDetector._init ... done
95.59169387817383 sec Dummy_device Dummy_PSIDetector.__init__ .. done
122.57217597961426 sec Dummy_device Dummy_PSIDetector.__init__
122.57641291618347 sec Dummy_device Dummy_PSIDetector._update_scaninfo
122.57983541488647 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
122.58276462554932 sec Dummy_device Dummy_PSIDetector._update_filewriter
122.58589124679565 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
122.5887725353241 sec Dummy_device Dummy_PSIDetector._init
122.59162330627441 sec Dummy_device Dummy_PSIDetector._init ... done
122.59505033493042 sec Dummy_device Dummy_PSIDetector._update_service_config
122.60520505905151 sec Dummy_device Dummy_PSIDetector._update_scaninfo
122.60943651199341 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
122.61239290237427 sec Dummy_device Dummy_PSIDetector._update_filewriter
122.61533832550049 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
122.61793851852417 sec Dummy_device Dummy_PSIDetector._init
122.62070679664612 sec Dummy_device Dummy_PSIDetector._init ... done
122.62477135658264 sec Dummy_device Dummy_PSIDetector.__init__ .. done
107.0432550907135 sec Dummy_device Dummy_PSIDetector.__init__
107.04688167572021 sec Dummy_device Dummy_PSIDetector._update_scaninfo
107.05029559135437 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
107.05297303199768 sec Dummy_device Dummy_PSIDetector._update_filewriter
107.05624318122864 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
107.0593614578247 sec Dummy_device Dummy_PSIDetector._init
107.06229066848755 sec Dummy_device Dummy_PSIDetector._init ... done
107.06521582603455 sec Dummy_device Dummy_PSIDetector._update_service_config
107.06809163093567 sec Dummy_device Dummy_PSIDetector._update_scaninfo
107.07408380508423 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
107.07719945907593 sec Dummy_device Dummy_PSIDetector._update_filewriter
107.08207726478577 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
107.08525776863098 sec Dummy_device Dummy_PSIDetector._init
107.08839154243469 sec Dummy_device Dummy_PSIDetector._init ... done
107.091153383255 sec Dummy_device Dummy_PSIDetector.__init__ .. done
125.38539528846741 sec Dummy_device Dummy_PSIDetector.__init__
125.38865613937378 sec Dummy_device Dummy_PSIDetector._update_scaninfo
125.39200568199158 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
125.39495873451233 sec Dummy_device Dummy_PSIDetector._update_filewriter
125.39762306213379 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
125.40058827400208 sec Dummy_device Dummy_PSIDetector._init
125.40388655662537 sec Dummy_device Dummy_PSIDetector._init ... done
125.40676546096802 sec Dummy_device Dummy_PSIDetector._update_service_config
125.40919518470764 sec Dummy_device Dummy_PSIDetector._update_scaninfo
125.41260886192322 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
125.4149432182312 sec Dummy_device Dummy_PSIDetector._update_filewriter
125.41725778579712 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
125.41977047920227 sec Dummy_device Dummy_PSIDetector._init
125.4225537776947 sec Dummy_device Dummy_PSIDetector._init ... done
125.42497134208679 sec Dummy_device Dummy_PSIDetector.__init__ .. done
240.22587060928345 sec Dummy_device Dummy_PSIDetector.__init__
240.22946453094482 sec Dummy_device Dummy_PSIDetector._update_scaninfo
240.23306703567505 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
240.23666286468506 sec Dummy_device Dummy_PSIDetector._update_filewriter
240.24055981636047 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
240.2433557510376 sec Dummy_device Dummy_PSIDetector._init
240.24579644203186 sec Dummy_device Dummy_PSIDetector._init ... done
240.2483983039856 sec Dummy_device Dummy_PSIDetector._update_service_config
240.2509183883667 sec Dummy_device Dummy_PSIDetector._update_scaninfo
240.254554271698 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
240.25772190093994 sec Dummy_device Dummy_PSIDetector._update_filewriter
240.26073122024536 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
240.2632761001587 sec Dummy_device Dummy_PSIDetector._init
240.26823139190674 sec Dummy_device Dummy_PSIDetector._init ... done
240.27151918411255 sec Dummy_device Dummy_PSIDetector.__init__ .. done
336.71218276023865 sec Dummy_device Dummy_PSIDetector.__init__
336.7164421081543 sec Dummy_device Dummy_PSIDetector._update_scaninfo
336.7255961894989 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
336.7289445400238 sec Dummy_device Dummy_PSIDetector._update_filewriter
336.7329602241516 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
336.7363522052765 sec Dummy_device Dummy_PSIDetector._init
336.73995661735535 sec Dummy_device Dummy_PSIDetector._init ... done
336.7464373111725 sec Dummy_device Dummy_PSIDetector._update_service_config
336.75028443336487 sec Dummy_device Dummy_PSIDetector._update_scaninfo
336.7545552253723 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
336.7576735019684 sec Dummy_device Dummy_PSIDetector._update_filewriter
336.76090717315674 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
336.7639853954315 sec Dummy_device Dummy_PSIDetector._init
336.7671637535095 sec Dummy_device Dummy_PSIDetector._init ... done
336.77041029930115 sec Dummy_device Dummy_PSIDetector.__init__ .. done
440.15757870674133 sec Dummy_device Dummy_PSIDetector.__init__
440.16116285324097 sec Dummy_device Dummy_PSIDetector._update_scaninfo
440.16435194015503 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
440.16683554649353 sec Dummy_device Dummy_PSIDetector._update_filewriter
440.1695673465729 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
440.1722664833069 sec Dummy_device Dummy_PSIDetector._init
440.1750702857971 sec Dummy_device Dummy_PSIDetector._init ... done
440.1782214641571 sec Dummy_device Dummy_PSIDetector._update_service_config
440.1812493801117 sec Dummy_device Dummy_PSIDetector._update_scaninfo
440.19190526008606 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
440.19455003738403 sec Dummy_device Dummy_PSIDetector._update_filewriter
440.1971185207367 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
440.1997950077057 sec Dummy_device Dummy_PSIDetector._init
440.2028238773346 sec Dummy_device Dummy_PSIDetector._init ... done
440.2053735256195 sec Dummy_device Dummy_PSIDetector.__init__ .. done
448.7176239490509 sec Dummy_device Dummy_PSIDetector.__init__
448.7208425998688 sec Dummy_device Dummy_PSIDetector._update_scaninfo
448.724422454834 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
448.72714829444885 sec Dummy_device Dummy_PSIDetector._update_filewriter
448.72995138168335 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
448.73266077041626 sec Dummy_device Dummy_PSIDetector._init
448.73561096191406 sec Dummy_device Dummy_PSIDetector._init ... done
448.73833537101746 sec Dummy_device Dummy_PSIDetector._update_service_config
448.7411322593689 sec Dummy_device Dummy_PSIDetector._update_scaninfo
448.744580745697 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
448.7474892139435 sec Dummy_device Dummy_PSIDetector._update_filewriter
448.7504150867462 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
448.75304079055786 sec Dummy_device Dummy_PSIDetector._init
448.7556526660919 sec Dummy_device Dummy_PSIDetector._init ... done
448.75805735588074 sec Dummy_device Dummy_PSIDetector.__init__ .. done
449.67220664024353 sec Dummy_device Dummy_PSIDetector.stage
449.67666006088257 sec Dummy_device Dummy_PSIDetector.stage done
450.35275387763977 sec Dummy_device Dummy_PSIDetector.pre_scan
450.35644245147705 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
452.2964699268341 sec Dummy_device Dummy_PSIDetector.complete
452.2998161315918 sec Dummy_device Dummy_PSIDetector.complete ... done
452.3060998916626 sec Dummy_device Dummy_PSIDetector.unstage
452.30941367149353 sec Dummy_device Dummy_PSIDetector.check_scan_id
452.31272315979004 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
452.31540155410767 sec Dummy_device Dummy_PSIDetector.unstage .. done
452.3178186416626 sec Dummy_device Dummy_PSIDetector.check_scan_id
452.3210325241089 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
455.73230934143066 sec Dummy_device Dummy_PSIDetector.stage
455.73638582229614 sec Dummy_device Dummy_PSIDetector.stage done
456.4665324687958 sec Dummy_device Dummy_PSIDetector.pre_scan
456.4696660041809 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
463.4272403717041 sec Dummy_device Dummy_PSIDetector.complete
463.4405252933502 sec Dummy_device Dummy_PSIDetector.complete ... done
463.46015453338623 sec Dummy_device Dummy_PSIDetector.unstage
463.4632029533386 sec Dummy_device Dummy_PSIDetector.check_scan_id
463.4672119617462 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
463.4705789089203 sec Dummy_device Dummy_PSIDetector.unstage .. done
463.47444796562195 sec Dummy_device Dummy_PSIDetector.check_scan_id
463.4784984588623 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
534.1574292182922 sec Dummy_device Dummy_PSIDetector.__init__
534.161062002182 sec Dummy_device Dummy_PSIDetector._update_scaninfo
534.167254447937 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
534.1703021526337 sec Dummy_device Dummy_PSIDetector._update_filewriter
534.1736783981323 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
534.1766662597656 sec Dummy_device Dummy_PSIDetector._init
534.1794040203094 sec Dummy_device Dummy_PSIDetector._init ... done
534.1823811531067 sec Dummy_device Dummy_PSIDetector._update_service_config
534.2018411159515 sec Dummy_device Dummy_PSIDetector._update_scaninfo
534.2123966217041 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
534.2163343429565 sec Dummy_device Dummy_PSIDetector._update_filewriter
534.2226631641388 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
534.2264795303345 sec Dummy_device Dummy_PSIDetector._init
534.2294256687164 sec Dummy_device Dummy_PSIDetector._init ... done
534.2324883937836 sec Dummy_device Dummy_PSIDetector.__init__ .. done
598.7346422672272 sec Dummy_device Dummy_PSIDetector.__init__
598.7380158901215 sec Dummy_device Dummy_PSIDetector._update_scaninfo
598.7417516708374 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
598.7443566322327 sec Dummy_device Dummy_PSIDetector._update_filewriter
598.7471566200256 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
598.7500152587891 sec Dummy_device Dummy_PSIDetector._init
598.7526416778564 sec Dummy_device Dummy_PSIDetector._init ... done
598.7552354335785 sec Dummy_device Dummy_PSIDetector._update_service_config
598.7579991817474 sec Dummy_device Dummy_PSIDetector._update_scaninfo
598.7619400024414 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
598.7644789218903 sec Dummy_device Dummy_PSIDetector._update_filewriter
598.7724177837372 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
598.7756130695343 sec Dummy_device Dummy_PSIDetector._init
598.7785928249359 sec Dummy_device Dummy_PSIDetector._init ... done
598.7815330028534 sec Dummy_device Dummy_PSIDetector.__init__ .. done
7.837775468826294 sec Dummy_device Dummy_PSIDetector.__init__
7.84122633934021 sec Dummy_device Dummy_PSIDetector._update_scaninfo
7.845379829406738 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
7.8486504554748535 sec Dummy_device Dummy_PSIDetector._update_filewriter
7.851677179336548 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
7.862502336502075 sec Dummy_device Dummy_PSIDetector._init
7.865923643112183 sec Dummy_device Dummy_PSIDetector._init ... done
7.868553876876831 sec Dummy_device Dummy_PSIDetector._update_service_config
7.8712639808654785 sec Dummy_device Dummy_PSIDetector._update_scaninfo
7.8751060962677 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
7.878670930862427 sec Dummy_device Dummy_PSIDetector._update_filewriter
7.881458520889282 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
7.88470196723938 sec Dummy_device Dummy_PSIDetector._init
7.887582302093506 sec Dummy_device Dummy_PSIDetector._init ... done
7.8904688358306885 sec Dummy_device Dummy_PSIDetector.__init__ .. done
8.856863498687744 sec Dummy_device Dummy_PSIDetector.stage
8.876151084899902 sec Dummy_device Dummy_PSIDetector.stage done
9.585510969161987 sec Dummy_device Dummy_PSIDetector.pre_scan
9.589120864868164 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
11.556761264801025 sec Dummy_device Dummy_PSIDetector.complete
11.560120582580566 sec Dummy_device Dummy_PSIDetector.complete ... done
11.566796779632568 sec Dummy_device Dummy_PSIDetector.unstage
11.570103883743286 sec Dummy_device Dummy_PSIDetector.check_scan_id
11.574872493743896 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
11.577794790267944 sec Dummy_device Dummy_PSIDetector.unstage .. done
11.580487966537476 sec Dummy_device Dummy_PSIDetector.check_scan_id
11.584205150604248 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
14.98130464553833 sec Dummy_device Dummy_PSIDetector.stage
14.98550009727478 sec Dummy_device Dummy_PSIDetector.stage done
15.68580937385559 sec Dummy_device Dummy_PSIDetector.pre_scan
15.689151048660278 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
22.657074689865112 sec Dummy_device Dummy_PSIDetector.complete
22.662108659744263 sec Dummy_device Dummy_PSIDetector.complete ... done
22.669034719467163 sec Dummy_device Dummy_PSIDetector.unstage
22.671940326690674 sec Dummy_device Dummy_PSIDetector.check_scan_id
22.675806283950806 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
22.678316593170166 sec Dummy_device Dummy_PSIDetector.unstage .. done
22.68111252784729 sec Dummy_device Dummy_PSIDetector.check_scan_id
22.684999227523804 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
198.9285409450531 sec Dummy_device Dummy_PSIDetector.__init__
198.9362165927887 sec Dummy_device Dummy_PSIDetector._update_scaninfo
198.94056749343872 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
198.94360828399658 sec Dummy_device Dummy_PSIDetector._update_filewriter
198.94663405418396 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
198.94988799095154 sec Dummy_device Dummy_PSIDetector._init
198.95326805114746 sec Dummy_device Dummy_PSIDetector._init ... done
198.95595622062683 sec Dummy_device Dummy_PSIDetector._update_service_config
198.95901942253113 sec Dummy_device Dummy_PSIDetector._update_scaninfo
198.96562147140503 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
198.96872448921204 sec Dummy_device Dummy_PSIDetector._update_filewriter
198.97177743911743 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
198.97474718093872 sec Dummy_device Dummy_PSIDetector._init
198.97741293907166 sec Dummy_device Dummy_PSIDetector._init ... done
198.979900598526 sec Dummy_device Dummy_PSIDetector.__init__ .. done
273.58063983917236 sec Dummy_device Dummy_PSIDetector.__init__
273.5842516422272 sec Dummy_device Dummy_PSIDetector._update_scaninfo
273.587562084198 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
273.5902290344238 sec Dummy_device Dummy_PSIDetector._update_filewriter
273.5933790206909 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
273.5958044528961 sec Dummy_device Dummy_PSIDetector._init
273.598260641098 sec Dummy_device Dummy_PSIDetector._init ... done
273.60068702697754 sec Dummy_device Dummy_PSIDetector._update_service_config
273.60293459892273 sec Dummy_device Dummy_PSIDetector._update_scaninfo
273.6064066886902 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
273.60881304740906 sec Dummy_device Dummy_PSIDetector._update_filewriter
273.61149501800537 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
273.61411118507385 sec Dummy_device Dummy_PSIDetector._init
273.6163446903229 sec Dummy_device Dummy_PSIDetector._init ... done
273.6186339855194 sec Dummy_device Dummy_PSIDetector.__init__ .. done
289.1456503868103 sec Dummy_device Dummy_PSIDetector.__init__
289.14894795417786 sec Dummy_device Dummy_PSIDetector._update_scaninfo
289.15220499038696 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
289.15479493141174 sec Dummy_device Dummy_PSIDetector._update_filewriter
289.1575071811676 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
289.1601548194885 sec Dummy_device Dummy_PSIDetector._init
289.1627006530762 sec Dummy_device Dummy_PSIDetector._init ... done
289.16531777381897 sec Dummy_device Dummy_PSIDetector._update_service_config
289.16803646087646 sec Dummy_device Dummy_PSIDetector._update_scaninfo
289.17167234420776 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
289.17424416542053 sec Dummy_device Dummy_PSIDetector._update_filewriter
289.1768672466278 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
289.19212794303894 sec Dummy_device Dummy_PSIDetector._init
289.1952097415924 sec Dummy_device Dummy_PSIDetector._init ... done
289.1978967189789 sec Dummy_device Dummy_PSIDetector.__init__ .. done
293.3917553424835 sec Dummy_device Dummy_PSIDetector.__init__
293.3952159881592 sec Dummy_device Dummy_PSIDetector._update_scaninfo
293.398410320282 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
293.4014220237732 sec Dummy_device Dummy_PSIDetector._update_filewriter
293.40486550331116 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
293.40760946273804 sec Dummy_device Dummy_PSIDetector._init
293.4102578163147 sec Dummy_device Dummy_PSIDetector._init ... done
293.4129559993744 sec Dummy_device Dummy_PSIDetector._update_service_config
293.416291475296 sec Dummy_device Dummy_PSIDetector._update_scaninfo
293.4226896762848 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
293.43413949012756 sec Dummy_device Dummy_PSIDetector._update_filewriter
293.4404549598694 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
293.4433434009552 sec Dummy_device Dummy_PSIDetector._init
293.44669795036316 sec Dummy_device Dummy_PSIDetector._init ... done
293.450825214386 sec Dummy_device Dummy_PSIDetector.__init__ .. done
294.4045298099518 sec Dummy_device Dummy_PSIDetector.stage
294.41221737861633 sec Dummy_device Dummy_PSIDetector.stage done
295.0753116607666 sec Dummy_device Dummy_PSIDetector.pre_scan
295.0786409378052 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
296.9744246006012 sec Dummy_device Dummy_PSIDetector.complete
296.9783310890198 sec Dummy_device Dummy_PSIDetector.complete ... done
296.9849274158478 sec Dummy_device Dummy_PSIDetector.unstage
296.9879596233368 sec Dummy_device Dummy_PSIDetector.check_scan_id
296.9918463230133 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
296.9946928024292 sec Dummy_device Dummy_PSIDetector.unstage .. done
296.9977705478668 sec Dummy_device Dummy_PSIDetector.check_scan_id
297.00152254104614 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
300.39787578582764 sec Dummy_device Dummy_PSIDetector.stage
300.40195393562317 sec Dummy_device Dummy_PSIDetector.stage done
301.1010916233063 sec Dummy_device Dummy_PSIDetector.pre_scan
301.10465002059937 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
308.1270532608032 sec Dummy_device Dummy_PSIDetector.complete
308.1302571296692 sec Dummy_device Dummy_PSIDetector.complete ... done
308.13682293891907 sec Dummy_device Dummy_PSIDetector.unstage
308.13955307006836 sec Dummy_device Dummy_PSIDetector.check_scan_id
308.14320278167725 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
308.14579582214355 sec Dummy_device Dummy_PSIDetector.unstage .. done
308.1484956741333 sec Dummy_device Dummy_PSIDetector.check_scan_id
308.1524248123169 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
406.1815185546875 sec Dummy_device Dummy_PSIDetector.__init__
406.18433952331543 sec Dummy_device Dummy_PSIDetector._update_scaninfo
406.1875720024109 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
406.1899950504303 sec Dummy_device Dummy_PSIDetector._update_filewriter
406.19225120544434 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
406.1947364807129 sec Dummy_device Dummy_PSIDetector._init
406.1971571445465 sec Dummy_device Dummy_PSIDetector._init ... done
406.1996533870697 sec Dummy_device Dummy_PSIDetector._update_service_config
406.2021658420563 sec Dummy_device Dummy_PSIDetector._update_scaninfo
406.20517230033875 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
406.2075276374817 sec Dummy_device Dummy_PSIDetector._update_filewriter
406.2099573612213 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
406.2122435569763 sec Dummy_device Dummy_PSIDetector._init
406.21466541290283 sec Dummy_device Dummy_PSIDetector._init ... done
406.2169442176819 sec Dummy_device Dummy_PSIDetector.__init__ .. done
408.5058219432831 sec Dummy_device Dummy_PSIDetector.__init__
408.5092177391052 sec Dummy_device Dummy_PSIDetector._update_scaninfo
408.51229882240295 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
408.5166611671448 sec Dummy_device Dummy_PSIDetector._update_filewriter
408.51968693733215 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
408.52243971824646 sec Dummy_device Dummy_PSIDetector._init
408.5258412361145 sec Dummy_device Dummy_PSIDetector._init ... done
408.5286478996277 sec Dummy_device Dummy_PSIDetector._update_service_config
408.53117513656616 sec Dummy_device Dummy_PSIDetector._update_scaninfo
408.5346622467041 sec Dummy_device Dummy_PSIDetector._update_scaninfo .. done
408.5387032032013 sec Dummy_device Dummy_PSIDetector._update_filewriter
408.5484755039215 sec Dummy_device Dummy_PSIDetector._update_filewriter .. done
408.5515501499176 sec Dummy_device Dummy_PSIDetector._init
408.55432891845703 sec Dummy_device Dummy_PSIDetector._init ... done
408.55744099617004 sec Dummy_device Dummy_PSIDetector.__init__ .. done
409.36813139915466 sec Dummy_device Dummy_PSIDetector.stage
409.37291145324707 sec Dummy_device Dummy_PSIDetector.stage done
410.0452582836151 sec Dummy_device Dummy_PSIDetector.pre_scan
410.04850935935974 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
411.9517059326172 sec Dummy_device Dummy_PSIDetector.complete
411.9550929069519 sec Dummy_device Dummy_PSIDetector.complete ... done
411.9607892036438 sec Dummy_device Dummy_PSIDetector.unstage
411.9635720252991 sec Dummy_device Dummy_PSIDetector.check_scan_id
411.96782517433167 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
411.9705128669739 sec Dummy_device Dummy_PSIDetector.unstage .. done
411.97303891181946 sec Dummy_device Dummy_PSIDetector.check_scan_id
411.97616386413574 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
415.3653302192688 sec Dummy_device Dummy_PSIDetector.stage
415.36913657188416 sec Dummy_device Dummy_PSIDetector.stage done
416.0821409225464 sec Dummy_device Dummy_PSIDetector.pre_scan
416.0855324268341 sec Dummy_device Dummy_PSIDetector.pre_scan .. done
422.92456674575806 sec Dummy_device Dummy_PSIDetector.complete
422.92839455604553 sec Dummy_device Dummy_PSIDetector.complete ... done
422.93567180633545 sec Dummy_device Dummy_PSIDetector.unstage
422.9386281967163 sec Dummy_device Dummy_PSIDetector.check_scan_id
422.9420807361603 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done
422.94424176216125 sec Dummy_device Dummy_PSIDetector.unstage .. done
422.9465448856354 sec Dummy_device Dummy_PSIDetector.check_scan_id
422.94983959198 sec Dummy_device Dummy_PSIDetector.check_scan_id .. done

View File

@ -0,0 +1 @@
camonitor X07MB-ES-MA1:ScanX.VAL X07MB-ES-MA1:ScanX.RBV X07MB-OP2:START-CSMPL X07MB-OP2:SMPL X07MB-OP2:INTR-COUNT X07MB-XMAP:StartAll X07MB-XMAP:EraseStart X07MB-XMAP:StopAll

View File

@ -1,6 +1,13 @@
"""
General collection of calsses for PHEONIX beamline
"""
# from unittest import mock
import os
import sys
# import sys
import time
import numpy as np
@ -10,7 +17,7 @@ import numpy as np
# from bec_lib import messages
# import device_server
# from ophyd import Component as Cpt
from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
# from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
# from ophyd import FormattedComponent as FCpt
# from ophyd import Kind, PVPositioner, Signal
@ -21,6 +28,8 @@ from ophyd import Device, EpicsMotor, EpicsSignal, EpicsSignalRO
from bec_lib.config_helper import ConfigHelper
from bec_lib.logger import bec_logger
from phoenix_bec.scripts.phoenix_help import PhoenixHelp
logger = bec_logger.logger
@ -32,7 +41,90 @@ logger = bec_logger.logger
# .. define base path for directory with scripts
class PhoenixBL:
class Utilities:
"""
Utiliy class for PHOENIX
"""
def __init__(self):
print("init phoenix.Utilities")
# setattr(self, "description", description)
# atribute 'label' for compatibility woith La groups...
# setattr(self, "label", description)
# if type(NameTag)==list:
# for i in NameTag:
# setattr(self,i,None)
# #endfor
# else:
# setattr(self,NameTag,None)
# endif
def list_signals_(self, cls=None, check=False):
"""
Create a list of all signals in a device
including name of Epics channel
"""
print("List of all Signals")
print("......try also attributes")
print(" .describe_configuration()")
print(" ._info")
try:
name = cls.name
n_name = len(name)
except:
name = " "
try:
config = cls._info["describe"]
except:
config = " "
# endexcept
# print(config)
try:
for kk in config.keys():
print(kk[n_name + 1 : 40], config[kk]["source"])
# print('dev.'+def __init__():
# kk.replace('_','.'),' ',config[kk]['source'])
# endexcept
except:
print(config)
print("no key")
def list_signals_falcon(self):
"""
List signals for falcon
"""
print("........... dev.falcon ")
self.list_signals_(dev.falcon)
print("........... falcon.mca1 ")
self.list_signals_(dev.falcon.mca1)
print("........... falcon.dxp1 ")
self.list_signals_(dev.falcon.dxp1)
print("........... falcon.roi0")
self.list_signals_(dev.falcon.roi0)
def list_signals_xmap(self):
"""
List signals for XMAP
"""
print("........... dev.xmap ")
self.list_signals_(dev.xmap)
print("........... xmap.mca1 ")
self.list_signals_(dev.xmap.mca1)
print("........... xmap.dxp1 ")
self.list_signals_(dev.xmap.dxp1)
print("........... xmap.roi0")
self.list_signals_(dev.xmap.roi0)
class PhoenixBL(Utilities, PhoenixHelp):
"""
#
# General class for PHOENIX beamline located in phoenix_bec/phoenic_bec/scripts
@ -46,78 +138,120 @@ class PhoenixBL:
init PhoenixBL() in phoenix_bec/scripts
"""
import os
# import os
# self.silent = False
# self.help()
# self.help_phoenix()
# self.help_attributes()
self.silent = False
print("..... init PhoenixBL from phoenix_bec/scripts/phoenix.py")
# load local configuration
# Define important paths
self.path_scripts_local = (
"/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/phoenix_bec/local_scripts/"
)
self.base_path = "/data/test/x07mb-test-bec/production/phoenix_bec/"
self.path_phoenix_bec = self.base_path + "phoenix_bec/"
self.path_devices = self.path_phoenix_bec + "device_configs/"
self.path_config_local = (
self.path_scripts_local + "TEST_ConfigPhoenix/"
) # base dir for local configurations
self.path_scripts = self.path_phoenix_bec + "scripts/"
self.path_scans = self.path_phoenix_bec + "scans/"
self.path_devices_local = (
self.path_config_local + "Local_device_config/"
) # local yamal file
self.path_scripts_local = self.path_phoenix_bec + "local_scripts/"
self.path_config_local = self.path_scripts_local + "TEST_ConfigPhoenix/"
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_devices = self.path_phoenix_bec + "phoenix_bec/device_configs/"
# yamal file for default configuration
self.file_devices_file = (
self.path_phoenix_bec + "phoenix_bec/device_configs/phoenix_devices.yaml"
) # local yamal file
self.file_devices_file = self.path_devices + "phoenix_devices.yaml"
self.file_devices_tmp = (
self.path_phoenix_bec + "phoenix_bec/device_configs/current_devices_tmp.yaml"
) # tmp configuration file. Will be electronicall created and appended if needed
self.file_devices_xmap = self.path_devices + "phoenix_xmap.yaml"
self.file_devices_falcon = self.path_devices + "phoenix_falcon.yaml"
# temporary yaml file to allow adding devices with one single comamnd
self.file_devices_tmp = self.path_devices + "current_devices_tmp.yaml"
self.t0 = time.time()
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_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 create_base_config(self):
# create a yaml file from standard configuration
""" "
create a yaml file from standard configuration
"""
os.system("cat " + self.file_devices_file + " > " + self.file_devices_tmp)
# os.system("ls -altr" + self.path_phoenix_bec + "phoenix_bec/devices")
bec.config.update_session_with_file(self.file_devices_tmp)
def add_phoenix_config(self):
"""
Add phoenix config
"""
print("add_phoenix_config ")
print("self.file_devices_file")
bec.config.update_session_with_file(self.tmp.file_devices_file)
os.system("cat " + self.file_devices_file + " >> " + self.file_devices_tmp)
def add_xmap(self):
print("add xmap ")
os.system("cat " + self.path_devices + "phoenix_xmap.yaml" + " >> " + self.file_devices_tmp)
bec.config.update_session_with_file(self.file_devices_tmp)
def add_xmap(self):
"""Add XMAP to config"""
print("add xmap ")
os.system("cat " + self.file_devices_xmap + " >> " + self.file_devices_tmp)
bec.config.update_session_with_file(self.file_devices_tmp)
def load_xmap(self):
"""Load XMAP"""
print("load_xmap")
os.system("cat " + self.file_devices_xmap + " > " + self.file_devices_tmp)
bec.config.update_session_with_file(self.file_devices_xmap)
def add_falcon(self):
"""Add Falcon to config"""
print("add_falcon to existing configuration ")
os.system(
"cat " + self.path_devices + "phoenix_falcon.yaml" + " >> " + self.file_devices_tmp
)
os.system("cat " + self.file_devices_falcon + " >> " + self.file_devices_tmp)
bec.config.update_session_with_file(self.file_devices_tmp)
def load_falcon(self):
"""Load FALCON"""
print("load_falcon")
bec.config.update_session_with_file(self.path_devices + "phoenix_falcon.yaml")
os.system("cat " + self.file_devices_falcon + " > " + self.file_devices_tmp)
bec.config.update_session_with_file(self.file_devices_falcon)
def show_phoenix_setup(self):
print(self.path_phoenix_bec)
os.system("cat " + self.path_phoenix_bec + "phoenix_bec/scripts/Current_setup.txt")
# def show_phoenix_setup(self):
# print(self.path_phoenix_bec)
# os.system("cat " + self.path_phoenix_bec + "phoenix_bec/scripts/Current_setup.txt")
def run_shell(self, commands):
"""
run one or sever shell comands in a new terminal
Example:
run_shell('ls')
runt_shell(['sh script.sh','pwd','ls'])
"""
cmd = 'gnome-terminal --geometry 100X30 -- bash -c "'
print(cmd)
if type(commands) == list:
for i in commands:
cmd = cmd + i + " ; "
# endfor
else:
cmd = cmd + commands + " ; "
# endelse
cmd = cmd + ' exec bash " '
print(cmd)
os.system(cmd)
# os.system(
# 'gnome-terminal --geometry 100X30 -- bash -c "source /data/test/x07mb-test-bec/production/bec_venv/bin/activate ; bec-server attach ; exec bash"'
# )
@classmethod
def my_log(cls, x):
@ -137,7 +271,7 @@ class PhoenixBL:
file = open("MyLogfile.txt", "a")
file.write(m + "\n")
file.close
file.close()
class PhGroup:
@ -232,11 +366,10 @@ class PhGroup:
"""
print("keys")
print(this_scan.scan.data.keys())
for outer_key in this_scan.scan.data.keys():
print("outer_key", outer_key)
n_outer = len(this_scan.scan.data.keys())
# n_outer = len(this_scan.scan.data.keys())
for inner_key in this_scan.scan.data[outer_key].keys():
print("inner_key", inner_key)
# calculate nunber of points
@ -258,5 +391,25 @@ class PhGroup:
# endfor
# endfor
# endfor
print(time.time())
# enddef
if __name__ == "__main__":
PH = PhoenixBL()
for x in PH.__dir__():
if "path" in x:
# print(x)
pa = getattr(PH, x)
if os.path.isdir(pa):
print(pa, " exists")
else:
print("!!- ", pa, " does not exist")
if "file" in x:
pa = getattr(PH, x)
if os.path.isfile(pa):
print(pa, " exists")
else:
print("!!- ", pa, " does not exist")

View File

@ -0,0 +1,180 @@
from IPython import get_ipython
class PhoenixHelp:
def pm(self, x):
if self.silent == False:
print(x)
# endif
def help(self):
self.__on_help = """HelpPhoenix
HELP ON BEC
General online documentation of BEC
https://beamline-experiment-control.readthedocs.io/en/latest/
code in git
https://gitlab.psi.ch/bec
For help on BL specific topics see
phoenix.help()
phoenix.help_phoenix() ... etc...
find attributes using tab extension on command line
BL related MAGIC COMMANDS on iphython shell start with ph:
Example:
%ph_create_base_config
.. etc .. find all commands by tab extension, description in phoenix.help_magic
"""
self.pm(self.__on_help)
# self.pm(self.on_attributes)
def help_phoenix_file_structure(self):
self.__on_phoenix_file_structure = """
phoenix_bec/scripts -- directory for general BL scripts
(auto read to server)
....... phoenix.py -- base classes for BL
....... phoenix_help.py -- contains classes for help as relevant
for BEC @ PHOENIX operation
phoenix_bec/scans -- location of dedicated scan types
phoenix_bec/bec_iphython_client -- directory for startup files
....... post_startup.py -- BL specific definitions, read when bec starts
Definiton of BL related magic commands
phoenix_bec/devcices -- Location for specific devices
phoenix_bec/device_configs -- location of yaml configuration files
phoenix_bec/local_scripts -- space for local and test script
(NOT auto read to server)
#######################################################################
IT IS ABSOLUTELY FORBIDDEN FOR USERS TO MAKE ANY CHANGES TO ANY OF THE FILES
#######################################################################
"""
def help_phoenix(self):
self.__on_phoenix = """
General setup of bec @ PHOENIX
important files
phoenix_bec/scripts/phoenix.py
phoenix_bec/scripts/phoenix.py
"""
self.pm(self.__on_phoenix)
def help_devices(self):
"""
help text on using devices in bec command line
"""
self.__on_devices = """
===== THE BASICS =========
All devices are collected in dev.{name}, for example
dev.falcon : falcon 4 element detector
dev.MA_SCANX : motor ScanX of manipulator MA1
dev.SAI_MA1 : diode detector etc.
For safety reasond, after initialization in bec,if possible,
all devices are DISABLED by default.
i.e dev.{name}.enabled is set to False for safety
to enable : dev.{name}.enabled = True
to disable : dev.{name}.enabled = False
To see all devices use
dev.show_all()
===== READING DEVICES IN SCANS ====
dev.{name}.readout_priority = "monitored" : reads device in scan on each point
dev.{name}.readout_priority = "baseline" : does not read device in scan
====== initialize devices =========
from bec comamnd line in python script
%ph_create_base_config phoenx.create_base_config() -- created main devices
%add_falcon phoenix.add_falcon -- add falcon to existing devices
... etc..
====== WORK ON EPICS CHANNELS ====
.get() : read signal: value only
.read() : read signal, into dictionary including timestamp
.put() : write signal --- seems to have a callback ????
.set() : write signal --- seems to have no callback ??
OTHER;
.name : name of device
GET INFORMATION ABOUT DEVICES
._info --- seems to be most complete information dictionarty
.describe() --- = ._info['describe']
--- info about Signals/Epics channels (dictionary)
.describe_configuration
--- = ._info['describe_configuration']
--- similar to .describe
.summary -- lists attributes/names and classes of signals (on screen)
.info --
._config ._info
"""
self.pm(self.__on_devices)
def help_scans(self):
self.__on_scans = """
HELP ON SCANS --- missing
"""
self.pm(self.__on_scans)
def help_magic(self):
self.__on_magic = """
HELP ON MAGIC COMMANDS
Magic comamnd are called from the iphython shell.
BL related magic comamnd are defined in post_startup.py
All magic command start with %, BL related ones use the name convention
%ph_{name}
Example:
PHOENIX [8/225] %ph_create_base_config??
will initialzes certain %ph_load_xmap
%ph_add_xmap
%ph_restart_bec_server -- restart the bec server and opens a new terminal with tmux
"""
self.pm(self.__on_magic)

View File

@ -12,7 +12,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
]
dependencies = []
dependencies = ["pandas"]
[project.optional-dependencies]
dev = [