mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
Merge branch '7.0.0.rc' of https://github.com/slsdetectorgroup/slsDetectorPackage into 7.0.0.rc
This commit is contained in:
commit
3cc4d25eb9
@ -14,7 +14,7 @@ streamingInterface = slsDetectorDefs.streamingInterface
|
|||||||
defs = slsDetectorDefs
|
defs = slsDetectorDefs
|
||||||
|
|
||||||
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||||
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
from .utils import Geometry, to_geo, element, reduce_time, is_iterable, hostname_list
|
||||||
from _slsdet import xy
|
from _slsdet import xy
|
||||||
from . import utils as ut
|
from . import utils as ut
|
||||||
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
||||||
@ -162,12 +162,8 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@hostname.setter
|
@hostname.setter
|
||||||
def hostname(self, hostnames):
|
def hostname(self, hostnames):
|
||||||
if isinstance(hostnames, str):
|
args = hostname_list(hostnames)
|
||||||
hostnames = [hostnames]
|
self.setHostname(args)
|
||||||
if isinstance(hostnames, list):
|
|
||||||
self.setHostname(hostnames)
|
|
||||||
else:
|
|
||||||
raise ValueError("hostname needs to be string or list of strings")
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -784,7 +780,8 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@rx_hostname.setter
|
@rx_hostname.setter
|
||||||
def rx_hostname(self, hostname):
|
def rx_hostname(self, hostname):
|
||||||
self.setRxHostname(hostname)
|
args = hostname_list(hostname)
|
||||||
|
self.setRxHostname(args)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
|
@ -261,3 +261,20 @@ def merge_args(*args):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Multiple dictionaries passes cannot merge args")
|
raise ValueError("Multiple dictionaries passes cannot merge args")
|
||||||
|
|
||||||
|
|
||||||
|
def hostname_list(args):
|
||||||
|
"""
|
||||||
|
Generates a list from a hostname string
|
||||||
|
* Lists are passed through
|
||||||
|
* as are tuples (conversion in pybind11 to vector)
|
||||||
|
* if + is found it splits the string
|
||||||
|
"""
|
||||||
|
if isinstance(args, (list, tuple)):
|
||||||
|
return args
|
||||||
|
elif(isinstance(args, str)):
|
||||||
|
hosts = args.split('+')
|
||||||
|
hosts = [it for it in hosts if len(it)]
|
||||||
|
return hosts
|
||||||
|
else:
|
||||||
|
raise ValueError("hostname needs to be string or list of strings")
|
||||||
|
@ -12,6 +12,7 @@ void init_duration(py::module &m) {
|
|||||||
.def("total_seconds", &DurationWrapper::total_seconds)
|
.def("total_seconds", &DurationWrapper::total_seconds)
|
||||||
.def("count", &DurationWrapper::count)
|
.def("count", &DurationWrapper::count)
|
||||||
.def("set_count", &DurationWrapper::set_count)
|
.def("set_count", &DurationWrapper::set_count)
|
||||||
|
.def("__eq__", &DurationWrapper::operator==)
|
||||||
.def("__repr__", [](const DurationWrapper &self) {
|
.def("__repr__", [](const DurationWrapper &self) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "sls::DurationWrapper(total_seconds: " << self.total_seconds()
|
ss << "sls::DurationWrapper(total_seconds: " << self.total_seconds()
|
||||||
|
@ -8,7 +8,7 @@ Testing functions from utils.py
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from slsdet.utils import *
|
from slsdet.utils import *
|
||||||
from slsdet import IpAddr, MacAddr
|
from slsdet import IpAddr, MacAddr, DurationWrapper
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import pathlib
|
import pathlib
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -22,7 +22,11 @@ def test_iterable():
|
|||||||
|
|
||||||
|
|
||||||
def test_reduce_time_to_single_value_from_list():
|
def test_reduce_time_to_single_value_from_list():
|
||||||
t = 3 * [dt.timedelta(seconds=1)]
|
t = [dt.timedelta(seconds=1) for i in range(3)]
|
||||||
|
assert reduce_time(t) == 1
|
||||||
|
|
||||||
|
def test_reduce_time_to_single_value_from_list_DurationWrapper():
|
||||||
|
t = [DurationWrapper(1) for i in range(3)]
|
||||||
assert reduce_time(t) == 1
|
assert reduce_time(t) == 1
|
||||||
|
|
||||||
|
|
||||||
@ -83,6 +87,12 @@ def test_all_equal_str_fails():
|
|||||||
assert all_equal('aaab') == False
|
assert all_equal('aaab') == False
|
||||||
|
|
||||||
|
|
||||||
|
def test_all_equal_DurationWrapper():
|
||||||
|
assert all_equal([DurationWrapper(1), DurationWrapper(1)])
|
||||||
|
|
||||||
|
def test_all_equal_DurationWrapper_fail():
|
||||||
|
assert not all_equal([DurationWrapper(1), DurationWrapper(2)])
|
||||||
|
|
||||||
def test_element_if_equal_int():
|
def test_element_if_equal_int():
|
||||||
assert element_if_equal([5, 5]) == 5
|
assert element_if_equal([5, 5]) == 5
|
||||||
|
|
||||||
@ -342,3 +352,32 @@ def test_merge_args_tuple():
|
|||||||
|
|
||||||
def test_merge_args_dict_with_tuple():
|
def test_merge_args_dict_with_tuple():
|
||||||
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
|
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
|
||||||
|
|
||||||
|
|
||||||
|
def test_hostname_to_list():
|
||||||
|
s = "localhost"
|
||||||
|
r = hostname_list(s)
|
||||||
|
assert r == [s]
|
||||||
|
|
||||||
|
def test_hostname_to_list_passthrough():
|
||||||
|
args = ["localhost"]
|
||||||
|
ret = hostname_list(args)
|
||||||
|
assert ret == args
|
||||||
|
|
||||||
|
args = ("localhost",)
|
||||||
|
ret = hostname_list(args)
|
||||||
|
assert ret == args
|
||||||
|
|
||||||
|
def test_splitting_hostname():
|
||||||
|
args = 'apple+banana+pear+'
|
||||||
|
ret = hostname_list(args)
|
||||||
|
assert ret == ['apple', 'banana', 'pear']
|
||||||
|
|
||||||
|
#not sensitive to trailing +
|
||||||
|
args = 'apple+banana+pear'
|
||||||
|
ret = hostname_list(args)
|
||||||
|
assert ret == ['apple', 'banana', 'pear']
|
||||||
|
|
||||||
|
def test_hostame_throws_on_wrong_args():
|
||||||
|
with pytest.raises(Exception) as e:
|
||||||
|
hostname_list(5)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.0.rc1
|
|
1
serverBin/mythen3DetectorServerv7.0.0.rc2
Symbolic link
1
serverBin/mythen3DetectorServerv7.0.0.rc2
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.0.rc2
|
Binary file not shown.
@ -313,7 +313,7 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask,
|
|||||||
chanReg, ichip * NCHAN + ich * NCOUNTERS,
|
chanReg, ichip * NCHAN + ich * NCOUNTERS,
|
||||||
ichip * NCHAN_1_COUNTER + ich, ichip, ich));
|
ichip * NCHAN_1_COUNTER + ich, ichip, ich));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 24; i++) {
|
for (int i = 1; i < 24; i++) {
|
||||||
patword = clearBit(SIGNAL_clk, patword);
|
patword = clearBit(SIGNAL_clk, patword);
|
||||||
pat->word[iaddr++] = patword;
|
pat->word[iaddr++] = patword;
|
||||||
|
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
#define APIGOTTHARD "7.0.0.rc1 0x221212"
|
#define APIGOTTHARD "7.0.0.rc1 0x221212"
|
||||||
#define APIGOTTHARD2 "7.0.0.rc1 0x221212"
|
#define APIGOTTHARD2 "7.0.0.rc1 0x221212"
|
||||||
#define APIJUNGFRAU "7.0.0.rc1 0x221212"
|
#define APIJUNGFRAU "7.0.0.rc1 0x221212"
|
||||||
#define APIMYTHEN3 "7.0.0.rc1 0x221212"
|
|
||||||
#define APIMOENCH "7.0.0.rc1 0x221212"
|
#define APIMOENCH "7.0.0.rc1 0x221212"
|
||||||
#define APIEIGER "7.0.0.rc1 0x221212"
|
#define APIEIGER "7.0.0.rc1 0x221212"
|
||||||
|
#define APIMYTHEN3 "7.0.0.rc2 0x230116"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user