Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for ophyd async 0.9.0a1 #704

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies = [
"ophyd == 1.9.0",
"ophyd-async >= 0.8a5",
"bluesky >= 1.13.0a4",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@main",
"dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@4349f34577671c0090a843ccfde8af5f1657bb7b",
]


Expand Down
6 changes: 3 additions & 3 deletions src/mx_bluesky/common/parameters/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def __hash__(self) -> int:

@field_validator("parameter_model_version")
@classmethod
def _validate_version(cls, version: Version):
def _validate_version(cls, version: SemanticVersion):
assert (
version >= Version(major=PARAMETER_VERSION.major)
version >= SemanticVersion(major=PARAMETER_VERSION.major)
), f"Parameter version too old! This version of hyperion uses {PARAMETER_VERSION}"
assert (
version <= Version(major=PARAMETER_VERSION.major + 1)
version <= SemanticVersion(major=PARAMETER_VERSION.major + 1)
), f"Parameter version too new! This version of hyperion uses {PARAMETER_VERSION}"
return version

Expand Down
2 changes: 1 addition & 1 deletion src/mx_bluesky/hyperion/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from bluesky.run_engine import RunEngine
from dodal.beamlines import i03
from dodal.devices.oav.oav_parameters import OAVConfig
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.device_setup_plans.read_hardware_for_setup import (
read_hardware_during_collection,
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@
AsyncStatus,
Device,
DeviceVector,
callback_on_mock_put,
set_mock_value,
)
from ophyd_async.epics.core import epics_signal_rw
from ophyd_async.epics.motor import Motor
from ophyd_async.fastcs.panda import DatasetTable, PandaHdf5DatasetType
from ophyd_async.testing import callback_on_mock_put, set_mock_value
from scanspec.core import Path as ScanPath
from scanspec.specs import Line

Expand Down
2 changes: 1 addition & 1 deletion tests/system_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from aiohttp import ClientResponse
from dodal.beamlines import i03
from dodal.devices.oav.oav_parameters import OAVConfig
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

