Commit 3909c01d authored by Vincent Michel's avatar Vincent Michel

Make FalconX statistics more robust

parent ee1bb688
Pipeline #1294 passed with stages
in 1 minute and 21 seconds
......@@ -7,7 +7,7 @@ from functools import reduce
import numpy
from .error import check_error
from .error import check_error, HandelError
from ._cffi import handel, ffi
from .stats import stats_from_normal_mode
from .parser import parse_xia_ini_file
......@@ -134,6 +134,13 @@ def stop_run(channel=None):
check_error(code)
def get_channel_realtime(channel):
time = ffi.new('double *')
code = handel.xiaGetRunData(channel, b'realtime', time)
check_error(code)
return time[0]
def get_spectrum_length(channel):
length = ffi.new('unsigned long *')
code = handel.xiaGetRunData(channel, b'mca_length', length)
......@@ -179,7 +186,10 @@ def get_module_statistics(module):
if get_module_type(module).startswith(u'falconx'):
for channel in channels:
if channel >= 0:
get_spectrum(channel)
try:
get_spectrum(channel)
except HandelError:
pass
# Prepare buffer
data_size = 9 * len(channels)
master = next(c for c in channels if c >= 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment