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

Commit

Permalink
Merge pull request #1120 from DiamondLightSource/1119_apply_panda_hotfix
Browse files Browse the repository at this point in the history
Panda hotfixes
  • Loading branch information
olliesilvester authored Feb 5, 2024
2 parents 024dc71 + f36ef3c commit 82a4ddf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions src/hyperion/device_setup_plans/setup_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

MM_TO_ENCODER_COUNTS = 200000
GENERAL_TIMEOUT = 60
DETECTOR_TRIGGER_WIDTH = 1e-8
DETECTOR_TRIGGER_WIDTH = 1e-4


class Enabled(Enum):
Expand Down Expand Up @@ -140,13 +140,15 @@ def setup_panda_for_flyscan(
panda.inenc[1].setp, initial_x * MM_TO_ENCODER_COUNTS, wait=True # type: ignore
)

yield from bps.abs_set(panda.clock[1].period, time_between_x_steps_ms) # type: ignore
LOGGER.info(f"Setting PandA clock to period {time_between_x_steps_ms}")

yield from bps.abs_set(panda.pulse[1].width, DETECTOR_TRIGGER_WIDTH)
yield from bps.abs_set(panda.clock[1].period, time_between_x_steps_ms, group="panda-config") # type: ignore

yield from bps.abs_set(panda.pulse[1].width, DETECTOR_TRIGGER_WIDTH, group="panda-config")

table = get_seq_table(parameters, time_between_x_steps_ms, exposure_time_s)

LOGGER.info(f"Setting Panda sequencer values: {str(table)}")
LOGGER.info(f"Setting PandA sequencer values: {str(table)}")

yield from bps.abs_set(panda.seq[1].table, table, group="panda-config")

Expand Down
10 changes: 5 additions & 5 deletions src/hyperion/experiment_plans/panda_flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def do_fgs():
30.0,
)


LOGGER.info("Wait for all moves with no assigned group")
yield from bps.wait()

Expand Down Expand Up @@ -187,7 +188,7 @@ def run_gridscan_and_move(
DEADTIME_S = 1e-6 # according to https://www.dectris.com/en/detectors/x-ray-detectors/eiger2/eiger2-for-synchrotrons/eiger2-x/

time_between_x_steps_ms = (
DEADTIME_S + parameters.hyperion_params.detector_params.exposure_time
(DEADTIME_S + parameters.hyperion_params.detector_params.exposure_time) *1e3
)

smargon_speed_limit_mm_per_s = yield from bps.rd(
Expand All @@ -204,6 +205,8 @@ def run_gridscan_and_move(
time_between_x_steps_ms {time_between_x_steps_ms} as\
{smargon_speed}. 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")

yield from bps.mv(
fgs_composite.panda_fast_grid_scan.time_between_x_steps_ms,
Expand Down Expand Up @@ -283,11 +286,8 @@ def panda_flyscan_xray_centre(
"""
composite.eiger.set_detector_parameters(parameters.hyperion_params.detector_params)

subscriptions = XrayCentreCallbackCollection.setup()
composite.zocalo.zocalo_environment = parameters.hyperion_params.zocalo_environment

@bpp.subs_decorator( # subscribe the RE to nexus, ispyb, and zocalo callbacks
list(subscriptions) # must be the outermost decorator to receive the metadata
)
@bpp.set_run_key_decorator(GRIDSCAN_OUTER_PLAN)
@bpp.run_decorator( # attach experiment metadata to the start document
md={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"required": [
"directory",
"prefix",
"run_number",
"use_roi_mode",
"det_dist_to_beam_converter_path"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,9 @@ def test_when_grid_scan_ran_then_eiger_disarmed_before_zocalo_end(
fake_fgs_composite: FlyScanXRayCentreComposite,
test_panda_fgs_params: PandAGridscanInternalParameters,
mock_subscriptions: XrayCentreCallbackCollection,
RE: RunEngine,
RE_with_subs: tuple[RunEngine, XrayCentreCallbackCollection],
):
RE, mock_subscriptions = RE_with_subs
# Put both mocks in a parent to easily capture order
mock_parent = MagicMock()
fake_fgs_composite.eiger.disarm_detector = mock_parent.disarm
Expand Down

0 comments on commit 82a4ddf

Please sign in to comment.