Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Correctly set run up distance
Browse files Browse the repository at this point in the history
  • Loading branch information
olliesilvester committed Feb 28, 2024
1 parent abb5814 commit 2758375
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def detect_grid_and_do_gridscan(
composite.oav.parameters,
experiment_params.exposure_time,
experiment_params.set_stub_offsets,
experiment_params.run_up_distance_mm,
)

@bpp.subs_decorator([oav_callback, grid_params_callback])
Expand Down
12 changes: 9 additions & 3 deletions src/hyperion/experiment_plans/panda_flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ def run_gridscan_and_move(

LOGGER.info("Setting up Panda for flyscan")

assert isinstance(parameters.experiment_params, PandAGridScanParams)

run_up_distance_mm = yield from bps.rd(
fgs_composite.panda_fast_grid_scan.run_up_distance
)

# Set the time between x steps pv
DEADTIME_S = 1e-6 # according to https://www.dectris.com/en/detectors/x-ray-detectors/eiger2/eiger2-for-synchrotrons/eiger2-x/

Expand All @@ -210,15 +216,15 @@ def run_gridscan_and_move(
{sample_velocity_mm_per_s}. The smargon's speed limit is {smargon_speed_limit_mm_per_s} mm/s."
)
else:
LOGGER.info(f"Smargon speed set to {smargon_speed_limit_mm_per_s} mm/s")
LOGGER.info(
f"Panda grid scan: Smargon speed set to {smargon_speed_limit_mm_per_s} mm/s and using a run-up distance of {run_up_distance_mm}"
)

yield from bps.mv(
fgs_composite.panda_fast_grid_scan.time_between_x_steps_ms,
time_between_x_steps_ms,
)

assert isinstance(parameters.experiment_params, PandAGridScanParams)

yield from setup_panda_for_flyscan(
fgs_composite.panda,
PANDA_SETUP_PATH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ def __init__(
oav_params: OAVConfigParams,
exposure_time: float,
set_stub_offsets: bool,
run_up_distance_mm: float,
*args,
) -> None:
super().__init__(*args)
self.exposure_time = exposure_time
self.set_stub_offsets = set_stub_offsets
self.oav_params = oav_params
self.run_up_distance_mm: float = run_up_distance_mm
self.start_positions: list = []
self.box_numbers: list = []

Expand Down Expand Up @@ -78,6 +80,7 @@ def get_grid_parameters(self) -> GridScanParams:

def get_panda_grid_parameters(self) -> PandAGridScanParams:
return PandAGridScanParams(
run_up_distance_mm=self.run_up_distance_mm,
x_start=self.start_positions[0][0],
y1_start=self.start_positions[0][1],
y2_start=self.start_positions[0][1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class GridScanWithEdgeDetectParams(AbstractExperimentParameterBase):
# Whether to set the stub offsets after centering
set_stub_offsets: bool = False

# Distance for the smargon to accelerate into the grid and decelerate out of the grid when using the panda
run_up_distance_mm: float = 0.15

use_panda: bool = False

def get_num_images(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ class PinCentreThenXrayCentreParams(AbstractExperimentParameterBase):
# plugin
use_ophyd_pin_tip_detect: bool = False

# Distance for the smargon to accelerate into the grid and decelerate out of the grid when using the panda
run_up_distance_mm: float = 0.15

# Use constant motion panda scans instead of fast grid scans
use_panda: bool = False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class WaitForRobotLoadThenCentreParams(AbstractExperimentParameterBase):
omega_start: float
snapshot_dir: str
requested_energy_kev: Optional[float] = None

# Distance for the smargon to accelerate into the grid and decelerate out of the grid when using the panda
run_up_distance_mm: float = 0.15

# Use constant motion panda scans instead of fast grid scans
use_panda: bool = False

# Whether to use the ophyd device for tip centring rather than the area detector
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/experiment_plans/test_grid_detection_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_given_when_grid_detect_then_upper_left_and_start_position_as_expected(
box_size_y_pixels = box_size_microns / composite.oav.parameters.micronsPerYPixel

oav_cb = OavSnapshotCallback()
grid_param_cb = GridDetectionCallback(composite.oav.parameters, 0.004, False)
grid_param_cb = GridDetectionCallback(composite.oav.parameters, 0.004, False, 0.15)
RE.subscribe(oav_cb)
RE.subscribe(grid_param_cb)
RE(
Expand Down Expand Up @@ -225,7 +225,7 @@ def test_when_grid_detection_plan_run_then_grid_detection_callback_gets_correct_
params = OAVParameters("loopCentring", test_config_files["oav_config_json"])
composite, _ = fake_devices
box_size_microns = 20
cb = GridDetectionCallback(composite.oav.parameters, 0.5, True)
cb = GridDetectionCallback(composite.oav.parameters, 0.5, True, 0.15)
RE.subscribe(cb)

RE(
Expand Down

0 comments on commit 2758375

Please sign in to comment.