Skip to content

Commit d2e6a24

Browse files
committed
Catches for single batch position
1 parent 6eb9a68 commit d2e6a24

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/murfey/client/contexts/tomo_metadata.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,14 @@ def post_transfer(
235235
for_parsing = xml.read()
236236
batch_xml = xmltodict.parse(for_parsing)
237237

238-
for batch_position in batch_xml["BatchPositionsList"]["BatchPositions"][
238+
batch_positions_list = batch_xml["BatchPositionsList"]["BatchPositions"][
239239
"BatchPositionParameters"
240-
]:
240+
]
241+
if isinstance(batch_positions_list, dict):
242+
# Case of a single batch
243+
batch_positions_list = [batch_positions_list]
244+
245+
for batch_position in batch_positions_list:
241246
batch_name = batch_position["Name"]
242247
search_map_name = batch_position["PositionOnTileSet"]["TileSetName"]
243248
batch_stage_location_x = float(
@@ -271,7 +276,7 @@ def post_transfer(
271276
)
272277

273278
# Beamshifts
274-
if batch_position["AdditionalExposureTemplateAreas"]:
279+
if batch_position.get("AdditionalExposureTemplateAreas"):
275280
beamshifts = batch_position["AdditionalExposureTemplateAreas"][
276281
"ExposureTemplateAreaParameters"
277282
]

0 commit comments

Comments
 (0)