mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer
This commit is contained in:
commit
6a18a214ba
@ -48,7 +48,7 @@ int main() {
|
|||||||
auto tmp = os.str().erase(0, cmd.size());
|
auto tmp = os.str().erase(0, cmd.size());
|
||||||
auto usage = tmp.substr(0, tmp.find_first_of('\n'));
|
auto usage = tmp.substr(0, tmp.find_first_of('\n'));
|
||||||
tmp.erase(0, usage.size());
|
tmp.erase(0, usage.size());
|
||||||
auto help = replace_all(tmp, "\n\t", "\n\t\t");
|
auto help = replace_all(tmp, "\n\t", "\n\t\t| ");
|
||||||
fs << '\t' << cmd << usage << help << "\n";
|
fs << '\t' << cmd << usage << help << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,7 +32,9 @@ set( PYTHON_FILES
|
|||||||
eiger.py
|
eiger.py
|
||||||
enums.py
|
enums.py
|
||||||
errors.py
|
errors.py
|
||||||
|
gotthard.py
|
||||||
gotthard2.py
|
gotthard2.py
|
||||||
|
moench.py
|
||||||
ctb.py
|
ctb.py
|
||||||
jungfrau.py
|
jungfrau.py
|
||||||
mythen3.py
|
mythen3.py
|
||||||
|
@ -3,7 +3,7 @@ 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 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 import dacIndex, readoutMode
|
||||||
from slsdet.lookup import view, find
|
from slsdet.lookup import view, find
|
||||||
|
|
||||||
@ -13,4 +13,4 @@ c = Ctb()
|
|||||||
g = Gotthard2()
|
g = Gotthard2()
|
||||||
# j = Jungfrau()
|
# j = Jungfrau()
|
||||||
# m = Mythen3()
|
# m = Mythen3()
|
||||||
|
m = Moench()
|
||||||
|
@ -6,6 +6,8 @@ from .detector import Detector
|
|||||||
from .jungfrau import Jungfrau
|
from .jungfrau import Jungfrau
|
||||||
from .mythen3 import Mythen3
|
from .mythen3 import Mythen3
|
||||||
from .gotthard2 import Gotthard2
|
from .gotthard2 import Gotthard2
|
||||||
|
from .gotthard import Gotthard
|
||||||
|
from .moench import Moench
|
||||||
# from .jungfrau_ctb import JungfrauCTB
|
# from .jungfrau_ctb import JungfrauCTB
|
||||||
# from _slsdet import DetectorApi
|
# from _slsdet import DetectorApi
|
||||||
|
|
||||||
|
@ -103,6 +103,9 @@ class DetectorDacs:
|
|||||||
for i, _d in enumerate(self):
|
for i, _d in enumerate(self):
|
||||||
_d[:] = dac_array[i]
|
_d[:] = dac_array[i]
|
||||||
|
|
||||||
|
def from_array(self, dac_array):
|
||||||
|
self.set_from_array(dac_array)
|
||||||
|
|
||||||
def set_default(self):
|
def set_default(self):
|
||||||
"""
|
"""
|
||||||
Set all dacs to their default values
|
Set all dacs to their default values
|
||||||
|
@ -248,10 +248,19 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@exptime.setter
|
@exptime.setter
|
||||||
def exptime(self, t):
|
def exptime(self, t):
|
||||||
|
if self.type == detectorType.MYTHEN3 and is_iterable(t):
|
||||||
|
for i, v in enumerate(t):
|
||||||
|
if isinstance(v, int):
|
||||||
|
v = float(v)
|
||||||
|
self.setExptime(i, v)
|
||||||
|
else:
|
||||||
if isinstance(t, int):
|
if isinstance(t, int):
|
||||||
t = float(t)
|
t = float(t)
|
||||||
self.setExptime(t)
|
self.setExptime(t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def period(self):
|
def period(self):
|
||||||
res = self.getPeriod()
|
res = self.getPeriod()
|
||||||
@ -1101,10 +1110,13 @@ class Detector(CppDetectorApi):
|
|||||||
@gatedelay.setter
|
@gatedelay.setter
|
||||||
def gatedelay(self, value):
|
def gatedelay(self, value):
|
||||||
if is_iterable(value):
|
if is_iterable(value):
|
||||||
if len(value) == 3:
|
|
||||||
for i, v in enumerate(value):
|
for i, v in enumerate(value):
|
||||||
|
if isinstance(v, int):
|
||||||
|
v = float(v)
|
||||||
self.setGateDelay(i, v)
|
self.setGateDelay(i, v)
|
||||||
else:
|
else:
|
||||||
|
if isinstance(value, int):
|
||||||
|
value = float(value)
|
||||||
self.setGateDelay(-1, value)
|
self.setGateDelay(-1, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1288,6 +1300,11 @@ class Detector(CppDetectorApi):
|
|||||||
print("Set only")
|
print("Set only")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@pattern.setter
|
||||||
|
def pattern(self, fname):
|
||||||
|
fname = ut.make_string_path(fname)
|
||||||
|
self.setPattern(fname)
|
||||||
|
|
||||||
# patioctrl
|
# patioctrl
|
||||||
@property
|
@property
|
||||||
def patioctrl(self):
|
def patioctrl(self):
|
||||||
@ -1323,6 +1340,15 @@ class Detector(CppDetectorApi):
|
|||||||
def patlimits(self, lim):
|
def patlimits(self, lim):
|
||||||
self.setPatternLoopAddresses(-1, lim[0], lim[1])
|
self.setPatternLoopAddresses(-1, lim[0], lim[1])
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def patsetbit(self):
|
||||||
|
return self.getPatternBitMask()
|
||||||
|
|
||||||
|
@patsetbit.setter
|
||||||
|
def patsetbit(self, mask):
|
||||||
|
self.setPatternBitMask(mask)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def patmask(self):
|
def patmask(self):
|
||||||
"""[Ctb][Moench][Mythen3] Sets the bits that will have a pattern mask applied to the selected patmask for every pattern.
|
"""[Ctb][Moench][Mythen3] Sets the bits that will have a pattern mask applied to the selected patmask for every pattern.
|
||||||
@ -1339,10 +1365,7 @@ class Detector(CppDetectorApi):
|
|||||||
def patmask(self, mask):
|
def patmask(self, mask):
|
||||||
self.setPatternMask(mask)
|
self.setPatternMask(mask)
|
||||||
|
|
||||||
@pattern.setter
|
|
||||||
def pattern(self, fname):
|
|
||||||
fname = ut.make_string_path(fname)
|
|
||||||
self.setPattern(fname)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def patwait0(self):
|
def patwait0(self):
|
||||||
|
51
python/slsdet/gotthard.py
Normal file
51
python/slsdet/gotthard.py
Normal file
@ -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
|
52
python/slsdet/moench.py
Normal file
52
python/slsdet/moench.py
Normal file
@ -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
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
This file contains the specialization for the Jungfrau detector
|
This file contains the specialization for the Mythen3 detector
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ std::string CmdProxy::VirtualServer(int action) {
|
|||||||
std::string CmdProxy::Acquire(int action) {
|
std::string CmdProxy::Acquire(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << cmd << " - Acquire the number of frames set up.\n";
|
os << cmd << "\n\tAcquire the number of frames set up.\n";
|
||||||
} else {
|
} else {
|
||||||
if (det->empty()) {
|
if (det->empty()) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
@ -1612,7 +1612,7 @@ std::string CmdProxy::VetoPhoton(int action) {
|
|||||||
os << "[ichip] [#photons] [energy in keV] [reference "
|
os << "[ichip] [#photons] [energy in keV] [reference "
|
||||||
"file]\n\t[Gotthard2] Set veto reference for 128 channels for "
|
"file]\n\t[Gotthard2] Set veto reference for 128 channels for "
|
||||||
"chip ichip according to reference file and #photons and energy "
|
"chip ichip according to reference file and #photons and energy "
|
||||||
"in keV.\n"
|
"in keV.\n\t"
|
||||||
<< "[ichip] [output file]\n\t Get gain indices and veto reference "
|
<< "[ichip] [output file]\n\t Get gain indices and veto reference "
|
||||||
"for 128 channels for chip ichip, saved to file."
|
"for 128 channels for chip ichip, saved to file."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
|
@ -1691,7 +1691,7 @@ class CmdProxy {
|
|||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[n]\n\tDefault is 50002.\n\t[Jungfrau] Port number of the receiver "
|
"[n]\n\tDefault is 50002.\n\t[Jungfrau] Port number of the receiver "
|
||||||
"(destination) udp interface where the second half of detector data is "
|
"(destination) udp interface where the second half of detector data is "
|
||||||
"sent to. \n[Eiger] Port number of the reciever (desintation) udp "
|
"sent to. \n\t[Eiger] Port number of the reciever (desintation) udp "
|
||||||
"interface where the right half of the detector data is sent to.");
|
"interface where the right half of the detector data is sent to.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(
|
EXECUTE_SET_COMMAND(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user