diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 53e82dd55..740c54add 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -31,6 +31,7 @@ set( PYTHON_FILES detector.py eiger.py errors.py + gotthard2.py ctb.py jungfrau.py mythen3.py diff --git a/python/scripts/basic.py b/python/scripts/basic.py index e7feeced0..d9dfbbcef 100755 --- a/python/scripts/basic.py +++ b/python/scripts/basic.py @@ -3,13 +3,14 @@ import sys import numpy as np sys.path.append(os.path.join(os.getcwd(), 'bin')) -from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb +from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb, Gotthard2 from slsdet import dacIndex, readoutMode from slsdet.lookup import view, find d = Detector() e = Eiger() c = Ctb() +g = Gotthard2() # j = Jungfrau() # m = Mythen3() diff --git a/python/scripts/cmd_python.py b/python/scripts/cmd_python.py index 4da028765..a398732c7 100644 --- a/python/scripts/cmd_python.py +++ b/python/scripts/cmd_python.py @@ -15,7 +15,9 @@ pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim', 'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc', 'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl', 'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr' -, 'vcmp_rl', 'vcmp_rr', 'daclist', 'dacvalues', 'vcal', 'vcas'] +, 'vcmp_rl', 'vcmp_rr', 'vcal', 'vcas', 'vipre', +'vin_com', 'vin_cm', 'vrshaper', 'vrshaper_n', 'vrpreamp', 'vishaper', +'vicin', 'vcassh', 'vcal_n', 'vcal_p'] missing = [] for c in cmd: diff --git a/python/slsdet/__init__.py b/python/slsdet/__init__.py index d5d64965a..e3711564e 100755 --- a/python/slsdet/__init__.py +++ b/python/slsdet/__init__.py @@ -5,6 +5,7 @@ from .dacs import DetectorDacs, Dac from .detector import Detector from .jungfrau import Jungfrau from .mythen3 import Mythen3 +from .gotthard2 import Gotthard2 # from .jungfrau_ctb import JungfrauCTB # from _slsdet import DetectorApi diff --git a/python/slsdet/dacs.py b/python/slsdet/dacs.py index 345648b3e..574e6e2cd 100755 --- a/python/slsdet/dacs.py +++ b/python/slsdet/dacs.py @@ -32,7 +32,7 @@ class Dac(DetectorProperty): def __repr__(self): """String representation for a single dac in all modules""" dacstr = ''.join([f'{item:5d}' for item in self.get()]) - return f'{self.__name__:10s}:{dacstr}' + return f'{self.__name__:15s}:{dacstr}' class DetectorDacs: diff --git a/python/slsdet/gotthard2.py b/python/slsdet/gotthard2.py new file mode 100644 index 000000000..8194c7a96 --- /dev/null +++ b/python/slsdet/gotthard2.py @@ -0,0 +1,61 @@ +#!/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 _slsdet +dacIndex = _slsdet.slsDetectorDefs.dacIndex +from .detector_property import DetectorProperty + + +# @freeze +class Gotthard2Dacs(DetectorDacs): + """ + Gotthard2 specific DACs + """ + _dacs = [('vref_h_adc', dacIndex.VREF_H_ADC, 0, 4000, 2116), + ('vb_comp_fe', dacIndex.VB_COMP_FE, 0, 4000, 0), + ('vb_comp_adc', dacIndex.VB_COMP_ADC, 0, 4000, 0), + ('vcom_cds', dacIndex.VCOM_CDS, 0, 4000, 705), + ('vref_rstore', dacIndex.VREF_RSTORE, 0, 4000, 205), + ('vb_opa_1st', dacIndex.VB_OPA_1ST, 0, 4000, 0), + ('vref_comp_fe', dacIndex.VREF_COMP_FE, 0, 4000, 0), + ('vcom_adc1', dacIndex.VCOM_ADC1, 0, 4000, 705), + ('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 900), + ('vref_l_adc', dacIndex.VREF_L_ADC, 0, 4000, 700), + ('vref_cds', dacIndex.VREF_CDS, 0, 4000, 600), + ('vb_cs', dacIndex.VB_CS, 0, 4000, 2799), + ('vb_opa_fd', dacIndex.VB_OPA_FD, 0, 4000, 0), + ('vcom_adc2', dacIndex.VCOM_ADC2, 0, 4000, 704), + ] + _dacnames = [_d[0] for _d in _dacs] + + + + +@freeze +class Gotthard2(Detector): + """ + Subclassing Detector to set up correct dacs and detector specific + functions. + """ + _detector_dynamic_range = [16] + + + _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 = Gotthard2Dacs(self) + + @property + def dacs(self): + return self._dacs \ No newline at end of file diff --git a/python/slsdet/mythen3.py b/python/slsdet/mythen3.py index f83862377..65bb5211a 100644 --- a/python/slsdet/mythen3.py +++ b/python/slsdet/mythen3.py @@ -19,22 +19,22 @@ class Mythen3Dacs(DetectorDacs): """ Jungfrau specific DACs """ - _dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220), - ('vth2', dacIndex.VTH2, 0, 4000, 2800), - ('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280), - ('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800), - ('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220), - ('vth3', dacIndex.VTH3, 0, 4000, 2800), - ('vth1', dacIndex.VTH1, 0, 4000, 2800), - ('vicin', dacIndex.VICIN, 0, 4000, 1708), + _dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220), + ('vth2', dacIndex.VTH2, 0, 4000, 2800), + ('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280), + ('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800), + ('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220), + ('vth3', dacIndex.VTH3, 0, 4000, 2800), + ('vth1', dacIndex.VTH1, 0, 4000, 2800), + ('vicin', dacIndex.VICIN, 0, 4000, 1708), ('vcas', dacIndex.VCAS, 0, 4000, 1800), - ('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100), - ('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100), - ('vipre', dacIndex.VIPRE, 0, 4000, 2624), - ('vishaper', dacIndex.VISHAPER, 0, 4000, 1708), - ('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712), - ('vtrim', dacIndex.VTRIM, 0, 4000, 2800), - ('vdcsh', dacIndex.VDCSH, 0, 4000, 800), + ('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100), + ('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100), + ('vipre', dacIndex.VIPRE, 0, 4000, 2624), + ('vishaper', dacIndex.VISHAPER, 0, 4000, 1708), + ('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712), + ('vtrim', dacIndex.VTRIM, 0, 4000, 2800), + ('vdcsh', dacIndex.VDCSH, 0, 4000, 800), ] _dacnames = [_d[0] for _d in _dacs]