Skip to content

Commit 8f05d01

Browse files
committed
On reading EpuSession.dm post all the grid squares found
1 parent 4a8210a commit 8f05d01

File tree

1 file changed

+18
-33
lines changed

1 file changed

+18
-33
lines changed

src/murfey/client/contexts/spa_metadata.py

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,37 +117,22 @@ def post_transfer(
117117
"atlas_pixel_size": atlas_pixel_size,
118118
}
119119
capture_post(url, json=dcg_data)
120-
registered_grid_squares = (
121-
requests.get(
122-
f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/grid_squares"
123-
)
124-
.json()
125-
.get(str(source), [])
120+
gs_pix_positions = _get_grid_square_atlas_positions(
121+
_atlas_destination(environment, source, transferred_file)
122+
/ environment.samples[source].atlas
126123
)
127-
if registered_grid_squares:
128-
gs_pix_positions = _get_grid_square_atlas_positions(
129-
_atlas_destination(environment, source, transferred_file)
130-
/ environment.samples[source].atlas
131-
)
132-
for gs in registered_grid_squares:
133-
pos_data = gs_pix_positions.get(str(gs["name"]))
134-
if pos_data:
135-
capture_post(
136-
f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/grid_square/{gs['name']}",
137-
json={
138-
"tag": gs["tag"],
139-
"readout_area_x": gs["readout_area_x"],
140-
"readout_area_y": gs["readout_area_y"],
141-
"thumbnail_size_x": gs["thumbnail_size_x"],
142-
"thumbnail_size_y": gs["thumbnail_size_y"],
143-
"pixel_size": gs["pixel_size"],
144-
"image": gs["image"],
145-
"x_location": pos_data[0],
146-
"y_location": pos_data[1],
147-
"x_stage_position": pos_data[2],
148-
"y_stage_position": pos_data[3],
149-
"width": pos_data[4],
150-
"height": pos_data[5],
151-
"angle": pos_data[6],
152-
},
153-
)
124+
for gs, pos_data in gs_pix_positions.items():
125+
if pos_data:
126+
capture_post(
127+
f"{str(environment.url.geturl())}/sessions/{environment.murfey_session}/grid_square/{gs}",
128+
json={
129+
"tag": str(source),
130+
"x_location": pos_data[0],
131+
"y_location": pos_data[1],
132+
"x_stage_position": pos_data[2],
133+
"y_stage_position": pos_data[3],
134+
"width": pos_data[4],
135+
"height": pos_data[5],
136+
"angle": pos_data[6],
137+
},
138+
)

0 commit comments

Comments
 (0)