mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-17 22:51:30 +01:00
Nanosecond times in Python (#522)
* initital implementation * datetime replaces with sls::Duration in Python C bindings * using custom type caster * fix for conversion to seconds * added set_count in python * common header for pybind11 includes authored-by: Erik Frojdh <erik.frojdh@psi.ch>
This commit is contained in:
@@ -24,4 +24,5 @@ from .defines import *
|
||||
IpAddr = _slsdet.IpAddr
|
||||
MacAddr = _slsdet.MacAddr
|
||||
scanParameters = _slsdet.scanParameters
|
||||
currentSrcParameters = _slsdet.currentSrcParameters
|
||||
currentSrcParameters = _slsdet.currentSrcParameters
|
||||
DurationWrapper = _slsdet.DurationWrapper
|
||||
@@ -79,7 +79,7 @@ def element_if_equal(mylist):
|
||||
|
||||
def reduce_time(mylist):
|
||||
res = element_if_equal(element_if_equal(mylist))
|
||||
if isinstance(res, dt.timedelta):
|
||||
if isinstance(res, (dt.timedelta, _slsdet.DurationWrapper)):
|
||||
return res.total_seconds()
|
||||
elif isinstance(res[0], list):
|
||||
return [[item.total_seconds() for item in subl] for subl in res]
|
||||
|
||||
Reference in New Issue
Block a user