Skip to content

Commit 7a14ecc

Browse files
Fixes for tomography metadata (#631)
* Do not error if the batch positions list is empty * Do not error if no atlas is present in the session dm file * Correctly assign dcg as tomo not spa
1 parent d7ed7cb commit 7a14ecc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/murfey/client/contexts/tomo_metadata.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def ensure_dcg_exists(transferred_file: Path, environment: MurfeyInstanceEnviron
2525
dcg_tag = str(source).replace(f"/{environment.visit}", "")
2626
url = f"{str(environment.url.geturl())}{url_path_for('workflow.router', 'register_dc_group', visit_name=environment.visit, session_id=environment.murfey_session)}"
2727
dcg_data = {
28-
"experiment_type": "single particle",
29-
"experiment_type_id": 37,
28+
"experiment_type": "tomo",
29+
"experiment_type_id": 36,
3030
"tag": dcg_tag,
3131
}
3232
capture_post(url, json=dcg_data)
@@ -57,6 +57,9 @@ def post_transfer(
5757

5858
windows_path = session_data["TomographySession"]["AtlasId"]
5959
logger.info(f"Windows path to atlas metadata found: {windows_path}")
60+
if not windows_path:
61+
logger.warning("No atlas metadata path found")
62+
return
6063
visit_index = windows_path.split("\\").index(environment.visit)
6164
partial_path = "/".join(windows_path.split("\\")[visit_index + 1 :])
6265
logger.info("Partial Linux path successfully constructed from Windows path")
@@ -257,9 +260,12 @@ def post_transfer(
257260
for_parsing = xml.read()
258261
batch_xml = xmltodict.parse(for_parsing)
259262

260-
batch_positions_list = batch_xml["BatchPositionsList"]["BatchPositions"][
261-
"BatchPositionParameters"
262-
]
263+
batch_positions_from_xml = batch_xml["BatchPositionsList"]["BatchPositions"]
264+
if not batch_positions_from_xml:
265+
logger.info("No batch positions yet")
266+
return
267+
268+
batch_positions_list = batch_positions_from_xml["BatchPositionParameters"]
263269
if isinstance(batch_positions_list, dict):
264270
# Case of a single batch
265271
batch_positions_list = [batch_positions_list]

0 commit comments

Comments
 (0)