clean up of path and filenames for xmap and falcon
This commit is contained in:
@ -130,7 +130,6 @@ def ph_add_falcon(line):
|
||||
|
||||
## enddef
|
||||
|
||||
|
||||
@register_line_magic
|
||||
def ph_load_falcon(line):
|
||||
"""
|
||||
@ -144,6 +143,28 @@ def ph_load_falcon(line):
|
||||
print("...... %ph_load_config ... to reload phoenix 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
|
||||
|
||||
@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)
|
||||
|
||||
|
||||
@register_line_magic
|
||||
def ph_create_base_config(line):
|
||||
"""
|
||||
|
@ -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
|
||||
@ -53,7 +55,8 @@ 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
|
||||
readOnly: false
|
||||
@ -66,7 +69,8 @@ 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
|
||||
readOnly: false
|
||||
@ -86,7 +90,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 +106,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,304 +116,3 @@ 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
|
||||
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
|
||||
#
|
||||
#
|
||||
# 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
|
||||
#
|
@ -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
|
||||
@ -53,7 +55,8 @@ 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
|
||||
readOnly: false
|
||||
@ -66,7 +69,8 @@ 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
|
||||
readOnly: false
|
||||
@ -86,7 +90,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 +106,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
|
||||
|
@ -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
|
||||
|
21
phoenix_bec/device_configs/phoenix_falcon_backup.yaml
Normal file
21
phoenix_bec/device_configs/phoenix_falcon_backup.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
#
|
||||
# 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
|
||||
#
|
@ -2,16 +2,17 @@
|
||||
# Configuration XMAP without hdf5
|
||||
#
|
||||
|
||||
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
|
||||
|
@ -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) |
|
||||
|
@ -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)
|
||||
|
@ -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,
|
365
phoenix_bec/devices/phoenix_falcon.py
Normal file
365
phoenix_bec/devices/phoenix_falcon.py
Normal file
@ -0,0 +1,365 @@
|
||||
"""
|
||||
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 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
|
||||
|
||||
"""
|
||||
|
||||
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)
|
||||
|
||||
|
||||
class FalconPhoenix(PSIDetectorBase, Falcon):
|
||||
"""
|
||||
FalconX4 Sitoro detector for Phoenix
|
||||
|
||||
|
||||
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) : Minimum readout time for the detector
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
# Specify which functions are revealed to the user in BEC client
|
||||
USER_ACCESS = ["describe"]
|
||||
|
||||
# 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:")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
falcon = FalconPhoenix(name="falcon_hdf5", prefix="X07MB-SITORO:", sim_mode=True)
|
299
phoenix_bec/devices/phoenix_xmap.py
Normal file
299
phoenix_bec/devices/phoenix_xmap.py
Normal file
@ -0,0 +1,299 @@
|
||||
#
|
||||
#
|
||||
# changes version for PHOENIX WITHOUT HDF5 plugin to be revised/renamed...
|
||||
#
|
||||
#
|
||||
|
||||
import enum
|
||||
import os
|
||||
import threading
|
||||
|
||||
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 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()
|
||||
|
||||
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)
|
||||
|
||||
def initialize_detector_backend(self) -> None:
|
||||
"""Initialize the detector backend for XMAP."""
|
||||
w=0
|
||||
#----------------------------------------------------------------------
|
||||
#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"""
|
||||
w=9
|
||||
""" --------------------------------------------------------------
|
||||
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 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"""
|
||||
|
||||
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)
|
||||
w=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"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 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)
|
||||
|
||||
|
||||
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"]
|
||||
|
||||
# specify Setup class
|
||||
custom_prepare_cls = XMAPSetup
|
||||
# specify minimum readout time for detector
|
||||
MIN_READOUT = 3e-3
|
||||
TIMEOUT_FOR_SIGNALS = 5
|
||||
|
||||
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:")
|
@ -6,7 +6,7 @@ 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:")
|
||||
# xmap = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-XMAP:")
|
||||
@ -14,4 +14,35 @@ falcon = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-SITORO:")
|
||||
# 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")
|
||||
"""
|
@ -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 ?
|
||||
#
|
@ -50,40 +50,35 @@ class PhoenixBL:
|
||||
|
||||
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
|
||||
@ -94,30 +89,41 @@ class PhoenixBL:
|
||||
def add_phoenix_config(self):
|
||||
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)
|
||||
|
||||
bec.config.update_session_with_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)
|
||||
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):
|
||||
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):
|
||||
print("add_falcon to existing configuration ")
|
||||
|
||||
os.system(
|
||||
"cat " + self.path_devices + "phoenix_falcon.yaml" + " >> " + self.file_devices_tmp
|
||||
"cat " + self.file_devices_falcon + " >> " + self.file_devices_tmp
|
||||
)
|
||||
bec.config.update_session_with_file(self.file_devices_tmp)
|
||||
|
||||
def load_falcon(self):
|
||||
|
||||
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")
|
||||
|
||||
@classmethod
|
||||
def my_log(cls, x):
|
||||
@ -140,6 +146,7 @@ class PhoenixBL:
|
||||
file.close
|
||||
|
||||
|
||||
|
||||
class PhGroup:
|
||||
"""
|
||||
Class to create data groups
|
||||
@ -232,7 +239,6 @@ class PhGroup:
|
||||
|
||||
"""
|
||||
|
||||
print("keys")
|
||||
print(this_scan.scan.data.keys())
|
||||
for outer_key in this_scan.scan.data.keys():
|
||||
print("outer_key", outer_key)
|
||||
@ -258,5 +264,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')
|
Reference in New Issue
Block a user