Add channels for detector energy calibration to falcon

This commit is contained in:
gac-x07mb
2024-10-17 17:43:04 +02:00
committed by wakonig_k
parent b806cbc9c2
commit bae057995f
2 changed files with 39 additions and 9 deletions

View File

@ -2,6 +2,9 @@
Implementation for falcon at PHOENIX, derived from Implementation for falcon at PHOENIX, derived from
implementation on csaxs (file falcon_csaxs.py) implementation on csaxs (file falcon_csaxs.py)
17.10.2024 try to streamline implementation with mca record
Differences to implement Differences to implement
1) we consider EPICS initialization as standard implementaion, 1) we consider EPICS initialization as standard implementaion,
@ -51,7 +54,12 @@ from bec_lib.logger import bec_logger
from ophyd import Component as Cpt from ophyd import Component as Cpt
from ophyd import Device, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV from ophyd import Device, EpicsSignal, EpicsSignalRO, EpicsSignalWithRBV
from ophyd.mca import EpicsMCARecord
# from ophyd.mca import EpicsMCARecord # old import
# now import ophyd.mca completely
import ophyd.mca as Mca
from ophyd_devices.interfaces.base_classes.psi_detector_base import ( from ophyd_devices.interfaces.base_classes.psi_detector_base import (
CustomDetectorMixin, CustomDetectorMixin,
PSIDetectorBase, PSIDetectorBase,
@ -90,6 +98,17 @@ class MappingSource(enum.IntEnum):
MAPPING = 1 MAPPING = 1
class EpicsMCARecordExtended(Mca.EpicsMCARecord):
# add parameters for detector energy calibration
# which are missing in mca.py
calo = Cpt(EpicsSignal, ".CALO")
cals = Cpt(EpicsSignal, ".CALS")
calq = Cpt(EpicsSignal, ".CALQ")
tth = Cpt(EpicsSignal, ".TTH")
class EpicsDXPFalcon(Device): class EpicsDXPFalcon(Device):
""" """
DXP parameters for Falcon detector DXP parameters for Falcon detector
@ -107,9 +126,6 @@ class EpicsDXPFalcon(Device):
detection_filter = Cpt(EpicsSignalWithRBV, "DetectionFilter", string=True) detection_filter = Cpt(EpicsSignalWithRBV, "DetectionFilter", string=True)
scale_factor = Cpt(EpicsSignalWithRBV, "ScaleFactor") scale_factor = Cpt(EpicsSignalWithRBV, "ScaleFactor")
risetime_optimisation = Cpt(EpicsSignalWithRBV, "RisetimeOptimization") risetime_optimisation = Cpt(EpicsSignalWithRBV, "RisetimeOptimization")
# Misc PVs
detector_polarity = Cpt(EpicsSignalWithRBV, "DetectorPolarity")
decay_time = Cpt(EpicsSignalWithRBV, "DecayTime") decay_time = Cpt(EpicsSignalWithRBV, "DecayTime")
current_pixel = Cpt(EpicsSignalRO, "CurrentPixel") current_pixel = Cpt(EpicsSignalRO, "CurrentPixel")
@ -386,13 +402,24 @@ class FalconPhoenix(PSIDetectorBase):
# Parameters for individual detector elements # Parameters for individual detector elements
# Note: need to wrote 'dxp: here, but not dxp' # Note: need to wrote 'dxp: here, but not dxp'
# dxp1 = Cpt(Mca.EpicsDXP, "dxp1:")
dxp1 = Cpt(EpicsDXPFalcon, "dxp1:") dxp1 = Cpt(EpicsDXPFalcon, "dxp1:")
# dxp2 = Cpt(EpicsDXPFalcon, "dxp2:") dxp2 = Cpt(EpicsDXPFalcon, "dxp2:")
# dxp3 = Cpt(EpicsDXPFalcon, "dxp3:") dxp3 = Cpt(EpicsDXPFalcon, "dxp3:")
# dxp4 = Cpt(EpicsDXPFalcon, "dxp4:") dxp4 = Cpt(EpicsDXPFalcon, "dxp4:")
#
# THIS IS NOT WELL-DONE as it take out one part of mca.py from ophy.py
#
#
mca1 = Cpt(EpicsMCARecordExtended, "mca1")
mca2 = Cpt(EpicsMCARecordExtended, "mca2")
mca3 = Cpt(EpicsMCARecordExtended, "mca3")
mca4 = Cpt(EpicsMCARecordExtended, "mca4")
# need to write 'mca1', but not 'mca1:' # need to write 'mca1', but not 'mca1:'
mca1 = Cpt(EpicsMCARecord, "mca1") # mca1 = Cpt(EpicsMCARecord, "mca1")
# mca2 = Cpt(EpicsMCARecord, "mca2") # mca2 = Cpt(EpicsMCARecord, "mca2")
# mca3 = Cpt(EpicsMCARecord, "mca3") # mca3 = Cpt(EpicsMCARecord, "mca3")
# mca4 = Cpt(EpicsMCARecord, "mca4") # mca4 = Cpt(EpicsMCARecord, "mca4")
@ -431,7 +458,10 @@ class FalconPhoenix(PSIDetectorBase):
auto_pixels_per_buffer = Cpt(EpicsSignal, "AutoPixelsPerBuffer") auto_pixels_per_buffer = Cpt(EpicsSignal, "AutoPixelsPerBuffer")
pixels_per_buffer = Cpt(EpicsSignal, "PixelsPerBuffer") pixels_per_buffer = Cpt(EpicsSignal, "PixelsPerBuffer")
pixels_per_run = Cpt(EpicsSignal, "PixelsPerRun") pixels_per_run = Cpt(EpicsSignal, "PixelsPerRun")
# print(pixel_per_run
# if "SITORO" in prefix:
nd_array_mode = Cpt(EpicsSignal, "NDArrayMode") nd_array_mode = Cpt(EpicsSignal, "NDArrayMode")
# endif
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -9,7 +9,7 @@ from ophyd import Component as Cpt
import phoenix_bec.devices.falcon_phoenix as ff import phoenix_bec.devices.falcon_phoenix as ff
falcon = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-SITORO:") falcon = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-SITORO:")
# xmap = ff.FalconPhoenix(name="falcon_hdf5", prefix="X07MB-XMAP:")
# make a 'get to read all epics channels # make a 'get to read all epics channels
# there will be an error message, if device contains a channel whcih does not exist # there will be an error message, if device contains a channel whcih does not exist
w = falcon.get() w = falcon.get()