Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
python-handel
Commits
bc8ae970
Commit
bc8ae970
authored
Sep 13, 2017
by
Vincent Michel
Committed by
U-ESRF\opid00
Sep 13, 2017
Browse files
Add Stats namedtuple
parent
fa505425
Pipeline
#966
passed with stages
in 1 minute and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
handel/interface.py
View file @
bc8ae970
...
...
@@ -3,6 +3,7 @@
from
__future__
import
absolute_import
import
os
from
collections
import
namedtuple
import
numpy
...
...
@@ -33,6 +34,9 @@ MAX_STRING_LENGTH = 80
# Helpers
Stats
=
namedtuple
(
'Stats'
,
'realtime livetime triggers events icr ocr'
)
def
to_bytes
(
arg
):
if
isinstance
(
arg
,
bytes
):
return
arg
...
...
@@ -163,7 +167,13 @@ def get_module_statistics(module):
data
=
ffi
.
cast
(
'double *'
,
array
.
ctypes
.
data
)
code
=
handel
.
xiaGetRunData
(
master
,
b
'module_statistics'
,
data
)
check_error
(
code
)
return
{
channel
:
array
[
index
:
index
+
7
].
tolist
()
return
{
channel
:
Stats
(
array
[
index
*
7
+
0
],
# Realtime
array
[
index
*
7
+
1
],
# Livetime
int
(
array
[
index
*
7
+
3
]),
# Triggers
int
(
array
[
index
*
7
+
4
]),
# MCA events
int
(
array
[
index
*
7
+
5
]),
# Input count rate
int
(
array
[
index
*
7
+
6
]))
# Output count rate
for
index
,
channel
in
enumerate
(
channels
)
if
channel
!=
-
1
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment