diff --git a/RELEASE.txt b/RELEASE.txt index 64d7b3d9e..1cc3e044b 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -61,7 +61,7 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2 * Qt5 and in-built compressed Qwt 6.1.5 - Ported from Qt4 to Qt5. + Ported from Qt4 to Qt5. Minimum requirement: Qt 5.9 Compressed Qwt 6.1.5 added into the package in libs. It is unpacked and built as a static library.This allows us to remove qwt as an external dependency and reduces the risk of picking up the wrong version. @@ -167,6 +167,10 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2 debug->detSpec3 roundRnumber->detSpec4 + Header version number stays the same in the UDP header as there is no + difference in the format from the detector. Only the structure memeber names + have changed in sls_detector_defs.h + Further details about each detector specific field can be found at: https://slsdetectorgroup.github.io/devdoc/udpdetspec.html diff --git a/docs/src/dependencies.rst b/docs/src/dependencies.rst index 03a192f3f..7940809fc 100644 --- a/docs/src/dependencies.rst +++ b/docs/src/dependencies.rst @@ -21,10 +21,8 @@ the shared libraries these are needed: GUI ----------------------- -The GUI is currently using Qt4 but watch out for an upgrade to 5. - - * Qt 4.8 - * Qwt 6.1 + * Qt 5.9 + * Qwt 6.1.5 (packaged in libs/) ----------------------- Python bindings diff --git a/docs/src/firmware.rst b/docs/src/firmware.rst index 1570fbe31..c417478aa 100644 --- a/docs/src/firmware.rst +++ b/docs/src/firmware.rst @@ -92,19 +92,30 @@ Download Upgrade ^^^^^^^^ -.. note :: +.. warning :: + + In case you have had issues in the past with programming via software: + + * 6.1.2 server has a fix for seamless fpga programming + + * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'. + + * Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release. - These instructions are for upgrades from v5.0.0. For earlier versions, contact us. Check :ref:`firmware troubleshooting ` if you run into issues while programming firmware. -Always ensure that the client and server software are of the same release. + Program from console .. code-block:: bash + # These instructions are for upgrades from v5.0.0. For earlier versions, please contact us. + + # Always ensure that the client and server software are of the same release. + # copies server from tftp folder of pc, links new server to jungfrauDetectorServer, # removes old server from respawn, sets up new lnked server to respawn # programs fpga, @@ -155,10 +166,6 @@ Upgrade Mythen III ----------- -.. note :: - - As it is still in development, the rbf files must be picked up from us. - Download ^^^^^^^^^^^^^ @@ -170,11 +177,11 @@ Download Upgrade ^^^^^^^^ -Always ensure that the client and server software are of the same release. - Program from console .. code-block:: bash + # Always ensure that the client and server software are of the same release. + # copies server from tftp folder of pc, links new server to mythen3DetectorServer, # programs fpga, # reboots @@ -199,11 +206,11 @@ Download Upgrade ^^^^^^^^ -Always ensure that the client and server software are of the same release. - Program from console .. code-block:: bash + # Always ensure that the client and server software are of the same release. + # copies server from tftp folder of pc, links new server to gotthard2DetectorServer, # programs fpga, # reboots @@ -230,13 +237,26 @@ Download Upgrade ^^^^^^^^ +.. warning :: + + In case you have had issues in the past with programming via software: + + * 6.1.2 server has a fix for seamless fpga programming + + * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'. + + * Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release. + + + Check :ref:`firmware troubleshooting ` if you run into issues while programming firmware. -Always ensure that the client and server software are of the same release. Program from console .. code-block:: bash + # Always ensure that the client and server software are of the same release. + # copies server from tftp folder of pc, links new server to moenchDetectorServer, # removes old server from respawn, sets up new lnked server to respawn # programs fpga, @@ -262,11 +282,12 @@ Upgrade Check :ref:`firmware troubleshooting ` if you run into issues while programming firmware. -Always ensure that the client and server software are of the same release. Program from console .. code-block:: bash + # Always ensure that the client and server software are of the same release. + # copies server from tftp folder of pc, links new server to ctbDetectorServer, # removes old server from respawn, sets up new lnked server to respawn # programs fpga, diff --git a/docs/src/pyexamples.rst b/docs/src/pyexamples.rst index f432541da..9521b32c0 100755 --- a/docs/src/pyexamples.rst +++ b/docs/src/pyexamples.rst @@ -10,27 +10,46 @@ open an issue in our our `github repo Setting exposure time ------------------------------------ -Setting and reading back exposure time can be done either using a Python datetime.timedelta -or by setting the time in seconds. +Setting and reading back exposure time can be done either using a Python +datetime.timedelta, DurationWrapper or by setting the time in seconds. :: # Set exposure time to 1.2 seconds >>> d.exptime = 1.2 + >>> d.exptime = 5e-07 - # Setting exposure time using timedelta + # Setting exposure time using timedelta (upto microseconds precision) import datetime as dt >>> d.exptime = dt.timedelta(seconds = 1.2) + >>> d.exptime = dt.timedelta(seconds = 1, microseconds = 3) # With timedelta any arbitrary combination of units can be used >>> t = dt.timedelta(microseconds = 100, seconds = 5.3, minutes = .3) + # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.exptime = DurationWrapper(1.2) + + # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.exptime = t + # To set exposure time for individual detector one have to resort # to the C++ style API. # Sets exposure time to 1.2 seconds for module 0, 6 and 12 >>> d.setExptime(1.2, [0, 6, 12]) >>> d.setExptime(dt.timedelta(seconds = 1.2), [0, 6, 12]) + # to get in seconds + >>> d.period + 181.23 + + # to get in DurationWrapper + >>> d.getExptime() + [sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)] + ------------------------------------ @@ -220,8 +239,7 @@ Setting and getting times # This sets the exposure time for all modules d.exptime = 0.5 - # exptime also accepts a python datetime.timedelta - # which can be used to set the time in almost any unit + # exptime also accepts a python datetime.timedelta (upto microseconds resolution) t = dt.timedelta(milliseconds = 2.3) d.exptime = t @@ -229,16 +247,25 @@ Setting and getting times t = dt.timedelta(minutes = 3, seconds = 1.23) d.exptime = t + # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.exptime = DurationWrapper(1.2) + + # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.exptime = t + # exptime however always returns the time in seconds >>> d.exptime 181.23 # To get back the exposure time for each module # it's possible to use getExptime, this also returns - # the values as datetime.timedelta + # the values as DurationWrapper >>> d.getExptime() - [datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)] + [sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)] # In case the values are the same it's possible to use the # element_if_equal function to reduce the values to a single @@ -246,7 +273,8 @@ Setting and getting times >>> t = d.getExptime() >>> element_if_equal(t) - datetime.timedelta(seconds=1) + sls::DurationWrapper(total_seconds: 1.2 count: 1200000000) + -------------- Reading dacs diff --git a/docs/src/pygettingstarted.rst b/docs/src/pygettingstarted.rst index 20ae20276..5caf8723e 100644 --- a/docs/src/pygettingstarted.rst +++ b/docs/src/pygettingstarted.rst @@ -6,7 +6,7 @@ Getting Started Which Python? -------------------- -We require at lest Python 3.6 and strongly recommended that you don't use the system +We require at least Python 3.6 and strongly recommended that you don't use the system Python installation. The examples in this documentation uses `conda `_ since it provides good support also for non Python packages but there are also other alternatives like, pyenv. @@ -14,29 +14,35 @@ also for non Python packages but there are also other alternatives like, pyenv. Using something like conda also allows you to quickly switch beteen different Python environments. +--------------------- +Building from Source +--------------------- + +If you are not installing slsdet binaries from conda, but instead building from +source, please refer to :ref:`the installation section` for details. + +Don't forget to compile with the option SLS_USE_PYTHON=ON to enable the Python +bindings or if you use the cmk.sh script -p. + .. note :: - Ensure that the python lib compiled is for the expected python version. + Ensure that the sls det python lib compiled is for the expected python version. For example, build/bin/_slsdet.cpython-39-x86_64-linux-gnu.so for Python v3.9.x + --------------------- PYTHONPATH --------------------- -If you install slsdet using conda everything is set up and you can +If you install slsdet binaries using conda everything is set up and you can directly start using the Python bindings. However, if you build -from source you need to tell Python where to find slsdet. This -is be done by adding your build/bin directory to PYTHONPATH. +from source you need to tell Python where to find slsdet to use it. This +can be done by adding your build/bin directory to PYTHONPATH. .. code-block:: bash export PYTHONPATH = /path/to/your/build/bin:$PYTHONPATH -.. note :: - - Don't forget to compile with the option SLS_USE_PYTHON=ON to enable - the Python bindings or if you use the cmk.sh script -p. - -------------------------------------- Which detector class should I use? -------------------------------------- @@ -147,9 +153,11 @@ their name. :: >>> [item for item in dir(d) if 'time' in item] - ['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft', - 'getSubExptime', 'patwaittime0', 'patwaittime1', 'patwaittime2', - 'setExptime', 'setSubExptime', 'subdeadtime', 'subexptime'] + ['compdisabletime', 'exptime', 'exptimel', 'frametime', 'getExptime', + 'getExptimeForAllGates', 'getExptimeLeft', 'getSubExptime', 'patwaittime', + 'patwaittime0', 'patwaittime1', 'patwaittime2', 'runtime', 'setExptime', + 'setSubExptime', 'subdeadtime', 'subexptime'] + The above method works on any Python object but for convenience we also included two functions to find names. View prints the names one per line @@ -161,6 +169,7 @@ while find returns a list of names. >>> view('exptime') exptime + exptimel getExptime getExptimeForAllGates getExptimeLeft @@ -169,6 +178,7 @@ while find returns a list of names. setSubExptime subexptime + >>> find('exptime') ['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft', 'getSubExptime', 'setExptime', 'setSubExptime', 'subexptime'] @@ -186,19 +196,39 @@ To access the documentation of a function directly from the Python prompt use he Help on property: Period between frames, accepts either a value in seconds or datetime.timedelta - + Note ----- - :getter: always returns in seconds. To get in datetime.delta, use getPeriod - - Examples + :getter: always returns in seconds. To get in DurationWrapper, use getPeriod + + Example ----------- + >>> # setting directly in seconds >>> d.period = 1.05 - >>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23) + >>> + >>> # setting directly in seconds + >>> d.period = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.period = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.period = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.period = t + >>> + >>> # to get in seconds >>> d.period 181.23 - >>> d.getPeriod() - [datetime.timedelta(seconds=181, microseconds=230000)] + >>> + >>> d.getExptime() + [sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)] + ---------------------- @@ -218,11 +248,12 @@ The enums can be found in slsdet.enums import slsdet >>> [e for e in dir(slsdet.enums) if not e.startswith('_')] - ['burstMode', 'clockIndex', 'dacIndex', - 'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag', - 'fileFormat', 'frameDiscardPolicy', - 'readoutMode', 'runStatus', 'speedLevel', 'timingMode', - 'timingSourceType'] + ['M3_GainCaps', 'burstMode', 'clockIndex', 'cls', 'dacIndex', 'detectorSettings', + 'detectorType', 'dimension', 'externalSignalFlag', 'fileFormat', + 'frameDiscardPolicy', 'gainMode', 'name', 'polarity', 'portPosition', + 'readoutMode', 'runStatus', 'speedLevel', 'streamingInterface', 'timingMode', + 'timingSourceType', 'vetoAlgorithm'] + # Even though importing using * is not recommended one could # get all the enums like this: diff --git a/docs/src/servers.rst b/docs/src/servers.rst index bcf94c156..4a0faebb9 100644 --- a/docs/src/servers.rst +++ b/docs/src/servers.rst @@ -23,15 +23,19 @@ Arguments .. code-block:: bash Possible arguments are: - -v, --version : Software version - -p, --port : TCP communication port with client. - -g, --nomodule : [Mythen3][Gotthard2] Generic or No Module mode. - Skips detector type checks. - -f, --phaseshift : [Gotthard] only. Sets phase shift. - -d, --devel : Developer mode. Skips firmware checks. - -u, --update : Update mode. Skips firmware checks and initial detector setup. - -s, --stopserver : Stop server. Do not use as it is created by control server - + -v, --version : Software version + -p, --port : TCP communication port with client. + -g, --nomodule : [Mythen3][Gotthard2] + Generic or No Module mode. Skips detector type checks. + -f, --phaseshift : [Gotthard] only. Sets phase shift. + -d, --devel : Developer mode. Skips firmware checks. + -u, --update : Update mode. Skips firmware checks and initial detector setup. + -i, --ignore-config : [Eiger][Jungfrau][Gotthard][Gotthard2][Moench] + Ignore config file. + -m, --master : [Eiger][Mythen3][Gotthard][Gotthard2] + Set Master to 0 or 1. Precedence over config file. Only for virtual servers except Eiger. + -t, --top : [Eiger] Set Top to 0 or 1. Precedence over config file. + -s, --stopserver : Stop server. Do not use as it is created by control server .. _Automatic start servers: @@ -88,6 +92,8 @@ One can start the on-board detector server automatically upon powering on the bo .. code-block:: bash sync + + # physically reboot for Gotthard II or Mythen III reboot # verify diff --git a/docs/src/udpconfig.rst b/docs/src/udpconfig.rst index 457d1f381..f3e56d82a 100644 --- a/docs/src/udpconfig.rst +++ b/docs/src/udpconfig.rst @@ -6,6 +6,10 @@ Config file Commands to configure the UDP in the config file: +.. note :: + + These command are recommended to be placed before "rx_hostname" if it is used. + Source Port ----------- Hardcoded in detector server, starting at 32410. diff --git a/docs/src/udpdetspec.rst b/docs/src/udpdetspec.rst index cf9dd398e..afeeeb564 100644 --- a/docs/src/udpdetspec.rst +++ b/docs/src/udpdetspec.rst @@ -110,7 +110,7 @@ Jungfrau | | | | last exposure. | | | +-----+----------------------------------------+ | | | 0 | External input flag not detected in the| - | | | | last exposure. | + | | | | last exposure. | +----------+--------------------+-----+----------------------------------------+ diff --git a/docs/src/udpheader.rst b/docs/src/udpheader.rst index 6bedffc91..8b3999e70 100644 --- a/docs/src/udpheader.rst +++ b/docs/src/udpheader.rst @@ -9,7 +9,7 @@ The UDP data format for the packets consist of a common header for all detectors Current Version --------------------------- -**v3.0 (slsDetectorPackage v7.0.0+)** +**v2.0 (slsDetectorPackage v7.0.0+)** .. table:: <---------------------------------------------------- 8 bytes ----------------------------------------------------> :align: center @@ -30,6 +30,18 @@ Current Version +-------------------------------+---------------+-------+-------+ +.. note :: + + Since there is no difference in the format of the UDP header from the detector + from the previous version (v2.0), the version number stays the same. + + Only the struture member names have changed in sls_detector_defs.h + + + +Description +------------ + * **Detector specific field** descriptions are found :ref:`here`. * **frameNumber**: framenumber to which the current packet belongs to. @@ -48,6 +60,12 @@ Current Version * **detType**: detector type from enum of detectorType in the package. +* **version**: current version of the detector header (0x2). + + +Detector Enum +-------------- + ================ ======== Detector Type Value ================ ======== @@ -61,7 +79,6 @@ Current Version GOTTHARD2 7 ================ ======== -* **version**: current version of the detector header. It is at 0x3. Previous Versions diff --git a/docs/src/virtualserver.rst b/docs/src/virtualserver.rst index 66d66ab74..7a030347a 100644 --- a/docs/src/virtualserver.rst +++ b/docs/src/virtualserver.rst @@ -13,16 +13,14 @@ Compilation * Using cmk.sh script, .. code-block:: bash - ./cmk.sh -bsj9 #option s is for simulator + ./cmk.sh -bsj9 # option -s is for simulator Binaries ^^^^^^^^ .. code-block:: bash - eigerDetectorServerMaster_virtual - eigerDetectorServerSlaveTop_virtual - eigerDetectorServerSlaveBottom_virtual + eigerDetectorServer_virtual jungfrauDetectorServer_virtual gotthardDetectorServer_virtual gotthard2DetectorServer_virtual @@ -67,7 +65,15 @@ Sample Config file ^^^^^^^^^^^^^^^^^^ There are sample config files for each detector in slsDetectorPackage/examples folder. -For a Single Module +For a Single Module (Basic) + .. code-block:: bash + + hostname localhost + rx_hostname localhost + udp_dstip auto + + +For a Single Module (With Options) .. code-block:: bash # connects to control port 1912 @@ -140,7 +146,7 @@ Gui Limitations ----------- -#. Data coming out of virtual server is fake. Value at each pixel/ channel is incremented by 1. +#. Data coming out of virtual server is fake. #. A stop will stop the virtual acquisition only at the start of every new frame. diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 4c6da434c..42346a8bc 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -472,6 +472,9 @@ class Detector(CppDetectorApi): ----------- >>> # setting directly in seconds >>> d.exptime = 1.05 + >>> + >>> # setting directly in seconds + >>> d.exptime = 5e-07 >>> >>> # using timedelta (up to microseconds precision) >>> from datatime import timedelta @@ -519,16 +522,35 @@ class Detector(CppDetectorApi): Note ----- - :getter: always returns in seconds. To get in datetime.delta, use getPeriod + :getter: always returns in seconds. To get in DurationWrapper, use getPeriod Example ----------- + >>> # setting directly in seconds >>> d.period = 1.05 - >>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23) + >>> + >>> # setting directly in seconds + >>> d.period = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.period = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.period = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.period = t + >>> + >>> # to get in seconds >>> d.period 181.23 - >>> d.getPeriod() - [datetime.timedelta(seconds=181, microseconds=230000)] + >>> + >>> d.getExptime() + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ res = self.getPeriod() return reduce_time(res) @@ -548,7 +570,7 @@ class Detector(CppDetectorApi): ----- [Gotthard2] only in continuous mode. - :getter: always returns in seconds. To get in datetime.delta, use getPeriodLeft + :getter: always returns in seconds. To get in DurationWrapper, use getPeriodLeft :setter: Not Implemented Example @@ -556,7 +578,7 @@ class Detector(CppDetectorApi): >>> d.periodl 181.23 >>> d.getPeriodLeft() - [datetime.timedelta(seconds=181, microseconds=230000)] + [sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)] """ return self.getPeriodLeft() @@ -564,21 +586,40 @@ class Detector(CppDetectorApi): @element def delay(self): """ - [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds or datetime.timedelta + [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta Note ----- - :getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTrigger + :getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTrigger Example ----------- + >>> # setting directly in seconds >>> d.delay = 1.05 - >>> d.delay = datetime.timedelta(minutes = 3, seconds = 1.23) + >>> + >>> # setting directly in seconds + >>> d.delay = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.delay = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.delay = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.delay = t + >>> + >>> # to get in seconds >>> d.delay 181.23 + >>> >>> d.getDelayAfterTrigger() - [datetime.timedelta(seconds=181, microseconds=230000)] + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ return ut.reduce_time(self.getDelayAfterTrigger()) @@ -590,13 +631,13 @@ class Detector(CppDetectorApi): @element def delayl(self): """ - [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds or datetime.timedelta + [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds, datetime.timedelta or DurationWrapper Note ----- [Gotthard2] only in continuous mdoe. - :getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTriggerLeft + :getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTriggerLeft :setter: Not Implemented Example @@ -604,7 +645,7 @@ class Detector(CppDetectorApi): >>> d.delayl 181.23 >>> d.getDelayAfterTriggerLeft() - [datetime.timedelta(seconds=181, microseconds=230000)] + [sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)] """ return ut.reduce_time(self.getDelayAfterTriggerLeft()) @@ -2041,16 +2082,35 @@ class Detector(CppDetectorApi): ---- Subperiod = subexptime + subdeadtime. - :getter: always returns in seconds. To get in datetime.delta, use getSubExptime + :getter: always returns in seconds. To get in DurationWrapper, use getSubExptime Example ----------- + >>> # setting directly in seconds >>> d.subexptime = 1.230203 - >>> d.subexptime = datetime.timedelta(seconds = 1.23, microseconds = 203) + >>> + >>> # setting directly in seconds + >>> d.subexptime = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.subexptime = timedelta(seconds = 1.23, microseconds = 203) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.subexptime = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.subexptime = t + >>> + >>> # to get in seconds >>> d.subexptime - 1.230203 + 181.23 + >>> >>> d.getSubExptime() - [datetime.timedelta(seconds = 1, microseconds = 203)] + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ res = self.getSubExptime() return reduce_time(res) @@ -2082,22 +2142,41 @@ class Detector(CppDetectorApi): @property def subdeadtime(self): """ - [Eiger] Dead time of EIGER subframes in 32 bit mode, accepts either a value in seconds or datetime.timedelta + [Eiger] Dead time of EIGER subframes in 32 bit mode, accepts either a value in seconds, datetime.timedelta or DurationWrapper Note ---- Subperiod = subexptime + subdeadtime. - :getter: always returns in seconds. To get in datetime.delta, use getSubDeadTime + :getter: always returns in seconds. To get in DurationWrapper, use getSubDeadTime Example ----------- + >>> # setting directly in seconds >>> d.subdeadtime = 1.230203 - >>> d.subdeadtime = datetime.timedelta(seconds = 1.23, microseconds = 203) + >>> + >>> # setting directly in seconds + >>> d.subdeadtime = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.subdeadtime = timedelta(seconds = 1.23, microseconds = 203) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.subdeadtime = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.subdeadtime = t + >>> + >>> # to get in seconds >>> d.subdeadtime - 1.230203 + 181.23 + >>> >>> d.getSubDeadTime() - [datetime.timedelta(seconds = 1, microseconds = 203)] + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ res = self.getSubDeadTime() return reduce_time(res) @@ -2273,16 +2352,35 @@ class Detector(CppDetectorApi): ----- It is only possible for chipv1.1. - :getter: always returns in seconds. To get in datetime.delta, use getComparatorDisableTime + :getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime Example ----------- + >>> # setting directly in seconds >>> d.compdisabletime = 1.05 - >>> d.compdisabletime = datetime.timedelta(minutes = 3, seconds = 1.23) + >>> + >>> # setting directly in seconds + >>> d.compdisabletime = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.compdisabletime = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.compdisabletime = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.compdisabletime = t + >>> + >>> # to get in seconds >>> d.compdisabletime 181.23 + >>> >>> d.getComparatorDisableTime() - [datetime.timedelta(seconds=181, microseconds=230000)] + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ return ut.reduce_time(self.getComparatorDisableTime()) @@ -2340,23 +2438,42 @@ class Detector(CppDetectorApi): @property def storagecell_delay(self): """ - [Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds or datetime.timedelta + [Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds, datetime.timedelta or DurationWrapper Note ----- Only applicable for chipv1.0. For advanced users only \n Value: 0-1638375 ns (resolution of 25ns) - :getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay + :getter: always returns in seconds. To get in DurationWrapper, use getStorageCellDelay Example ----------- - >>> d.storagecell_delay = 0.00056 - >>> d.storagecell_delay = datetime.timedelta(microseconds = 45) + >>> # setting directly in seconds + >>> d.storagecell_delay = 1.05 + >>> + >>> # setting directly in seconds + >>> d.storagecell_delay = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.storagecell_delay = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.storagecell_delay = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.storagecell_delay = t + >>> + >>> # to get in seconds >>> d.storagecell_delay - 4.5e-05 + 181.23 + >>> >>> d.getStorageCellDelay() - [datetime.timedelta(microseconds=45)] + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ return ut.reduce_time(self.getStorageCellDelay()) @@ -2630,18 +2747,36 @@ class Detector(CppDetectorApi): Note ----- - :getter: always returns in seconds. To get in datetime.delta, use getBurstPeriod + :getter: always returns in seconds. To get in DurationWrapper, use getBurstPeriod :setter: Not Implemented Example ----------- + >>> # setting directly in seconds >>> d.burstperiod = 1.05 - >>> d.burstperiod = datetime.timedelta(minutes = 3, seconds = 1.23) + >>> + >>> # setting directly in seconds + >>> d.burstperiod = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.burstperiod = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.burstperiod = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.burstperiod = t + >>> + >>> # to get in seconds >>> d.burstperiod 181.23 + >>> >>> d.getBurstPeriod() - [datetime.timedelta(seconds=181, microseconds=230000)] - + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ return ut.reduce_time(self.getBurstPeriod()) @@ -2766,25 +2901,41 @@ class Detector(CppDetectorApi): @property def gatedelay(self): """ - [Mythen3] Gate Delay of all gate signals in auto and trigger mode (internal gating), accepts either a value in seconds or datetime.timedelta + [Mythen3] Gate Delay of all gate signals in auto and trigger mode (internal gating), accepts either a value in seconds, datetime.timedelta or DurationWrapper Note ----- To specify gateIndex, use getGateDelay or setGateDelay. - :getter: always returns in seconds. To get in datetime.delta, use getGateDelayForAllGates or getGateDelay(gateIndex) + :getter: always returns in seconds. To get in DurationWrapper, use getGateDelayForAllGates or getGateDelay(gateIndex) Example ----------- + >>> # setting directly in seconds >>> d.gatedelay = 1.05 - >>> d.gatedelay = datetime.timedelta(minutes = 3, seconds = 1.23) + >>> + >>> # setting directly in seconds + >>> d.gatedelay = 5e-07 + >>> + >>> # using timedelta (up to microseconds precision) + >>> from datatime import timedelta + >>> d.gatedelay = timedelta(seconds = 1, microseconds = 3) + >>> + >>> # using DurationWrapper to set in seconds + >>> from slsdet import DurationWrapper + >>> d.gatedelay = DurationWrapper(1.2) + >>> + >>> # using DurationWrapper to set in ns + >>> t = DurationWrapper() + >>> t.set_count(500) + >>> d.gatedelay = t + >>> + >>> # to get in seconds >>> d.gatedelay 181.23 - >>> d.setGateDelay(1, datetime.timedelta(seconds = 2)) - >>> d.gatedelay - >>> [1.0, 2.0, 1.0] + >>> >>> d.getExptimeForAllGates() - >>> [[datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]] + sls::DurationWrapper(total_seconds: 181.23 count: 181230000000) """ return reduce_time(self.getGateDelayForAllGates()) @@ -3588,7 +3739,7 @@ class Detector(CppDetectorApi): Note ----- - :getter: always returns in seconds. To get in datetime.delta, use getExptimeLeft + :getter: always returns in seconds. To get in DurationWrapper, use getExptimeLeft :setter: Not Implemented Example @@ -3596,7 +3747,7 @@ class Detector(CppDetectorApi): >>> d.exptimel 181.23 >>> d.getExptimeLeft() - [datetime.timedelta(seconds=181, microseconds=230000)] + [sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)] """ t = self.getExptimeLeft() return reduce_time(t)