fixed the treatment of a response that contains only one run

This commit is contained in:
2022-01-31 13:51:03 +01:00
parent 7abd21de5e
commit ec1eb71212
+7 -4
View File
@@ -1,6 +1,6 @@
import os
from time import sleep
from collections import defaultdict
from collections import defaultdict, Iterable
from slic.utils.channels import Channels
from slic.utils.printing import printable_dict
@@ -72,8 +72,11 @@ class SFAcquisition(BaseAcquisition):
paths = SwissFELPaths(self.instrument, self.pgroup)
def _acquire():
res = client.start_continuous() if continuous else client.start()
res = transpose_dicts(res) #TODO: only for continuous?
if continuous:
res = client.start_continuous()
res = transpose_dicts(res)
else:
res = client.start()
filenames = res.pop("filenames")
print_response(res)
return filenames
@@ -126,7 +129,7 @@ def print_response(res):
to_print = {}
for k, v in res.items():
k = k.replace("_", " ")
if len(set(v)) == 1:
if isinstance(v, Iterable) and len(set(v)) == 1: #TODO: maybe the Iterable check should not be here, but in transpose_dicts?
v = v[0]
else:
k = k if k.endswith("s") else k+"s"