falcon_phonix.py to match epics and bec names, add option for 4 detectors

This commit is contained in:
gac-x07mb
2024-10-16 17:24:07 +02:00
committed by wakonig_k
parent 956a3267c4
commit 2e93a0d811
6 changed files with 458 additions and 80 deletions

View File

@ -145,9 +145,11 @@ print("...... %ph_load_config ... to reload phoenix default configuration")
@register_line_magic @register_line_magic
def ph_create_config(line): def ph_create_base_config(line):
""" """
load base configuration load base configuration for PHOENIX beamline
using phoenix.create_base_config()
phoenix_bec/device_configs/phoenix_devices.yaml
""" """
t0 = tt.time() t0 = tt.time()
phoenix.create_base_config() phoenix.create_base_config()
@ -161,7 +163,7 @@ def ph_create_config(line):
def ph_restart_bec_server(line): def ph_restart_bec_server(line):
os.system("bec-server restart") os.system("bec-server restart")
os.system( os.system(
'gnome-terminal --geometry 120X50 -- bash -c "source /data/test/x07mb-test-bec/bec_deployment/bec_venv/bin/activate ; bec-server attach; exec bash"' 'gnome-terminal --geometry 170X50 -- bash -c "source /data/test/x07mb-test-bec/bec_deployment/bec_venv/bin/activate ; bec-server attach; exec bash"'
) )

View File

@ -0,0 +1,393 @@
PH_TTL:
description: PHOENIX TTL trigger
deviceClass: phoenix_bec.devices.phoenix_trigger.PhoenixTrigger
deviceConfig:
prefix: 'X07MB-OP2:'
deviceTags:
- phoenix
- TTL Trigger
- phoenix_devices.yaml
onFailure: buffer
enabled: true
readoutPriority: monitored
softwareTrigger: true
###################################################
#
# phoenix standard devices (motors)
#
#
####################################################:
PH_Dummy:
description: Class to test functionality of PSI detector. reads/writes into X07MB-PC-PSCAN.P-P0D0"
deviceClass: phoenix_bec.devices.dummy_devices.Dummy_PSIDetector
deviceConfig:
prefix: 'X07MB-PC-PSCAN:'
name: 'Dummy_Detector_PSI_Detector'
deviceTags:
- phoenix
- phoenix_devices.yamllass
- reads channel X07MB-PC-PSCAN.P-P0D0
- Dummy class to test PSI detector c from DAQ GUI
onFailure: buffer
enabled: true
readoutPriority: monitored
softwareTrigger: false
############################
#
# MOTORS ES1
#
############################
ScanX:
readoutPriority: baseline
description: 'Vertical sample position ES-MA1.ScanX'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:ScanX'
deviceTags:
- ES-MA1.ScanX
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry
enabled: true
readOnly: false
ScanY:
readoutPriority: baseline
description: 'Horizontal sample position ES-MA1.ScanY'
deviceClass: ophyd.EpicsMotor
deviceConfig:
prefix: 'X07MB-ES-MA1:ScanY'
deviceTags:
- ES-MA1.ScanY
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry
enabled: true
readOnly: false
softwareTrigger: false
#
#
# DIODES from ES1 ADC
#
#
SAI_07_MEAN:
readoutPriority: monitored
description: DIODE SAI07
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_07:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
SAI_08_MEAN:
readoutPriority: monitored
description: DIODE
deviceClass: ophyd.EpicsSignalRO
deviceConfig:
auto_monitor: true
read_pv: 'X07MB-OP2-SAI_08:MEAN'
deviceTags:
- PHOENIX
- phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: buffer
enabled: true
readOnly: true
softwareTrigger: false
#
# 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
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

