mx-bluesky 1.4.4__py3-none-any.whl → 1.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +2 -2
  3. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +2 -2
  4. mx_bluesky/common/device_setup_plans/setup_panda.py +9 -0
  5. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +9 -1
  6. mx_bluesky/common/parameters/constants.py +16 -0
  7. mx_bluesky/common/utils/exceptions.py +2 -1
  8. mx_bluesky/definitions.py +4 -0
  9. mx_bluesky/hyperion/__main__.py +8 -43
  10. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +9 -8
  11. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +10 -0
  12. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +0 -15
  13. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +11 -8
  14. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +8 -0
  15. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +23 -16
  16. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +1 -5
  17. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +1 -8
  18. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +12 -1
  19. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +2 -0
  20. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +19 -2
  21. mx_bluesky/hyperion/external_interaction/config_server.py +13 -2
  22. mx_bluesky/hyperion/parameters/cli.py +1 -9
  23. mx_bluesky/hyperion/parameters/constants.py +6 -1
  24. mx_bluesky/hyperion/parameters/gridscan.py +4 -2
  25. mx_bluesky/hyperion/resources/panda/panda-gridscan.yaml +1006 -964
  26. mx_bluesky/hyperion/utils/validation.py +20 -17
  27. {mx_bluesky-1.4.4.dist-info → mx_bluesky-1.4.5.dist-info}/METADATA +3 -3
  28. {mx_bluesky-1.4.4.dist-info → mx_bluesky-1.4.5.dist-info}/RECORD +32 -32
  29. mx_bluesky/hyperion/external_interaction/callbacks/common/__init__.py +0 -0
  30. mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +0 -95
  31. {mx_bluesky-1.4.4.dist-info → mx_bluesky-1.4.5.dist-info}/LICENSE +0 -0
  32. {mx_bluesky-1.4.4.dist-info → mx_bluesky-1.4.5.dist-info}/WHEEL +0 -0
  33. {mx_bluesky-1.4.4.dist-info → mx_bluesky-1.4.5.dist-info}/entry_points.txt +0 -0
  34. {mx_bluesky-1.4.4.dist-info → mx_bluesky-1.4.5.dist-info}/top_level.txt +0 -0
