From 508ec150f52d86c777fd8e3f995f9848766c52f0 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Tue, 25 Aug 2020 15:48:56 +0200 Subject: [PATCH] added Gotthard and Moench --- python/CMakeLists.txt | 2 ++ python/scripts/basic.py | 4 +-- python/slsdet/__init__.py | 2 ++ python/slsdet/dacs.py | 3 +++ python/slsdet/gotthard.py | 51 ++++++++++++++++++++++++++++++++++++++ python/slsdet/moench.py | 52 +++++++++++++++++++++++++++++++++++++++ python/slsdet/mythen3.py | 2 +- 7 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 python/slsdet/gotthard.py create mode 100644 python/slsdet/moench.py diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 93167953c..948b44d9c 100755 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -32,7 +32,9 @@ set( PYTHON_FILES eiger.py enums.py errors.py + gotthard.py gotthard2.py + moench.py ctb.py jungfrau.py mythen3.py diff --git a/python/scripts/basic.py b/python/scripts/basic.py index d9dfbbcef..65ba3b36b 100755 --- a/python/scripts/basic.py +++ b/python/scripts/basic.py @@ -3,7 +3,7 @@ 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, Gotthard2 +from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb, Gotthard2, Moench from slsdet import dacIndex, readoutMode from slsdet.lookup import view, find @@ -13,4 +13,4 @@ c = Ctb() g = Gotthard2() # j = Jungfrau() # m = Mythen3() - +m = Moench() diff --git a/python/slsdet/__init__.py b/python/slsdet/__init__.py index 871b63173..54bd3ff3f 100755 --- a/python/slsdet/__init__.py +++ b/python/slsdet/__init__.py @@ -6,6 +6,8 @@ from .detector import Detector from .jungfrau import Jungfrau from .mythen3 import Mythen3 from .gotthard2 import Gotthard2 +from .gotthard import Gotthard +from .moench import Moench # from .jungfrau_ctb import JungfrauCTB # from _slsdet import DetectorApi diff --git a/python/slsdet/dacs.py b/python/slsdet/dacs.py index 574e6e2cd..2ce69a4a1 100755 --- a/python/slsdet/dacs.py +++ b/python/slsdet/dacs.py @@ -103,6 +103,9 @@ class DetectorDacs: for i, _d in enumerate(self): _d[:] = dac_array[i] + def from_array(self, dac_array): + self.set_from_array(dac_array) + def set_default(self): """ Set all dacs to their default values diff --git a/python/slsdet/gotthard.py b/python/slsdet/gotthard.py new file mode 100644 index 000000000..ea33b7462 --- /dev/null +++ b/python/slsdet/gotthard.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +This file contains the specialization for the Moench detector +""" + + +from .detector import Detector, freeze +from .dacs import DetectorDacs +import _slsdet +dacIndex = _slsdet.slsDetectorDefs.dacIndex +from .detector_property import DetectorProperty + +# @freeze + +# vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp, ib_test_c +class GotthardDacs(DetectorDacs): + _dacs = [('vref_ds', dacIndex.VREF_DS, 0, 4000, 660), + ('vcascn_pb', dacIndex.VCASCN_PB, 0, 4000, 650), + ('vcascp_pb,', dacIndex.VCASCP_PB, 0, 4000, 1480), + ('vout_cm', dacIndex.VOUT_CM, 0, 4000, 1520), + ('vcasc_out', dacIndex.VCASC_OUT, 0, 4000, 1320), + ('vin_cm', dacIndex.VIN_CM, 0, 4000, 1350), + ('vref_comp', dacIndex.VREF_COMP, 0, 4000, 350), + ('ib_test_c', dacIndex.IB_TESTC, 0, 4000, 2001), + ] + _dacnames = [_d[0] for _d in _dacs] + +#vthreshold?? + + +@freeze +class Gotthard(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 = GotthardDacs(self) + + @property + def dacs(self): + return self._dacs \ No newline at end of file diff --git a/python/slsdet/moench.py b/python/slsdet/moench.py new file mode 100644 index 000000000..0398841b1 --- /dev/null +++ b/python/slsdet/moench.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +This file contains the specialization for the Moench detector +""" + + +from .detector import Detector, freeze +from .dacs import DetectorDacs +import _slsdet +dacIndex = _slsdet.slsDetectorDefs.dacIndex +from .detector_property import DetectorProperty + +# @freeze +class MoenchDacs(DetectorDacs): + """ + Jungfrau specific DACs + """ + _dacs = [('vbp_colbuf', dacIndex.VBP_COLBUF, 0, 4000, 1300), + ('vipre', dacIndex.VIPRE, 0, 4000, 1000), + ('vin_cm,', dacIndex.VIN_CM, 0, 4000, 1400), + ('vb_sda', dacIndex.VB_SDA, 0, 4000, 680), + ('vcasc_sfp', dacIndex.VCASC_SFP, 0, 4000, 1428), + ('vout_cm', dacIndex.VOUT_CM, 0, 4000, 1200), + ('vipre_cds', dacIndex.VIPRE_CDS, 0, 4000, 800), + ('ibias_sfp', dacIndex.IBIAS_SFP, 0, 4000, 900), + ] + _dacnames = [_d[0] for _d in _dacs] + +#vthreshold?? + + +@freeze +class Moench(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 = MoenchDacs(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 65bb5211a..055ee343a 100644 --- a/python/slsdet/mythen3.py +++ b/python/slsdet/mythen3.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ -This file contains the specialization for the Jungfrau detector +This file contains the specialization for the Mythen3 detector """