@ -22,16 +22,16 @@ PH_TTL:
####################################################: ####################################################:
PH_Dummy: PH_Dummy:
description: PHOENIX DUMMY DET description: Class to test functionality of PSI detector. reads/writes into X07MB-PC-PSCAN.P-P0D0"
deviceClass: phoenix_bec.devices.dummy_devices.Dummy_PSIDetector deviceClass: phoenix_bec.devices.dummy_devices.Dummy_PSIDetector
deviceConfig: deviceConfig:
prefix: 'X07MB-PC-PSCAN:' prefix: 'X07MB-PC-PSCAN:'
name: 'Dummy_Detector_PSI_Detector' name: 'Dummy_Detector_PSI_Detector'
deviceTags: deviceTags:
- phoenix - phoenix
- TTL Trigger - phoenix_devices.yamllass
- phoenix_devices.yaml - reads channel X07MB-PC-PSCAN.P-P0D0
- reads channel X07MB-PC-PSCAN.P-P0D0 from DAQ GUI - Dummy class to test PSI detector c from DAQ GUI
onFailure: buffer onFailure: buffer
enabled: true enabled: true
readoutPriority: monitored readoutPriority: monitored
@ -39,64 +39,33 @@ PH_Dummy:
#Dummy_DET:
# description: PHOENIX TTL trigger
# deviceClass: phoenix_bec.devices.phoenix_trigger.PhoenixTrigger
# deviceConfig:
# prefix: 'X07MB-PC-PSCAN:'
# deviceTags:
# - phoenix
# - TTL Trigger
# - phoenixdevices
# onFailure: buffer
# enabled: true
# readoutPriority: monitored
# softwareTrigger: false
#Dummy_DET2:
# description: Dummy for psi detector fo testing of algorithm only
# deviceClass: phoenix_bec.devices.dummy_devices.Dummy_PSIDetector
# deviceConfig:
# prefix: 'X07MB-PC-PSCAN:'
# deviceTags:
# - phoenix
# - Dummy_Dummy_PSIDetector
# - phoenix_devices.yaml
# onFailure: buffe
############################ ############################
# #
# MOTORS ES1 # MOTORS ES1
# #
############################ ############################
ScanX: ScanX:
readoutPriority: baseline readoutPriority: baseline
description: 'Vert sample position' description: 'Vertical sample position ES-MA1.ScanX'
deviceClass: ophyd.EpicsMotor deviceClass: ophyd.EpicsMotor
deviceConfig: deviceConfig:
prefix: 'X07MB-ES-MA1:ScanX' prefix: 'X07MB-ES-MA1:ScanX'
deviceTags: deviceTags:
- ES-MA1 - ES-MA1.ScanX
- phoenix_bec/device_configs/phoenix_devices.yaml - phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry onFailure: retry
enabled: true enabled: true
readOnly: false readOnly: false
ScanY: ScanY:
readoutPriority: baseline readoutPriority: baseline
description: 'Horizontal sample position' description: 'Horizontal sample position ES-MA1.ScanY'
deviceClass: ophyd.EpicsMotor deviceClass: ophyd.EpicsMotor
deviceConfig: deviceConfig:
prefix: 'X07MB-ES-MA1:ScanY' prefix: 'X07MB-ES-MA1:ScanY'
deviceTags: deviceTags:
- ES-MA1 - ES-MA1.ScanY
- phoenix_bec/device_configs/phoenix_devices.yaml - phoenix_bec/device_configs/phoenix_devices.yaml
onFailure: retry onFailure: retry
enabled: true enabled: true
@ -110,7 +79,7 @@ ScanY:
SAI_07_MEAN: SAI_07_MEAN:
readoutPriority: monitored readoutPriority: monitored
description: DIODE description: DIODE SAI07
deviceClass: ophyd.EpicsSignalRO deviceClass: ophyd.EpicsSignalRO
deviceConfig: deviceConfig:
auto_monitor: true auto_monitor: true

View File

@ -2,8 +2,8 @@
# #
# falcon without hdf5 # falcon without hdf5
# #
falcon_nohdf5: falcon_hdf5:
description: Falcon detector x-ray fluoresence with hdf5 plugin 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.falcon_phoenix.FalconPhoenix
deviceConfig: deviceConfig:
prefix: 'X07MB-SITORO:' prefix: 'X07MB-SITORO:'

