dls-dodal 1.65.0__py3-none-any.whl → 1.67.0__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 (85) hide show
  1. {dls_dodal-1.65.0.dist-info → dls_dodal-1.67.0.dist-info}/METADATA +3 -4
  2. {dls_dodal-1.65.0.dist-info → dls_dodal-1.67.0.dist-info}/RECORD +82 -66
  3. dodal/_version.py +2 -2
  4. dodal/beamlines/aithre.py +21 -2
  5. dodal/beamlines/i03.py +102 -198
  6. dodal/beamlines/i04.py +40 -4
  7. dodal/beamlines/i05.py +28 -1
  8. dodal/beamlines/i06.py +62 -0
  9. dodal/beamlines/i07.py +20 -0
  10. dodal/beamlines/i09_1.py +32 -3
  11. dodal/beamlines/i09_2.py +57 -2
  12. dodal/beamlines/i10_optics.py +46 -17
  13. dodal/beamlines/i17.py +7 -3
  14. dodal/beamlines/i18.py +3 -3
  15. dodal/beamlines/i19_1.py +26 -14
  16. dodal/beamlines/i19_2.py +49 -38
  17. dodal/beamlines/i21.py +2 -2
  18. dodal/beamlines/i22.py +19 -4
  19. dodal/beamlines/p38.py +3 -3
  20. dodal/beamlines/training_rig.py +0 -16
  21. dodal/cli.py +26 -12
  22. dodal/common/coordination.py +3 -2
  23. dodal/device_manager.py +604 -0
  24. dodal/devices/aithre_lasershaping/goniometer.py +26 -9
  25. dodal/devices/aperturescatterguard.py +3 -2
  26. dodal/devices/areadetector/plugins/mjpg.py +10 -3
  27. dodal/devices/beamsize/__init__.py +0 -0
  28. dodal/devices/beamsize/beamsize.py +6 -0
  29. dodal/devices/cryostream.py +28 -57
  30. dodal/devices/detector/det_resolution.py +4 -2
  31. dodal/devices/eiger.py +26 -18
  32. dodal/devices/fast_grid_scan.py +14 -2
  33. dodal/devices/i03/beamsize.py +35 -0
  34. dodal/devices/i03/constants.py +7 -0
  35. dodal/devices/i03/undulator_dcm.py +2 -2
  36. dodal/devices/i04/beamsize.py +45 -0
  37. dodal/devices/i04/max_pixel.py +38 -0
  38. dodal/devices/i04/murko_results.py +36 -26
  39. dodal/devices/i04/transfocator.py +23 -29
  40. dodal/devices/i07/id.py +38 -0
  41. dodal/devices/i09_1_shared/__init__.py +13 -2
  42. dodal/devices/i09_1_shared/hard_energy.py +112 -0
  43. dodal/devices/i09_1_shared/hard_undulator_functions.py +85 -21
  44. dodal/devices/i09_2_shared/__init__.py +0 -0
  45. dodal/devices/i09_2_shared/i09_apple2.py +86 -0
  46. dodal/devices/i10/i10_apple2.py +39 -331
  47. dodal/devices/i17/i17_apple2.py +37 -22
  48. dodal/devices/i19/access_controlled/attenuator_motor_squad.py +61 -0
  49. dodal/devices/i19/access_controlled/blueapi_device.py +9 -1
  50. dodal/devices/i19/access_controlled/shutter.py +2 -4
  51. dodal/devices/insertion_device/__init__.py +0 -0
  52. dodal/devices/{apple2_undulator.py → insertion_device/apple2_undulator.py} +122 -69
  53. dodal/devices/insertion_device/energy_motor_lookup.py +88 -0
  54. dodal/devices/insertion_device/lookup_table_models.py +287 -0
  55. dodal/devices/ipin.py +20 -2
  56. dodal/devices/motors.py +33 -3
  57. dodal/devices/mx_phase1/beamstop.py +31 -12
  58. dodal/devices/oav/oav_calculations.py +9 -4
  59. dodal/devices/oav/oav_detector.py +65 -7
  60. dodal/devices/oav/oav_parameters.py +3 -1
  61. dodal/devices/oav/oav_to_redis_forwarder.py +18 -15
  62. dodal/devices/oav/pin_image_recognition/__init__.py +5 -1
  63. dodal/devices/oav/pin_image_recognition/utils.py +23 -1
  64. dodal/devices/oav/snapshots/snapshot_with_grid.py +8 -2
  65. dodal/devices/oav/utils.py +16 -6
  66. dodal/devices/robot.py +33 -18
  67. dodal/devices/scintillator.py +36 -14
  68. dodal/devices/smargon.py +2 -3
  69. dodal/devices/thawer.py +7 -45
  70. dodal/devices/undulator.py +152 -68
  71. dodal/plans/__init__.py +1 -1
  72. dodal/plans/configure_arm_trigger_and_disarm_detector.py +2 -4
  73. dodal/plans/load_panda_yaml.py +9 -0
  74. dodal/plans/verify_undulator_gap.py +2 -2
  75. dodal/testing/fixtures/devices/__init__.py +0 -0
  76. dodal/testing/fixtures/devices/apple2.py +78 -0
  77. dodal/utils.py +6 -3
  78. dodal/beamline_specific_utils/i03.py +0 -17
  79. dodal/testing/__init__.py +0 -3
  80. dodal/testing/setup.py +0 -67
  81. {dls_dodal-1.65.0.dist-info → dls_dodal-1.67.0.dist-info}/WHEEL +0 -0
  82. {dls_dodal-1.65.0.dist-info → dls_dodal-1.67.0.dist-info}/entry_points.txt +0 -0
  83. {dls_dodal-1.65.0.dist-info → dls_dodal-1.67.0.dist-info}/licenses/LICENSE +0 -0
  84. {dls_dodal-1.65.0.dist-info → dls_dodal-1.67.0.dist-info}/top_level.txt +0 -0
  85. /dodal/plans/{scanspec.py → spec_path.py} +0 -0
