added Mythen3

This commit is contained in:
Erik Frojdh 2020-01-15 17:56:08 +01:00
parent 39ec29c0e6
commit 30a4a1740f
4 changed files with 85 additions and 19 deletions

View File

@ -30,6 +30,7 @@ set( PYTHON_FILES
errors.py errors.py
ctb.py ctb.py
jungfrau.py jungfrau.py
mythen3.py
registers.py registers.py
utils.py utils.py

View File

@ -2,30 +2,14 @@ import os
import sys import sys
import numpy as np import numpy as np
sys.path.append(os.path.join(os.getcwd(), 'bin')) sys.path.append(os.path.join(os.getcwd(), 'bin'))
# from sls_detector import Eiger, Jungfrau, Detector, defs
from sls_detector import Detector, Eiger, Jungfrau, DetectorDacs, Dac, Ctb from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
from sls_detector import dacIndex from sls_detector import dacIndex
d = Detector() d = Detector()
# e = Eiger() # e = Eiger()
# c = Ctb() # c = Ctb()
j = Jungfrau() # j = Jungfrau()
m = Mythen3()
# def tracefunc(frame, event, arg, indent=[0]):
# if event == "call":
# indent[0] += 2
# print("-" * indent[0] + "> call function", frame.f_code.co_name)
# elif event == "return":
# print("<" + "-" * indent[0], "exit function", frame.f_code.co_name)
# indent[0] -= 2
# return tracefunc
# import sys
# sys.setprofile(tracefunc)
# print('------------------------------------------------------')
# j.dacs.vb_comp[:] = 1500
# print('------------------------------------------------------')
# # sys.setprofile(None)

View File

@ -4,6 +4,7 @@ from .ctb import Ctb
from .dacs import DetectorDacs, Dac from .dacs import DetectorDacs, Dac
from .detector import Detector from .detector import Detector
from .jungfrau import Jungfrau from .jungfrau import Jungfrau
from .mythen3 import Mythen3
# from .jungfrau_ctb import JungfrauCTB # from .jungfrau_ctb import JungfrauCTB
# from _sls_detector import DetectorApi # from _sls_detector import DetectorApi

View File

@ -0,0 +1,80 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains the specialization for the Jungfrau detector
"""
from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _sls_detector
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# vcassh 1200,
# vth2 2800,
# vshaper 1280,
# vshaperneg 2800,
# vipre_out 1220,
# vth3 2800,
# vth1 2800,
# vicin 1708,
# vcas 1800,
# vpreamp 1100,
# vpl 1100,
# vipre 2624,
# viinsh 1708,
# vph 1712,
# vtrim 2800,
# vdcsh 800
# @freeze
class Mythen3Dacs(DetectorDacs):
"""
Jungfrau specific DACs
"""
_dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
('vth2', dacIndex.VTH2, 0, 4000, 2800),
('vshaper', dacIndex.SHAPER1, 0, 4000, 1280),
('vshaperneg', dacIndex.SHAPER2, 0, 4000, 2800),
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
('vth3', dacIndex.VTH3, 0, 4000, 2800),
('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
('vicin', dacIndex.VICIN, 0, 4000, 1708),
('vcas', dacIndex.CAS, 0, 4000, 1800),
('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
('vpl', dacIndex.VPL, 0, 4000, 1100),
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
('viinsh', dacIndex.VIINSH, 0, 4000, 1708),
('vph', dacIndex.CALIBRATION_PULSE, 0, 4000, 1712),
('vtrim', dacIndex.TRIMBIT_SIZE, 0, 4000, 2800),
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
]
_dacnames = [_d[0] for _d in _dacs]
@freeze
class Mythen3(Detector):
"""
Subclassing Detector to set up correct dacs and detector specific
functions.
"""
_detector_dynamic_range = [4, 8, 16, 32]
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
"""available settings for Eiger, note almost always standard"""
def __init__(self, id=0):
super().__init__(id)
self._frozen = False
self._dacs = Mythen3Dacs(self)
@property
def dacs(self):
return self._dacs