@@ -54,7 +54,9 @@ def set_energy_plan(
54
54
  if energy_ev:
55
55
  yield from transmission_and_xbpm_feedback_for_collection_wrapper(
56
56
  _set_energy_plan(energy_ev / 1000, composite),
57
+ composite.undulator_dcm.undulator_ref(),
57
58
  composite.xbpm_feedback,
58
59
  composite.attenuator,
60
+ composite.dcm,
59
61
  DESIRED_TRANSMISSION_FRACTION,
60
62
  )
@@ -3,6 +3,7 @@ from collections.abc import Callable, Sequence
3
3
  from threading import Thread
4
4
  from time import sleep
5
5
 
6
+ from bluesky.callbacks import CallbackBase
6
7
  from bluesky.callbacks.zmq import Proxy, RemoteDispatcher
7
8
  from dodal.log import LOGGER as dodal_logger
8
9
  from dodal.log import set_up_all_logging_handlers
@@ -48,17 +49,33 @@ LIVENESS_POLL_SECONDS = 1
48
49
  ERROR_LOG_BUFFER_LINES = 5000
49
50
 
50
51
 
51
- def setup_callbacks():
52
- return [
52
+ def create_gridscan_callbacks() -> tuple[
53
+ GridscanNexusFileCallback, GridscanISPyBCallback
54
+ ]:
55
+ return (
53
56
  GridscanNexusFileCallback(param_type=HyperionSpecifiedThreeDGridScan),
54
57
  GridscanISPyBCallback(
55
58
  param_type=GridCommonWithHyperionDetectorParams,
56
59
  emit=ZocaloCallback(CONST.PLAN.DO_FGS, CONST.ZOCALO_ENV),
57
60
  ),
61
+ )
62
+
63
+
64
+ def create_rotation_callbacks() -> tuple[
65
+ RotationNexusFileCallback, RotationISPyBCallback
66
+ ]:
67
+ return (
58
68
  RotationNexusFileCallback(),
59
69
  RotationISPyBCallback(
60
70
  emit=ZocaloCallback(CONST.PLAN.ROTATION_MAIN, CONST.ZOCALO_ENV)
61
71
  ),
72
+ )
73
+
74
+
75
+ def setup_callbacks() -> list[CallbackBase]:
76
+ return [
77
+ *create_gridscan_callbacks(),
78
+ *create_rotation_callbacks(),
62
79
  LogUidTaggingCallback(),
63
80
  RobotLoadISPyBCallback(),
64
81
  SampleHandlingCallback(),
@@ -1,6 +1,7 @@
1
1
  from functools import cache
2
2
 
3
3
  from daq_config_server.client import ConfigServer
4
+ from pydantic import model_validator
4
5
 
5
6
  from mx_bluesky.common.external_interaction.config_server import FeatureFlags
6
7
  from mx_bluesky.common.utils.log import LOGGER
@@ -13,8 +14,10 @@ class HyperionFeatureFlags(FeatureFlags):
13
14
 
14
15
  Attributes:
15
16
  use_panda_for_gridscan: If True then the PandA is used for gridscans, otherwise the zebra is used
16
- compare_cpu_and_gpu_zocalo: If True then GPU result processing is enabled alongside CPU, if False then
17
- CPU only is used.
17
+ compare_cpu_and_gpu_zocalo: If True then GPU result processing is enabled
18
+ alongside CPU and the results are compared. The CPU result is still take.n
19
+ use_gpu_results: If True then GPU result processing is enabled
20
+ and the GPU result is taken.
18
21
  set_stub_offsets: If True then set the stub offsets after moving to the crystal (ignored for
19
22
  multi-centre)
20
23
  omega_flip: If True then invert the smargon omega motor rotation commands with respect to
@@ -28,5 +31,13 @@ class HyperionFeatureFlags(FeatureFlags):
28
31
 
29
32
  use_panda_for_gridscan: bool = CONST.I03.USE_PANDA_FOR_GRIDSCAN
30
33
  compare_cpu_and_gpu_zocalo: bool = CONST.I03.COMPARE_CPU_AND_GPU_ZOCALO
34
+ use_gpu_results: bool = CONST.I03.USE_GPU_RESULTS
31
35
  set_stub_offsets: bool = CONST.I03.SET_STUB_OFFSETS
32
36
  omega_flip: bool = CONST.I03.OMEGA_FLIP
37
+
38
+ @model_validator(mode="after")
39
+ def use_gpu_and_compare_cannot_both_be_true(self):
40
+ assert not (self.use_gpu_results and self.compare_cpu_and_gpu_zocalo), (
41
+ "Cannot both use GPU results and compare them to CPU"
42
+ )
43
+ return self
@@ -8,7 +8,6 @@ from mx_bluesky._version import version
8
8
  @dataclass
9
9
  class HyperionArgs:
10
10
  dev_mode: bool = False
11
- use_external_callbacks: bool = False
12
11
  verbose_event_logging: bool = False
13
12
  skip_startup_connection: bool = False
14
13
 
@@ -34,8 +33,7 @@ def parse_cli_args() -> HyperionArgs:
34
33
  """Parses all arguments relevant to hyperion. Returns an HyperionArgs dataclass with
35
34
  the fields: (verbose_event_logging: bool,
36
35
  dev_mode: bool,
37
- skip_startup_connection: bool,
38
- external_callbacks: bool)"""
36
+ skip_startup_connection: bool)"""
39
37
  parser = argparse.ArgumentParser()
40
38
  _add_callback_relevant_args(parser)
41
39
  parser.add_argument(
@@ -48,11 +46,6 @@ def parse_cli_args() -> HyperionArgs:
48
46
  action="store_true",
49
47
  help="Skip connecting to EPICS PVs on startup",
50
48
  )
51
- parser.add_argument(
52
- "--external-callbacks",
53
- action="store_true",
54
- help="Run the external hyperion-callbacks service and publish events over ZMQ",
55
- )
56
49
  parser.add_argument(
57
50
  "--version",
58
51
  help="Print hyperion version string",
@@ -64,5 +57,4 @@ def parse_cli_args() -> HyperionArgs:
64
57
  verbose_event_logging=args.verbose_event_logging or False,
65
58
  dev_mode=args.dev or False,
66
59
  skip_startup_connection=args.skip_startup_connection or False,
67
- use_external_callbacks=args.external_callbacks or False,
68
60
  )
@@ -4,6 +4,7 @@ from dodal.devices.detector import EIGER2_X_16M_SIZE
4
4
  from pydantic.dataclasses import dataclass
5
5
 
6
6
  from mx_bluesky.common.parameters.constants import (
7
+ DeviceSettingsConstants,
7
8
  DocDescriptorNames,
8
9
  EnvironmentConstants,
9
10
  ExperimentParamConstants,
@@ -31,9 +32,12 @@ class I03Constants:
31
32
  OMEGA_FLIP = True
32
33
 
33
34
  # Turns on GPU processing for zocalo and logs a comparison between GPU and CPU-
34
- # processed results. GPU results never used in analysis for now
35
+ # processed results.
35
36
  COMPARE_CPU_AND_GPU_ZOCALO = False
36
37
 
38
+ # Turns on GPU processing for zocalo and uses the results that come back
39
+ USE_GPU_RESULTS = False
40
+
37
41
 
38
42
  @dataclass(frozen=True)
39
43
  class HyperionConstants:
@@ -57,6 +61,7 @@ class HyperionConstants:
57
61
  GRAYLOG_PORT = 12232
58
62
  PARAMETER_SCHEMA_DIRECTORY = "src/hyperion/parameters/schemas/"
59
63
  LOG_FILE_NAME = "hyperion.log"
64
+ DEVICE_SETTINGS_CONSTANTS = DeviceSettingsConstants()
60
65
 
61
66
 
62
67
  CONST = HyperionConstants()
@@ -47,7 +47,8 @@ class GridCommonWithHyperionDetectorParams(GridCommon, WithHyperionUDCFeatures):
47
47
  use_roi_mode=self.use_roi_mode,
48
48
  det_dist_to_beam_converter_path=self.det_dist_to_beam_converter_path,
49
49
  trigger_mode=self.trigger_mode,
50
- enable_dev_shm=self.features.compare_cpu_and_gpu_zocalo,
50
+ enable_dev_shm=self.features.compare_cpu_and_gpu_zocalo
51
+ or self.features.use_gpu_results,
51
52
  **optional_args,
52
53
  )
53
54
 
@@ -83,7 +84,8 @@ class HyperionSpecifiedThreeDGridScan(SpecifiedThreeDGridScan, WithHyperionUDCFe
83
84
  use_roi_mode=self.use_roi_mode,
84
85
  det_dist_to_beam_converter_path=self.det_dist_to_beam_converter_path,
85
86
  trigger_mode=self.trigger_mode,
86
- enable_dev_shm=self.features.compare_cpu_and_gpu_zocalo,
87
+ enable_dev_shm=self.features.compare_cpu_and_gpu_zocalo
88
+ or self.features.use_gpu_results,
87
89
  **optional_args,
88
90
  )
89
91