@@ -1,19 +1,12 @@
1
- from pathlib import Path
2
-
3
1
  from ophyd_async.epics.adaravis import AravisDetector
4
2
  from ophyd_async.fastcs.panda import HDFPanda
5
3
 
6
4
  from dodal.common.beamlines.beamline_utils import (
7
5
  device_factory,
8
6
  get_path_provider,
9
- set_path_provider,
10
7
  )
11
8
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
12
9
  from dodal.common.beamlines.device_helpers import DET_SUFFIX, HDF5_SUFFIX
13
- from dodal.common.visit import (
14
- LocalDirectoryServiceClient,
15
- StaticVisitPathProvider,
16
- )
17
10
  from dodal.devices.motors import XThetaStage
18
11
  from dodal.log import set_beamline as set_log_beamline
19
12
  from dodal.utils import BeamlinePrefix, get_beamline_name
@@ -35,15 +28,6 @@ set_log_beamline(BL)
35
28
  set_utils_beamline(BL)
36
29
 
37
30
 
38
- set_path_provider(
39
- StaticVisitPathProvider(
40
- BL,
41
- Path("/exports/mybeamline/data/2025"),
42
- client=LocalDirectoryServiceClient(),
43
- )
44
- )
45
-
46
-
47
31
  @device_factory()
48
32
  def sample_stage() -> XThetaStage:
49
33
  return XThetaStage(f"{PREFIX.beamline_prefix}-MO-MAP-01:STAGE:")
dodal/cli.py CHANGED
@@ -1,3 +1,4 @@
1
+ import importlib
1
2
  import os
2
3
  from collections.abc import Mapping
3
4
  from pathlib import Path
@@ -9,6 +10,7 @@ from ophyd_async.plan_stubs import ensure_connected
9
10
 
10
11
  from dodal.beamlines import all_beamline_names, module_name_for_beamline
