Skip to content

Commit 1555602

Browse files
committed
Attempt to fix the atlas path inserted into ispyb
1 parent 3a3c4c6 commit 1555602

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/murfey/client/contexts/spa_metadata.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ def _atlas_destination(
6666
instrument_name=environment.instrument_name,
6767
demo=environment.demo,
6868
)
69-
if environment.visit in environment.default_destinations[source]:
70-
return (
71-
Path(machine_config.get("rsync_basepath", ""))
72-
/ Path(environment.default_destinations[source]).parent
73-
)
69+
for i, destination_part in enumerate(
70+
Path(environment.default_destinations[source]).parts
71+
):
72+
if destination_part == environment.visit:
73+
return Path(machine_config.get("rsync_basepath", "")) / "/".join(
74+
Path(environment.default_destinations[source]).parent.parts[: i + 1]
75+
)
7476
return (
7577
Path(machine_config.get("rsync_basepath", ""))
7678
/ Path(environment.default_destinations[source]).parent
@@ -135,7 +137,6 @@ def post_transfer(
135137
atlas_pixel_size = atlas_original_pixel_size * 7.8
136138
logger.info(f"Atlas image pixel size determined to be {atlas_pixel_size}")
137139

138-
sample = None
139140
for p in partial_path.split("/"):
140141
if p.startswith("Sample"):
141142
sample = int(p.replace("Sample", ""))
@@ -167,7 +168,8 @@ def post_transfer(
167168
"tag": dcg_tag,
168169
"atlas": str(
169170
_atlas_destination(environment, source, transferred_file)
170-
/ environment.samples[source].atlas
171+
/ environment.samples[source].atlas.parent
172+
/ atlas_xml_path.with_suffix(".jpg").name
171173
),
172174
"sample": environment.samples[source].sample,
173175
"atlas_pixel_size": atlas_pixel_size,

0 commit comments

Comments
 (0)