# Map all the case-sensitive column names from their normalised versions
DATA_COLLECTION_COLUMN_MAP = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dodal.devices.aperturescatterguard import ApertureValue
from dodal.devices.smargon import Smargon
from ophyd.sim import NullStatus
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.device_setup_plans.read_hardware_for_setup import (
read_hardware_during_collection,
Expand Down
3 changes: 2 additions & 1 deletion tests/system_tests/hyperion/external_interaction/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
Position,
)
from ophyd.sim import NullStatus
from ophyd_async.core import AsyncStatus, callback_on_mock_put, set_mock_value
from ophyd_async.core import AsyncStatus
from ophyd_async.testing import callback_on_mock_put, set_mock_value
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from dodal.devices.synchrotron import SynchrotronMode
from ispyb.sqlalchemy import BLSample
from ophyd.sim import NullStatus
from ophyd_async.core import AsyncStatus, set_mock_value
from ophyd_async.core import AsyncStatus
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.exceptions import WarningException
from mx_bluesky.hyperion.experiment_plans.flyscan_xray_centre_plan import (
Expand Down
4 changes: 3 additions & 1 deletion tests/unit_tests/beamlines/i04/test_thawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
from ophyd_async.core import (
AsyncStatus,
DeviceCollector,
)
from ophyd_async.epics.motor import Motor
from ophyd_async.testing import (
callback_on_mock_put,
get_mock_put,
set_mock_value,
)
from ophyd_async.epics.motor import Motor

from mx_bluesky.beamlines.i04.thawing_plan import thaw, thaw_and_stream_to_redis

Expand Down
6 changes: 3 additions & 3 deletions tests/unit_tests/beamlines/i24/serial/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from dodal.devices.i24.focus_mirrors import FocusMirrorsMode, HFocusMode, VFocusMode
from dodal.devices.i24.pmac import PMAC
from dodal.devices.zebra import Zebra
from ophyd_async.core import callback_on_mock_put, get_mock_put, set_mock_value
from ophyd_async.epics.motor import Motor
from ophyd_async.testing import callback_on_mock_put, get_mock_put, set_mock_value

from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType
from mx_bluesky.beamlines.i24.serial.parameters import (
Expand Down Expand Up @@ -174,6 +174,6 @@ def pilatus_beam_center(RE) -> DetectorBeamCenter:
@pytest.fixture
def mirrors(RE) -> FocusMirrorsMode:
mirrors: FocusMirrorsMode = i24.focus_mirrors(fake_with_ophyd_sim=True)
set_mock_value(mirrors.horizontal, HFocusMode.focus10)
set_mock_value(mirrors.vertical, VFocusMode.focus10)
set_mock_value(mirrors.horizontal, HFocusMode.FOCUS_10)
set_mock_value(mirrors.vertical, VFocusMode.FOCUS_10)
return mirrors
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import bluesky.plan_stubs as bps
import pytest
from dodal.devices.zebra import DISCONNECT, SOFT_IN3
from ophyd_async.core import get_mock_put, set_mock_value
from ophyd_async.testing import get_mock_put, set_mock_value

from mx_bluesky.beamlines.i24.serial.extruder.i24ssx_Extruder_Collect_py3v2 import (
TTL_EIGER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dodal.devices.i24.dual_backlight import DualBacklight
from dodal.devices.i24.i24_detector_motion import DetectorMotion
from dodal.devices.i24.pmac import PMAC
from ophyd_async.core import get_mock_put
from ophyd_async.testing import get_mock_put

from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import Fiducials
from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_Chip_Manager_py3v1 import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dodal.devices.hutch_shutter import HutchShutter
from dodal.devices.i24.pmac import PMAC
from dodal.devices.zebra import Zebra
from ophyd_async.core import callback_on_mock_put, get_mock_put, set_mock_value
from ophyd_async.testing import callback_on_mock_put, get_mock_put, set_mock_value

from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
ChipType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from dodal.devices.i24.pmac import PMAC
from dodal.devices.oav.oav_detector import OAV
from ophyd_async.core import get_mock_put
from ophyd_async.testing import get_mock_put

from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_moveonclick import (
_calculate_zoom_calibrator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from bluesky.run_engine import RunEngine
from dodal.devices.i24.i24_detector_motion import DetectorMotion
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.beamlines.i24.serial.parameters.constants import SSXType
from mx_bluesky.beamlines.i24.serial.setup_beamline import Eiger, Pilatus
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/beamlines/i24/serial/test_dcid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dodal.devices.i24.beam_center import DetectorBeamCenter
from dodal.devices.i24.dcm import DCM
from dodal.devices.i24.focus_mirrors import FocusMirrorsMode
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.beamlines.i24.serial.dcid import (
DCID,
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/common/plan_stubs/test_do_fgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
ZOCALO_STAGE_GROUP,
)
from event_model.documents import Event, RunStart
from ophyd_async.core import DeviceCollector, set_mock_value
from ophyd_async.core import DeviceCollector
from ophyd_async.testing import set_mock_value

from mx_bluesky.common.parameters.constants import (
EnvironmentConstants,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MirrorVoltages,
)
from dodal.devices.undulator_dcm import UndulatorDCM
from ophyd_async.core import get_mock_put
from ophyd_async.testing import get_mock_put

from mx_bluesky.hyperion.device_setup_plans import dcm_pitch_roll_mirror_adjuster
from mx_bluesky.hyperion.device_setup_plans.dcm_pitch_roll_mirror_adjuster import (
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/hyperion/device_setup_plans/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from bluesky.utils import FailedStatus
from dodal.beamlines import i03
from ophyd.status import Status
from ophyd_async.core import get_mock_put
from ophyd_async.testing import get_mock_put

from mx_bluesky.hyperion.device_setup_plans.utils import (
start_preparing_data_collection_then_do_plan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from bluesky.utils import FailedStatus
from dodal.devices.xbpm_feedback import Pause
from ophyd.status import Status
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.device_setup_plans.xbpm_feedback import (
transmission_and_xbpm_feedback_for_collection_decorator,
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/hyperion/experiment_plans/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
from dodal.devices.zocalo import ZocaloResults, ZocaloTrigger
from event_model import Event
from ophyd.sim import NullStatus
from ophyd_async.core import AsyncStatus, set_mock_value
from ophyd_async.core import AsyncStatus
from ophyd_async.fastcs.panda import HDFPanda
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.experiment_plans.common.xrc_result import XRayCentreResult
from mx_bluesky.hyperion.experiment_plans.grid_detect_then_xray_centre_plan import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from numpy import isclose
from ophyd.sim import NullStatus
from ophyd.status import Status
from ophyd_async.core import set_mock_value
from ophyd_async.fastcs.panda import DatasetTable, PandaHdf5DatasetType
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.device_setup_plans.read_hardware_for_setup import (
read_hardware_during_collection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dodal.devices.aperturescatterguard import ApertureValue
from dodal.devices.backlight import BacklightPosition
from dodal.devices.oav.oav_parameters import OAVParameters
from ophyd_async.core import get_mock_put, set_mock_value
from ophyd_async.testing import get_mock_put, set_mock_value

from mx_bluesky.common.parameters.gridscan import GridScanWithEdgeDetect
from mx_bluesky.hyperion.experiment_plans.flyscan_xray_centre_plan import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from dodal.devices.oav.pin_image_recognition.utils import NONE_VALUE, SampleLocation
from dodal.devices.smargon import Smargon
from numpy._typing._array_like import NDArray
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.exceptions import WarningException
from mx_bluesky.hyperion.experiment_plans.oav_grid_detection_plan import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dodal.devices.oav.pin_image_recognition import PinTipDetection
from dodal.devices.synchrotron import SynchrotronMode
from ophyd.sim import NullStatus
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value
from pydantic import ValidationError

from mx_bluesky.common.parameters.robot_load import RobotLoadAndEnergyChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from bluesky.simulators import RunEngineSimulator, assert_message_and_return_remaining
from dodal.devices.oav.oav_parameters import OAVParameters
from dodal.devices.synchrotron import SynchrotronMode
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.experiment_plans.rotation_scan_plan import (
RotationScanComposite,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from bluesky.run_engine import RunEngine
from dodal.beamlines import i03
from ophyd.status import Status
from ophyd_async.core import AsyncStatus, set_mock_value
from ophyd_async.core import AsyncStatus
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.experiment_plans import optimise_attenuation_plan
from mx_bluesky.hyperion.experiment_plans.optimise_attenuation_plan import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dodal.devices.oav.pin_image_recognition.utils import SampleLocation
from dodal.devices.smargon import Smargon
from ophyd.sim import NullStatus
from ophyd_async.core import get_mock_put, set_mock_value
from ophyd_async.testing import get_mock_put, set_mock_value

from mx_bluesky.hyperion.device_setup_plans.smargon import (
move_smargon_warn_on_out_of_range,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dodal.devices.smargon import Smargon, StubPosition
from dodal.devices.webcam import Webcam
from ophyd.sim import NullStatus
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.common.parameters.robot_load import RobotLoadAndEnergyChange
from mx_bluesky.hyperion.experiment_plans.robot_load_and_change_energy import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from dodal.devices.xbpm_feedback import Pause
from dodal.devices.zebra import PC_GATE, SOFT_IN1, Zebra
from dodal.devices.zebra_controlled_shutter import ZebraShutterControl
from ophyd_async.core import get_mock_put
from ophyd_async.testing import get_mock_put

from mx_bluesky.common.parameters.constants import DocDescriptorNames
from mx_bluesky.hyperion.experiment_plans.oav_snapshot_plan import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dodal.devices.oav.oav_detector import OAV
from dodal.devices.robot import BartRobot
from dodal.devices.webcam import Webcam
from ophyd_async.core import set_mock_value
from ophyd_async.testing import set_mock_value

from mx_bluesky.hyperion.external_interaction.callbacks.robot_load.ispyb_callback import (
RobotLoadISPyBCallback,
Expand Down
Loading