11
12
  from dodal.common.beamlines.beamline_utils import set_path_provider
13
+ from dodal.device_manager import DeviceManager
12
14
  from dodal.utils import AnyDevice, filter_ophyd_devices, make_all_devices
13
15
 
14
16
  from . import __version__
@@ -43,7 +45,8 @@ def main(ctx: click.Context) -> None:
43
45
  "attempt any I/O. Useful as a a dry-run.",
44
46
  default=False,
45
47
  )
46
- def connect(beamline: str, all: bool, sim_backend: bool) -> None:
48
+ @click.option("-n", "--name", "device_manager", default="devices")
49
+ def connect(beamline: str, all: bool, sim_backend: bool, device_manager: str) -> None:
47
50
  """Initialises a beamline module, connects to all devices, reports
48
51
  any connection issues."""
49
52
 
@@ -51,7 +54,6 @@ def connect(beamline: str, all: bool, sim_backend: bool) -> None:
51
54
 
52
55
  # We need to make a fake path provider for any detectors that need one,
53
56
  # it is not used in dodal connect
54
- _spoof_path_provider()
55
57
 
56
58
  module_name = module_name_for_beamline(beamline)
57
59
  full_module_path = f"dodal.beamlines.{module_name}"
@@ -62,16 +64,28 @@ def connect(beamline: str, all: bool, sim_backend: bool) -> None:
62
64
 
63
65
  print(f"Attempting connection to {beamline} (using {full_module_path})")
64
66
 
65
- # Force all devices to be lazy (don't connect to PVs on instantiation) and do
66
- # connection as an extra step, because the alternatives is handling the fact
67
- # that only some devices may be lazy.
68
- devices, instance_exceptions = make_all_devices(
69
- full_module_path,
70
- include_skipped=all,
71
- fake_with_ophyd_sim=sim_backend,
72
- wait_for_connection=False,
73
- )
74
- devices, connect_exceptions = _connect_devices(run_engine, devices, sim_backend)
67
+ mod = importlib.import_module(full_module_path)
68
+
69
+ # Don't connect devices as they're built and do connection as an extra step,
70
+ # because the alternatives is handling the fact that only some devices may
71
+ # be lazy.
72
+
73
+ if (manager := getattr(mod, device_manager, None)) and isinstance(
74
+ manager, DeviceManager
75
+ ):
76
+ devices, instance_exceptions, connect_exceptions = manager.build_and_connect(
77
+ mock=sim_backend,
78
+ )
79
+ else:
80
+ print(f"No device manager named '{device_manager}' found in {mod}")
81
+ _spoof_path_provider()
82
+ devices, instance_exceptions = make_all_devices(
83
+ full_module_path,
84
+ include_skipped=all,
85
+ fake_with_ophyd_sim=sim_backend,
86
+ wait_for_connection=False,
87
+ )
88
+ devices, connect_exceptions = _connect_devices(run_engine, devices, sim_backend)
75
89
 
76
90
  # Inform user of successful connections
77
91
  _report_successful_devices(devices, sim_backend)
@@ -17,7 +17,7 @@ def group_uuid(name: str) -> Group:
17
17
  return f"{name}-{str(uuid.uuid4())[:6]}"
18
18
 
19
19
 
20
- def inject(name: str) -> Any: # type: ignore
20
+ def inject(name: str = "") -> Any: # type: ignore
21
21
  """
22
22
  Function to mark a defaulted argument of a plan as a reference to a device stored
23
23
  in another context and not available to be referenced directly.
@@ -30,7 +30,8 @@ def inject(name: str) -> Any: # type: ignore
30
30
  def scan(x: Movable = inject("stage_x"), start: float = 0.0 ...)
31
31
 
32
32
  Args:
33
- name (str): Name of a Device to be fetched from an external context
33
+ name (str): Name of a Device to be fetched from an external context. This can be
34
+ left blank when injecting device composites (the default)
34
35
 
35
36
  Returns:
36
37
  Any: name but without typing checking, valid as any default type