fix: make xraycenter line scan on box center and twice box height #210
@@ -20,7 +20,7 @@ from aarecommon.math.find_xtal import (
|
||||
raster_highest_score,
|
||||
)
|
||||
from aarecommon.math.raster_grid import grid_to_image_id
|
||||
from aarecommon.models.models import BeamlineStateEnum, MLBoxType
|
||||
from aarecommon.models.models import BeamlineStateEnum
|
||||
from aarecommon.models.raster_grid import (
|
||||
CompletedRasterGrid,
|
||||
CompletedRasterGridElem,
|
||||
@@ -246,28 +246,17 @@ class RasterService:
|
||||
target_point=prediction_result.target_point,
|
||||
focus=prediction_result.focus,
|
||||
)
|
||||
target_point = prediction_result.target_point
|
||||
|
||||
prediction_box = prediction_result.box
|
||||
|
||||
if y_padding_fraction_each_side is None:
|
||||
local_contact_config = self.ctx.deps.cfg.local_contact_config
|
||||
prediction_type = getattr(prediction_box, "type", None)
|
||||
if prediction_box is not None:
|
||||
box_y_height_px = abs(prediction_box.box.bottom_y - prediction_box.box.top_y)
|
||||
box_y_center_px = prediction_box.box.top_y + box_y_height_px / 2
|
||||
else:
|
||||
box_y_center_px = None
|
||||
|
||||
if prediction_type == MLBoxType.LOOP_FACE:
|
||||
y_padding_fraction_each_side = (
|
||||
local_contact_config.line_scan_loop_face_y_padding_fraction_each_side
|
||||
)
|
||||
elif prediction_type == MLBoxType.LOOP_ALL:
|
||||
y_padding_fraction_each_side = (
|
||||
local_contact_config.line_scan_loop_all_y_padding_fraction_each_side
|
||||
)
|
||||
else:
|
||||
y_padding_fraction_each_side = float(
|
||||
cfg_get("daq.auto_raster.line_scan_y_padding_fraction", 0.15)
|
||||
)
|
||||
|
||||
if target_point is not None:
|
||||
target_y_pxl = target_point[1]
|
||||
if box_y_center_px is not None:
|
||||
target_y_pxl = box_y_center_px
|
||||
y_delta_mm = abs(target_y_pxl - beam_y_pxl) * geom.pixel_in_mm
|
||||
|
||||
if y_retarget_threshold_mm is None:
|
||||
@@ -323,9 +312,9 @@ class RasterService:
|
||||
|
||||
if prediction_box is not None and prediction_box.box is not None and grid_size_mm.y > 0:
|
||||
box_height_pxl = abs(prediction_box.box.bottom_y - prediction_box.box.top_y)
|
||||
padded_height_mm = (
|
||||
box_height_pxl * geom.pixel_in_mm * (1.0 + 2.0 * y_padding_fraction_each_side)
|
||||
)
|
||||
padded_height_px = box_height_pxl * 2
|
||||
padded_height_mm = padded_height_px * geom.pixel_in_mm
|
||||
|
||||
n_y = max(1, ceil(padded_height_mm / grid_size_mm.y))
|
||||
self.logger.info(
|
||||
"Computed second auto-center raster y size from ML box height",
|
||||
|
||||
Reference in New Issue
Block a user