View File

@ -5,25 +5,22 @@ implementation on csaxs (file falcon_csaxs.py)
Differences to implement Differences to implement
1) we consider EPICS initialization as standard implementaion, 1) we consider EPICS initialization as standard implementaion,
so no reinitialization when bec device is initrialized so no reinitialization when bec device is initrialized ... DONE ...
2) use mca spectra as base mode of operation 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 3) make easy switching between mca spectra an mca mapping
4) fix defiend relation bwetween variables and names used here for example fix defiend relation bwetween variables and names used here for example DONE
aquiring is currently called 'state' --> should be renamed to aquiring aquiring is currently called 'state' --> should be renamed to aquiring
Currently state = Cpt(EpicsSignal, "Acquiring") Currently state = Cpt(EpicsSignal, "Acquiring")
should be acquiring = Cpt(EpicsSignal, "Acquiring") should be acquiring = Cpt(EpicsSignal, "Acquiring")
ISSUES TIMEOUTS hdf5 = Cpt(FalconHDF5Plugins, "HDF1:")
Timeouts occur and seem to be not reproducible
See scilog documentation
Locations on timeouts are :
def arm_aquisition def arm_aquisition
@ -45,9 +42,7 @@ CHANGES LOG and
""" """
EpicsDXPFalcon(Device):
import enum
import os
import threading import threading
import time import time
@ -65,19 +60,7 @@ logger = bec_logger.logger
class FalconError(Exception): class FalconError(Exception):
"""Base class for exceptions in this module.""" hdf5 = Cpt(FalconHDF5Plugins, "HDF1:")
class FalconTimeoutError(FalconError):
"""Raised when the Falcon does not respond in time."""
# #############
#
# define some detector states
#
# ###########
class DetectorState(enum.IntEnum): class DetectorState(enum.IntEnum):
"""Detector states for Falcon detector""" """Detector states for Falcon detector"""
@ -264,7 +247,7 @@ class FalconSetup(CustomDetectorMixin):
self.parent.start_all.put(1) self.parent.start_all.put(1)
signal_conditions = [ signal_conditions = [
( (
lambda: self.parent.state.read()[self.parent.state.name]["value"], lambda: self.parent.acquiring.read()[self.parent.acquiring.name]["value"],
DetectorState.ACQUIRING, DetectorState.ACQUIRING,
) )
] ]
@ -301,7 +284,10 @@ class FalconSetup(CustomDetectorMixin):
time.sleep(0.5) time.sleep(0.5)
signal_conditions = [ signal_conditions = [
(lambda: self.parent.state.read()[self.parent.state.name]["value"], DetectorState.DONE) (
lambda: self.parent.acquiring.read()[self.parent.acquiring.name]["value"],
DetectorState.DONE,
)
] ]
if not self.wait_for_signals( if not self.wait_for_signals(
@ -391,22 +377,47 @@ class FalconPhoenix(PSIDetectorBase):
TIMEOUT_FOR_SIGNALS = 1 TIMEOUT_FOR_SIGNALS = 1
# specify class attributes # specify class attributes
dxp = Cpt(EpicsDXPFalcon, "dxp1:")
mca = Cpt(EpicsMCARecord, "mca1") # Parameters for individual detector elements
# Note: need to wrote 'dxp: here, but not dxp'
dxp1 = Cpt(EpicsDXPFalcon, "dxp1:")
dxp2 = Cpt(EpicsDXPFalcon, "dxp2:")
dxp3 = Cpt(EpicsDXPFalcon, "dxp3:")
dxp4 = Cpt(EpicsDXPFalcon, "dxp4:")
# need to write 'mca1', but not 'mca1:'
mca1 = Cpt(EpicsMCARecord, "mca1")
mca2 = Cpt(EpicsMCARecord, "mca2")
mca3 = Cpt(EpicsMCARecord, "mca3")
mca4 = Cpt(EpicsMCARecord, "mca4")
# other general parameters
hdf5 = Cpt(FalconHDF5Plugins, "HDF1:") hdf5 = Cpt(FalconHDF5Plugins, "HDF1:")
stop_all = Cpt(EpicsSignal, "StopAll") stop_all = Cpt(EpicsSignal, "StopAll")
erase_all = Cpt(EpicsSignal, "EraseAll") erase_all = Cpt(EpicsSignal, "EraseAll")
start_all = Cpt(EpicsSignal, "StartAll") start_all = Cpt(EpicsSignal, "StartAll")
state = Cpt(EpicsSignal, "Acquiring") # <----------- rename to Acquiring # state = Cpt(EpicsSignal, "Acquiring") # <-- This is from cSAX implementation
acquiring = Cpt(EpicsSignal, "Acquiring")
preset_mode = Cpt(EpicsSignal, "PresetMode") # 0 No preset 1 Real time 2 Events 3 Triggers preset_mode = Cpt(EpicsSignal, "PresetMode") # 0 No preset 1 Real time 2 Events 3 Triggers
preset_real = Cpt(EpicsSignal, "PresetReal") preset_real = Cpt(EpicsSignal, "PresetReal")
preset_events = Cpt(EpicsSignal, "PresetEvents") preset_events = Cpt(EpicsSignal, "PresetEvents")
preset_triggers = Cpt(EpicsSignal, "PresetTriggers") preset_triggers = Cpt(EpicsSignal, "PresetTriggers")
triggers = Cpt(EpicsSignalRO, "MaxTriggers", lazy=True)
events = Cpt(EpicsSignalRO, "MaxEvents", lazy=True) # _________________ General Epic parameters
input_count_rate = Cpt(EpicsSignalRO, "MaxInputCountRate", lazy=True)
output_count_rate = Cpt(EpicsSignalRO, "MaxOutputCountRate", lazy=True) # changes Oct 2024
# triggers--> max_triggers,
# events-->max_events
# input_count_rate--> max_input_count_rate
# output_count_rate--> max_output_count_rate
max_triggers = Cpt(EpicsSignalRO, "MaxTriggers", lazy=True)
max_events = Cpt(EpicsSignalRO, "MaxEvents", lazy=True)
max_input_count_rate = Cpt(EpicsSignalRO, "MaxInputCountRate", lazy=True)
max_output_count_rate = Cpt(EpicsSignalRO, "MaxOutputCountRate", lazy=True)
collect_mode = Cpt(EpicsSignal, "CollectMode") # 0 MCA spectra, 1 MCA mapping collect_mode = Cpt(EpicsSignal, "CollectMode") # 0 MCA spectra, 1 MCA mapping
pixel_advance_mode = Cpt(EpicsSignal, "PixelAdvanceMode") pixel_advance_mode = Cpt(EpicsSignal, "PixelAdvanceMode")
ignore_gate = Cpt(EpicsSignal, "IgnoreGate") ignore_gate = Cpt(EpicsSignal, "IgnoreGate")
@ -418,4 +429,4 @@ class FalconPhoenix(PSIDetectorBase):
if __name__ == "__main__": if __name__ == "__main__":
falcon = FalconcPHOENIX(name="falcon", prefix="X07MB-SITORO:", sim_mode=True) falcon = FalconPHOENIX(name="falcon_hdf5", prefix="X07MB-SITORO:", sim_mode=True)

View File

@ -1,2 +1,5 @@
print('test') print('test')
base='/data/test/x07mb-test-bec/bec_deployment/phoenix_bec/phoenix_bec'
bec.config.update_session_with_file(base+'/device_configs/phoenix_falcon.yaml')
#bec.config.update_session_with_file(base+'/device_configs/phoenix_devices.yaml')