@@ -61,23 +61,18 @@ def post_transfer(
6161 ]["#text" ]
6262 visit_index = windows_path .split ("\\ " ).index (environment .visit )
6363 partial_path = "/" .join (windows_path .split ("\\ " )[visit_index + 1 :])
64- visitless_path = Path (
65- str (transferred_file ).replace (f"/{ environment .visit } " , "" )
66- )
67- visit_index_of_transferred_file = transferred_file .parts .index (
68- environment .visit
69- )
64+
65+ source = _get_source (transferred_file , environment )
66+ if not source :
67+ logger .warning (
68+ f"Source could not be indentified for { str (transferred_file )} "
69+ )
70+ return
71+
72+ source_visit_dir = source .parent
73+
7074 atlas_xml_path = list (
71- (
72- Path (
73- "/" .join (
74- transferred_file .parts [
75- : visit_index_of_transferred_file + 1
76- ]
77- )
78- )
79- / partial_path
80- ).parent .glob ("Atlas_*.xml" )
75+ (source_visit_dir / partial_path ).parent .glob ("Atlas_*.xml" )
8176 )[0 ]
8277 with open (atlas_xml_path , "rb" ) as atlas_xml :
8378 atlas_xml_data = xmltodict .parse (atlas_xml )
@@ -88,10 +83,6 @@ def post_transfer(
8883 # need to calculate the pixel size of the downscaled image
8984 atlas_pixel_size = atlas_original_pixel_size * 7.8
9085
91- source = _get_source (
92- visitless_path .parent / "Images-Disc1" / visitless_path .name ,
93- environment ,
94- )
9586 sample = None
9687 for p in partial_path .split ("/" ):
9788 if p .startswith ("Sample" ):
@@ -126,8 +117,7 @@ def post_transfer(
126117 )
127118 if registered_grid_squares :
128119 gs_pix_positions = _get_grid_square_atlas_positions (
129- _atlas_destination (environment , source , transferred_file )
130- / environment .samples [source ].atlas
120+ source_visit_dir / partial_path
131121 )
132122 for gs in registered_grid_squares :
133123 pos_data = gs_pix_positions .get (str (gs ["name" ]))
0 commit comments