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
0c202935
Commit
0c202935
authored
Sep 13, 2017
by
Vincent Michel
Committed by
U-ESRF\opid00
Sep 13, 2017
Browse files
Add deadtime to Stats
parent
bc8ae970
Pipeline
#967
passed with stages
in 1 minute and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
handel/interface.py
View file @
0c202935
...
...
@@ -34,7 +34,7 @@ MAX_STRING_LENGTH = 80
# Helpers
Stats
=
namedtuple
(
'Stats'
,
'realtime livetime triggers events icr ocr'
)
Stats
=
namedtuple
(
'Stats'
,
'realtime livetime triggers events icr ocr
deadtime
'
)
def
to_bytes
(
arg
):
...
...
@@ -160,6 +160,7 @@ def is_running():
# Statistics
def
get_module_statistics
(
module
):
# Get raw data
channels
=
get_module_channels
(
module
)
data_size
=
7
*
len
(
channels
)
master
=
next
(
c
for
c
in
channels
if
c
!=
-
1
)
...
...
@@ -167,15 +168,20 @@ 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
:
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
}
# Parse raw data
result
=
{}
for
index
,
channel
in
enumerate
(
channels
):
if
channel
!=
-
1
:
realtime
=
array
[
index
*
7
+
0
]
livetime
=
array
[
index
*
7
+
1
]
triggers
=
int
(
array
[
index
*
7
+
3
])
events
=
int
(
array
[
index
*
7
+
4
])
icr
=
int
(
array
[
index
*
7
+
5
])
ocr
=
int
(
array
[
index
*
7
+
6
])
deadtime
=
1
-
float
(
ocr
)
/
icr
if
icr
!=
0
else
1.
result
[
channel
]
=
Stats
(
realtime
,
livetime
,
triggers
,
events
,
icr
,
ocr
,
deadtime
)
return
result
def
get_statistics
():
...
...
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