Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/murfey/server/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,7 @@ def feedback_callback(header: dict, message: dict) -> None:
session_id=message["session_id"],
tag=message.get("tag"),
)
dcgid = murfey_dcg.id
else:
record = DataCollectionGroup(
sessionId=ispyb_session_id,
Expand All @@ -1999,9 +2000,14 @@ def feedback_callback(header: dict, message: dict) -> None:
atlas_id = murfey.server._transport_object.do_insert_atlas(
atlas_record
)["return_value"]
else:
atlas_id = None
murfey_dcg = db.DataCollectionGroup(
id=dcgid,
atlas_id=atlas_id,
atlas=message.get("atlas", ""),
atlas_pixel_size=message.get("atlas_pixel_size"),
sample=message.get("sample"),
session_id=message["session_id"],
tag=message.get("tag"),
)
Expand Down
35 changes: 31 additions & 4 deletions src/murfey/server/ispyb.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,34 @@ def do_insert_search_map(
search_map_parameters.pixel_size *= (
search_map_parameters.height / search_map_parameters.height_on_atlas
)
search_map_parameters.height = (
int(search_map_parameters.height / 7.8)
if search_map_parameters.height
else None
)
search_map_parameters.width = (
int(search_map_parameters.width / 7.8)
if search_map_parameters.width
else None
)
search_map_parameters.x_location = (
int(search_map_parameters.x_location / 7.8)
if search_map_parameters.x_location
else None
)
search_map_parameters.y_location = (
int(search_map_parameters.y_location / 7.8)
if search_map_parameters.y_location
else None
)
record = GridSquare(
atlasId=atlas_id,
gridSquareImage=search_map_parameters.image,
pixelLocationX=search_map_parameters.x_location,
pixelLocationY=search_map_parameters.y_location,
height=search_map_parameters.height_on_atlas,
width=search_map_parameters.width_on_atlas,
angle=0,
stageLocationX=search_map_parameters.x_stage_position,
stageLocationY=search_map_parameters.y_stage_position,
pixelSize=search_map_parameters.pixel_size,
Expand Down Expand Up @@ -452,13 +473,19 @@ def do_update_search_map(
if search_map_parameters.image:
grid_square.gridSquareImage = search_map_parameters.image
if search_map_parameters.x_location:
grid_square.pixelLocationX = search_map_parameters.x_location
grid_square.pixelLocationX = int(
search_map_parameters.x_location / 7.8
)
if search_map_parameters.y_location:
grid_square.pixelLocationY = search_map_parameters.y_location
grid_square.pixelLocationY = int(
search_map_parameters.y_location / 7.8
)
if search_map_parameters.height_on_atlas:
grid_square.height = search_map_parameters.height_on_atlas
grid_square.height = int(
search_map_parameters.height_on_atlas / 7.8
)
if search_map_parameters.width_on_atlas:
grid_square.width = search_map_parameters.width_on_atlas
grid_square.width = int(search_map_parameters.width_on_atlas / 7.8)
if search_map_parameters.x_stage_position:
grid_square.stageLocationX = search_map_parameters.x_stage_position
if search_map_parameters.y_stage_position:
Expand Down
14 changes: 12 additions & 2 deletions src/murfey/workflows/tomo/tomo_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,20 @@ def register_batch_position_in_database(
search_map.height / 2,
]
tilt_series.x_location = (
centre_batch_pixel[0] - batch_parameters.x_beamshift / search_map.pixel_size
(
centre_batch_pixel[0]
- batch_parameters.x_beamshift / search_map.pixel_size
)
* 512
/ search_map.width
)
tilt_series.y_location = (
centre_batch_pixel[1] - batch_parameters.y_beamshift / search_map.pixel_size
(
centre_batch_pixel[1]
- batch_parameters.y_beamshift / search_map.pixel_size
)
* 512
/ search_map.width
)
else:
logger.warning(
Expand Down
8 changes: 4 additions & 4 deletions tests/workflows/tomo/test_tomo_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def test_register_batch_position_update(murfey_db_session: Session):

# These two should have been updated, values are known as used identity matrices
bp_final_parameters = murfey_db_session.exec(select(TiltSeries)).one()
assert bp_final_parameters.x_location == 880
assert bp_final_parameters.y_location == 1780
assert bp_final_parameters.x_location == 880 * 512 / search_map.width
assert bp_final_parameters.y_location == 1780 * 512 / search_map.width


def test_register_batch_position_update_skip(murfey_db_session: Session):
Expand Down Expand Up @@ -361,5 +361,5 @@ def test_register_batch_position_new(murfey_db_session: Session):

# These two should have been updated, values are known as used identity matrices
bp_final_parameters = murfey_db_session.exec(select(TiltSeries)).one()
assert bp_final_parameters.x_location == 880
assert bp_final_parameters.y_location == 1780
assert bp_final_parameters.x_location == 880 * 512 / search_map.width
assert bp_final_parameters.y_location == 1780 * 512 / search_map.width