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

Hotfixes found in v9.1.0 testing #1319

Merged
merged 4 commits into from
Apr 19, 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 setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ install_requires =
xarray
doct
databroker
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@030381f03b6d7433945a7579dcfabef4c658fbfa
dls-dodal @ git+https://github.com/DiamondLightSource/dodal.git@3745ab3c5b9647e4ba3782b0b74ebe85faee0475
pydantic<2.0 # See https://github.com/DiamondLightSource/hyperion/issues/774
scipy
pyzmq<25 # See https://github.com/DiamondLightSource/hyperion/issues/1103
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from hyperion.device_setup_plans.setup_oav import calculate_x_y_z_of_pixel
from hyperion.log import LOGGER
from hyperion.parameters.constants import CONST


class GridDetectionCallback(CallbackBase):
Expand All @@ -15,7 +16,7 @@ def __init__(
oav_params: OAVConfigParams,
exposure_time: float,
set_stub_offsets: bool,
run_up_distance_mm: float = 0.15,
run_up_distance_mm: float = CONST.HARDWARE.PANDA_FGS_RUN_UP_DEFAULT,
*args,
) -> None:
super().__init__(*args)
Expand Down Expand Up @@ -63,7 +64,7 @@ def event(self, doc: Event):

def get_grid_parameters(self) -> GridScanParams:
return GridScanParams(
transmission_fraction=0.01,
transmission_fraction=1.0,
dwell_time_ms=self.exposure_time * 1000,
x_start=self.start_positions[0][0],
y1_start=self.start_positions[0][1],
Expand All @@ -81,7 +82,7 @@ def get_grid_parameters(self) -> GridScanParams:

def get_panda_grid_parameters(self) -> PandAGridScanParams:
return PandAGridScanParams(
transmission_fraction=0.01,
transmission_fraction=1.0,
run_up_distance_mm=self.run_up_distance_mm,
x_start=self.start_positions[0][0],
y1_start=self.start_positions[0][1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, TypeVar

from dodal.devices.synchrotron import SynchrotronMode

from hyperion.external_interaction.callbacks.common.ispyb_mapping import (
populate_data_collection_group,
)
Expand Down Expand Up @@ -96,9 +98,13 @@ def activity_gated_event(self, doc: Event) -> Event:
self._event_driven_data_collection_info.undulator_gap1 = doc["data"][
"undulator_current_gap"
]
self._event_driven_data_collection_info.synchrotron_mode = doc["data"][
"synchrotron-synchrotron_mode"
]
assert isinstance(
synchrotron_mode := doc["data"]["synchrotron-synchrotron_mode"],
SynchrotronMode,
)
self._event_driven_data_collection_info.synchrotron_mode = (
synchrotron_mode.value
)
self._event_driven_data_collection_info.slitgap_horizontal = doc["data"][
"s4_slit_gaps_xgap"
]
Expand Down
1 change: 1 addition & 0 deletions src/hyperion/parameters/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class PlanNameConstants:
@dataclass(frozen=True)
class HardwareConstants:
OAV_REFRESH_DELAY = 0.3
PANDA_FGS_RUN_UP_DEFAULT = 0.16


@dataclass(frozen=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pydantic import validator

from hyperion.external_interaction.ispyb.ispyb_dataclass import GridscanIspybParams
from hyperion.parameters.constants import CONST
from hyperion.parameters.internal_parameters import (
HyperionParameters,
InternalParameters,
Expand Down Expand Up @@ -36,7 +37,7 @@ class GridScanWithEdgeDetectParams(AbstractExperimentWithBeamParams):
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
run_up_distance_mm: float = CONST.HARDWARE.PANDA_FGS_RUN_UP_DEFAULT

use_panda: bool = False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pydantic import validator

from hyperion.external_interaction.ispyb.ispyb_dataclass import GridscanIspybParams
from hyperion.parameters.constants import CONST
from hyperion.parameters.internal_parameters import (
HyperionParameters,
InternalParameters,
Expand Down Expand Up @@ -41,7 +42,7 @@ class PinCentreThenXrayCentreParams(AbstractExperimentWithBeamParams):
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
run_up_distance_mm: float = CONST.HARDWARE.PANDA_FGS_RUN_UP_DEFAULT

# 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 @@ -11,6 +11,7 @@
GRIDSCAN_ISPYB_PARAM_DEFAULTS,
RobotLoadIspybParams,
)
from hyperion.parameters.constants import CONST
from hyperion.parameters.internal_parameters import (
HyperionParameters,
InternalParameters,
Expand Down Expand Up @@ -49,7 +50,7 @@ class RobotLoadThenCentreParams(AbstractExperimentWithBeamParams):
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
run_up_distance_mm: float = CONST.HARDWARE.PANDA_FGS_RUN_UP_DEFAULT

# Use constant motion panda scans instead of fast grid scans
use_panda: bool = False
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ def fake_fgs_composite(
done_status,
attenuator,
xbpm_feedback,
synchrotron,
aperture_scatterguard,
zocalo,
dcm,
Expand All @@ -555,7 +556,7 @@ def fake_fgs_composite(
s4_slit_gaps=i03.s4_slit_gaps(fake_with_ophyd_sim=True),
smargon=smargon,
undulator=i03.undulator(fake_with_ophyd_sim=True),
synchrotron=i03.synchrotron(fake_with_ophyd_sim=True),
synchrotron=synchrotron,
xbpm_feedback=xbpm_feedback,
zebra=i03.zebra(fake_with_ophyd_sim=True),
zocalo=zocalo,
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_tests/experiment_plans/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from bluesky.utils import Msg
from dodal.devices.fast_grid_scan import FastGridScan
from dodal.devices.oav.oav_detector import OAVConfigParams
from dodal.devices.synchrotron import SynchrotronMode
from dodal.devices.zocalo import ZocaloResults, ZocaloTrigger
from event_model import Event
from ophyd.sim import make_fake_device
Expand Down Expand Up @@ -43,7 +44,7 @@ def make_event_doc(data, descriptor="abc123") -> Event:

BASIC_PRE_SETUP_DOC = {
"undulator_current_gap": 0,
"synchrotron-synchrotron_mode": 0,
"synchrotron-synchrotron_mode": SynchrotronMode.USER,
"s4_slit_gaps_xgap": 0,
"s4_slit_gaps_ygap": 0,
"robot-barcode": "BARCODE",
Expand Down
18 changes: 2 additions & 16 deletions tests/unit_tests/external_interaction/callbacks/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from dodal.devices.synchrotron import SynchrotronMode
from dodal.devices.zocalo.zocalo_results import ZOCALO_READING_PLAN_NAME
from event_model.documents import Event, EventDescriptor, RunStart, RunStop

Expand Down Expand Up @@ -61,21 +62,6 @@ class TestData:
"uid": "2093c941-ded1-42c4-ab74-ea99980fbbfd",
"subplan_name": CONST.PLAN.ROTATION_MAIN,
}
test_rotation_event_document_pre_data_collection: Event = {
"descriptor": "bd45c2e5-2b85-4280-95d7-a9a15800a78b",
"time": 1666604299.828203,
"data": {
"s4_slit_gaps_xgap": 0.1234,
"s4_slit_gaps_ygap": 0.2345,
"synchrotron-synchrotron_mode": "test",
"undulator_current_gap": 1.234,
"robot-barcode": "BARCODE",
},
"timestamps": {"det1": 1666604299.8220396, "det2": 1666604299.8235943},
"seq_num": 1,
"uid": "2093c941-ded1-42c4-ab74-ea99980fbbfd",
"filled": {},
}
test_rotation_event_document_during_data_collection: Event = {
"descriptor": "bd45c2e5-2b85-4280-95d7-a9a15800a78b",
"time": 2666604299.928203,
Expand Down Expand Up @@ -143,7 +129,7 @@ class TestData:
"data": {
"s4_slit_gaps_xgap": 0.1234,
"s4_slit_gaps_ygap": 0.2345,
"synchrotron-synchrotron_mode": "test",
"synchrotron-synchrotron_mode": SynchrotronMode.USER,
"undulator_current_gap": 1.234,
"robot-barcode": "BARCODE",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ def test_activity_gated_event(
callback.activity_gated_descriptor(
TestData.test_descriptor_document_pre_data_collection
)
callback.activity_gated_event(
TestData.test_rotation_event_document_pre_data_collection
)
callback.activity_gated_event(TestData.test_event_document_pre_data_collection)
callback.activity_gated_descriptor(
TestData.test_descriptor_document_during_data_collection
)
Expand All @@ -126,7 +124,7 @@ def test_activity_gated_event(
"id": TEST_DATA_COLLECTION_IDS[0],
"slitgaphorizontal": 0.1234,
"slitgapvertical": 0.2345,
"synchrotronmode": "test",
"synchrotronmode": "User",
"undulatorgap1": 1.234,
"wavelength": 1.1164718451643736,
"transmission": 98,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_activity_gated_event_2d(mock_ispyb_conn):
"id": TEST_DATA_COLLECTION_IDS[0],
"slitgaphorizontal": 0.1234,
"slitgapvertical": 0.2345,
"synchrotronmode": "test",
"synchrotronmode": "User",
"undulatorgap1": 1.234,
"wavelength": 1.1164718451643736,
"transmission": 100,
Expand Down Expand Up @@ -262,7 +262,7 @@ def test_activity_gated_event_3d(mock_ispyb_conn):
"id": TEST_DATA_COLLECTION_IDS[0],
"slitgaphorizontal": 0.1234,
"slitgapvertical": 0.2345,
"synchrotronmode": "test",
"synchrotronmode": "User",
"undulatorgap1": 1.234,
"wavelength": 1.1164718451643736,
"transmission": 100,
Expand Down
Loading