Skip to content
Snippets Groups Projects
Commit 4650e8b3 authored by Valerio Mariani's avatar Valerio Mariani
Browse files

Updated load_crystfel_geometry to commit 41a8fa9819010fe8ddeb66676fee717f5226c7b8

parent 79be8de3
No related branches found
No related tags found
No related merge requests found
...@@ -582,38 +582,54 @@ def load_crystfel_geometry(filename): ...@@ -582,38 +582,54 @@ def load_crystfel_geometry(filename):
if panel['dim_structure'] is None: if panel['dim_structure'] is None:
panel['dim_structure'] = copy.deepcopy(default_dim) panel['dim_structure'] = copy.deepcopy(default_dim)
found_ss = False found_ss = 0
found_fs = False found_fs = 0
found_placeholder = False found_placeholder = 0
for entry in panel['dim_structure']: for dim_index, entry in enumerate(panel['dim_structure']):
if entry is None: if entry is None:
raise RuntimeError( raise RuntimeError(
"Not all dim entries are defined for all panels." "Dimension {} for panel {} is undefined.".format(
dim_index,
panel['name']
)
) )
elif entry == 'ss': elif entry == 'ss':
if found_ss is True: if found_ss != 1:
raise RuntimeError( raise RuntimeError(
"Only one slow scan dim coordinate is allowed." "Exactly one slow scan dim coordinate is needed "
"(found {} for panel {})".format(
found_ss,
panel['name']
)
) )
else: else:
found_ss = True found_ss += 1
elif entry == 'fs': elif entry == 'fs':
if found_fs is True: if found_fs != 1:
raise RuntimeError( raise RuntimeError(
"Only one fast scan dim coordinate is allowed." "Exactly one fast scan dim coordinate is needed "
"(found {} for panel {})".format(
found_fs,
panel['name']
)
) )
else: else:
found_fs = True found_fs += 1
elif entry == '%': elif entry == '%':
if found_placeholder is True: if found_placeholder != 1:
raise RuntimeError( raise RuntimeError(
"Only one placeholder dim coordinate is allowed." "Only one placeholder dim coordinate is allowed."
"Maximum one placeholder dim coordinate is "
"allowed (found {} for panel {})".format(
found_placeholder,
panel['name']
)
) )
else: else:
found_placeholder = True found_placeholder += 1
if dim_length is None: if dim_length is None:
dim_length = len(panel['dim_structure']) dim_length = len(panel['dim_structure'])
...@@ -730,6 +746,6 @@ def load_crystfel_geometry(filename): ...@@ -730,6 +746,6 @@ def load_crystfel_geometry(filename):
# The code of this function is synced with the code of the function # The code of this function is synced with the code of the function
# 'get_detector_geometry_2' in CrystFEL at commit # 'get_detector_geometry_2' in CrystFEL at commit
# 41a8fa9819010fe8ddeb66676fee717f5226c7b8 # 92f2ebfd11d0ccd91ab299f95ffb2d99a457643d
return detector return detector
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment