Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content

feat: add SLSDetectorBaseclass as a baseclass for detectors at SLS

appel_c requested to merge slsdetbaseclass into master

Goal

Generate a baseclass for detectors at PSI. The class separates beamline & BEC specific implementations from functionalities of the detector. The idea would be that controls can implement and test a version of the detector by using PSIDetectorBase as a parent class.

How was this accomplished

psi_detector_base.py hosts now the base class PSIDetectorBase with a class attribute custom_prepare_cls that is initiated with the CustomDetectorMixinclass from psi_detector_base. PSIDetectorBase and CustomDetectorMixin generate which will be beneficial for future detector integration.

PSIDetectorBase class

Ensure that functions from CustomDetectorMixin are called as defined in the base class. If the detector integration requires additional functions to be called upon, e.g. stage, this can be implemented as follows:

def stage(self) -> List[object]:
    rtr = super().stage()
    self.custom_prepare.arm_acquisition()
    return rtr

Here, arm_acquisition will be additionally called after stage is called within the base class.

CustomDetectorMixin class

At this moment, this class holds logic from both, beamline specific implementations and also BEC. I do not see a benefit to split the logic of those too.

Envisioned workflow for integration

Implementing a new detector could look as follows (example with eiger):

class Eiger9M(PSIDetectorBase):
   cam = Cpt....
   #All controls specific logic..

class EigerSetup(CustomDetectorMixin):
   # implement all BL specific logic for detector, backend etc. 
   # This will most likely be a mixture of BL, controls and AWI (BEC)
   def stop_detector(self):
   ...
class Eiger9McSAXS(Eiger9M):
   custom_prepare = EigerSetup

In between, test frameworks could ensure the proper functionality to be able to identify missing implementations more clearly. E.g. Èiger9M should already be a functional ophyd device, and therefore, possibly tested. However, upon calling stage, unstage, stop, trigger, _init, a range of functions from CustomDetectorMixin should be called. This logic is hosted in PSIDetectorBase.

Next steps

  1. Move BL specific implementations into another subfolder. This could already be in the beamline repository or still in ophyd.
  2. BL test. Test refactoring at the BL, check if simulation mode works well without problems.
  3. Write test framework to

closes #12 (closed) #7 (closed)

Edited by appel_c

Merge request reports