raster: logging to track com
This commit is contained in:
@@ -383,6 +383,7 @@ class RasterService:
|
||||
)
|
||||
com = raster_centre_of_mass(result_array, scan_result.images)
|
||||
if com is None:
|
||||
self.logger.info("Calcualted COM is None using centre image")
|
||||
if request.n_x == 1:
|
||||
x = request.grid_size_mm.x / 2.0
|
||||
else:
|
||||
@@ -409,8 +410,27 @@ class RasterService:
|
||||
),
|
||||
)
|
||||
else:
|
||||
self.logger.info("Calcualted COM is not None, procedding")
|
||||
target_coor = com.get_com_mm(request)
|
||||
target_coor_offset = self.ctx.sample_geometry.smargon_nudge(target_coor)
|
||||
self.logger.info(
|
||||
"Calculated raster centre offset",
|
||||
extra=merge_log_context(
|
||||
sample_log_context(self.ctx.sample),
|
||||
raster_request_log_context(request),
|
||||
{
|
||||
"centre_offset_x_mm": target_coor_offset.x,
|
||||
"centre_offset_y_mm": target_coor_offset.y,
|
||||
"centre_offset_z_mm": target_coor_offset.z,
|
||||
"grid_half_width_x_mm": x,
|
||||
"grid_half_height_y_mm": y,
|
||||
"top_left_x_mm": getattr(request.smargon_top_left.sh_mm, "x", None),
|
||||
"top_left_y_mm": getattr(request.smargon_top_left.sh_mm, "y", None),
|
||||
"top_left_z_mm": getattr(request.smargon_top_left.sh_mm, "z", None),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
self.logger.info(f"moving Smargon to grid centre offset {target_coor_offset}")
|
||||
target_smargon = SmargonCoordinate(
|
||||
|
||||
Reference in New Issue
Block a user