Skip to content

Commit

Permalink
Hotfixes from 9.5.2 (DiamondLightSource/hyperion#1515)
Browse files Browse the repository at this point in the history
* Hotfixes from beamline

* Tidy up and fix tests

* Fix linting

* Add unit test for panda stage/unstage

---------

Co-authored-by: Robert Tuck <robert.tuck@diamond.ac.uk>
  • Loading branch information
DominicOram and rtuck99 committed Aug 12, 2024
1 parent 520230b commit 760a7c1
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 64 deletions.
2 changes: 1 addition & 1 deletion src/hyperion/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def compose_start_args(context: BlueskyContext, plan_name: str, action: Actions)
parameters = experiment_internal_param_type(**json.loads(request.data))
except Exception as e:
raise ValueError(
"Supplied parameters don't match the plan for this endpoint"
f"Supplied parameters don't match the plan for this endpoint {request.data}"
) from e
return plan, parameters, plan_name, callback_type

Expand Down
2 changes: 2 additions & 0 deletions src/hyperion/device_setup_plans/setup_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def setup_panda_for_flyscan(
assert time_between_x_steps_ms * 1000 >= exposure_time_s
assert sample_velocity_mm_per_s * exposure_time_s < parameters.x_step_size

yield from bps.stage(panda, group="panda-config")

with resources.as_file(
resources.files(hyperion.resources.panda) / "panda-gridscan.yaml"
) as config_yaml_path:
Expand Down
1 change: 1 addition & 0 deletions src/hyperion/experiment_plans/flyscan_xray_centre_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def _panda_tidy(fgs_composite: FlyScanXRayCentreComposite):
yield from disarm_panda_for_gridscan(fgs_composite.panda, group)
yield from _generic_tidy(fgs_composite, group, False)
yield from bps.wait(group, timeout=10)
yield from bps.unstage(fgs_composite.panda)


def _zebra_triggering_setup(
Expand Down
5 changes: 3 additions & 2 deletions src/hyperion/experiment_plans/oav_snapshot_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from blueapi.core import MsgGenerator
from bluesky import plan_stubs as bps
from dodal.devices.aperturescatterguard import AperturePositions, ApertureScatterguard
from dodal.devices.aperturescatterguard import ApertureScatterguard
from dodal.devices.backlight import Backlight, BacklightPosition
from dodal.devices.oav.oav_detector import OAV
from dodal.devices.oav.oav_parameters import OAVParameters
Expand Down Expand Up @@ -39,9 +39,10 @@ def setup_oav_snapshot_plan(
yield from bps.abs_set(
composite.backlight, BacklightPosition.IN, group=OAV_SNAPSHOT_SETUP_GROUP
)
assert composite.aperture_scatterguard.aperture_positions is not None
yield from bps.abs_set(
composite.aperture_scatterguard,
AperturePositions.ROBOT_LOAD,
composite.aperture_scatterguard.aperture_positions.ROBOT_LOAD,
group=OAV_SNAPSHOT_SETUP_GROUP,
)

Expand Down
15 changes: 4 additions & 11 deletions src/hyperion/resources/panda/panda-gridscan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
pulse.4.delay_units: s
pulse.4.step_units: s
pulse.4.width_units: s
seq.1.prescale_units: s
seq.1.prescale_units: us
seq.2.prescale_units: s
sfp3_sync_in.pos1_units: ''
sfp3_sync_in.pos2_units: ''
Expand Down Expand Up @@ -211,13 +211,6 @@
counter.8.step: 0.0
counter.8.trig: ZERO
counter.8.trig_delay: 0
data.capture: false
data.capture_mode: FIRST_N
data.createdirectory: 0
data.flush_period: 1.0
data.hdf_directory: ''
data.hdf_file_name: ''
data.num_capture: 0
div.1.divisor: 0.0
div.1.enable: ZERO
div.1.enable_delay: 0
Expand Down Expand Up @@ -308,7 +301,7 @@
inenc.2.protocol: Quadrature
inenc.2.rst_on_z: '0'
inenc.2.setp: 0
inenc.2.val_capture: 'No'
inenc.2.val_capture: Min Max Mean
inenc.2.val_dataset: ''
inenc.2.val_offset: 0.0
inenc.2.val_scale: 5.0e-06
Expand All @@ -324,7 +317,7 @@
inenc.3.protocol: Quadrature
inenc.3.rst_on_z: '0'
inenc.3.setp: 0
inenc.3.val_capture: 'No'
inenc.3.val_capture: Min Max Mean
inenc.3.val_dataset: ''
inenc.3.val_offset: 0.0
inenc.3.val_scale: 5.0e-06
Expand Down Expand Up @@ -676,7 +669,7 @@
seq.1.posa: INENC1.VAL
seq.1.posb: ZERO
seq.1.posc: ZERO
seq.1.prescale: 0.0
seq.1.prescale: 1.0
seq.1.repeats: 0.0
seq.1.table:
outa1: [0, 1, 0, 0, 1, 0]
Expand Down
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from unittest.mock import MagicMock, patch

import bluesky.plan_stubs as bps
import numpy as np
import pytest
from bluesky.run_engine import RunEngine
from bluesky.simulators import RunEngineSimulator
Expand Down Expand Up @@ -53,6 +54,7 @@
from ophyd_async.core.async_status import AsyncStatus
from ophyd_async.epics.motion.motor import Motor
from ophyd_async.epics.signal import epics_signal_rw
from ophyd_async.panda._common_blocks import DatasetTable
from scanspec.core import Path as ScanPath
from scanspec.specs import Line

Expand Down Expand Up @@ -648,6 +650,11 @@ async def create_mock_signals(devices_and_signals: dict[Device, dict[str, Any]])
**{panda.pulse[i]: {"enable": str} for i in panda.pulse.keys()},
}
)

set_mock_value(
panda.data.datasets, DatasetTable(name=np.array(["name"]), hdf5_type=[])
)

return panda


Expand Down
Loading

0 comments on commit 760a7c1

Please sign in to comment.