dls-dodal 1.67.0__py3-none-any.whl → 1.69.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 (86) hide show
  1. {dls_dodal-1.67.0.dist-info → dls_dodal-1.69.0.dist-info}/METADATA +2 -32
  2. {dls_dodal-1.67.0.dist-info → dls_dodal-1.69.0.dist-info}/RECORD +79 -71
  3. dodal/_version.py +2 -2
  4. dodal/beamlines/adsim.py +30 -23
  5. dodal/beamlines/b07.py +1 -1
  6. dodal/beamlines/b07_1.py +1 -1
  7. dodal/beamlines/i02_1.py +14 -42
  8. dodal/beamlines/i02_2.py +5 -11
  9. dodal/beamlines/i03.py +4 -1
  10. dodal/beamlines/i03_supervisor.py +19 -0
  11. dodal/beamlines/i04.py +74 -179
  12. dodal/beamlines/i05.py +9 -1
  13. dodal/beamlines/i06.py +1 -1
  14. dodal/beamlines/i06_1.py +24 -0
  15. dodal/beamlines/i09.py +53 -9
  16. dodal/beamlines/i09_1.py +9 -1
  17. dodal/beamlines/i09_2.py +7 -6
  18. dodal/beamlines/i10_optics.py +1 -1
  19. dodal/beamlines/i16.py +34 -0
  20. dodal/beamlines/i17.py +1 -1
  21. dodal/beamlines/i20_1.py +14 -0
  22. dodal/beamlines/i21.py +71 -4
  23. dodal/beamlines/i23.py +19 -25
  24. dodal/beamlines/i24.py +55 -105
  25. dodal/beamlines/p60.py +12 -2
  26. dodal/common/__init__.py +2 -1
  27. dodal/common/maths.py +80 -0
  28. dodal/devices/eiger.py +44 -23
  29. dodal/devices/electron_analyser/__init__.py +0 -33
  30. dodal/devices/electron_analyser/base/__init__.py +58 -0
  31. dodal/devices/electron_analyser/base/base_controller.py +84 -0
  32. dodal/devices/electron_analyser/base/base_detector.py +214 -0
  33. dodal/devices/electron_analyser/{abstract → base}/base_driver_io.py +23 -42
  34. dodal/devices/electron_analyser/{enums.py → base/base_enums.py} +0 -5
  35. dodal/devices/electron_analyser/{abstract → base}/base_region.py +48 -11
  36. dodal/devices/electron_analyser/{util.py → base/base_util.py} +1 -1
  37. dodal/devices/electron_analyser/{energy_sources.py → base/energy_sources.py} +27 -26
  38. dodal/devices/electron_analyser/specs/__init__.py +4 -4
  39. dodal/devices/electron_analyser/specs/specs_detector.py +47 -0
  40. dodal/devices/electron_analyser/specs/{driver_io.py → specs_driver_io.py} +23 -26
  41. dodal/devices/electron_analyser/specs/{region.py → specs_region.py} +4 -3
  42. dodal/devices/electron_analyser/vgscienta/__init__.py +4 -4
  43. dodal/devices/electron_analyser/vgscienta/vgscienta_detector.py +53 -0
  44. dodal/devices/electron_analyser/vgscienta/{driver_io.py → vgscienta_driver_io.py} +25 -31
  45. dodal/devices/electron_analyser/vgscienta/{region.py → vgscienta_region.py} +6 -6
  46. dodal/devices/fast_shutter.py +108 -25
  47. dodal/devices/i04/beam_centre.py +84 -0
  48. dodal/devices/i04/max_pixel.py +4 -17
  49. dodal/devices/i04/murko_results.py +18 -3
  50. dodal/devices/i09_2_shared/i09_apple2.py +0 -72
  51. dodal/devices/i10/i10_apple2.py +7 -7
  52. dodal/devices/i17/i17_apple2.py +6 -6
  53. dodal/devices/i21/__init__.py +3 -1
  54. dodal/devices/i24/commissioning_jungfrau.py +9 -10
  55. dodal/devices/insertion_device/__init__.py +62 -0
  56. dodal/devices/insertion_device/apple2_controller.py +380 -0
  57. dodal/devices/insertion_device/apple2_undulator.py +152 -481
  58. dodal/devices/insertion_device/energy.py +88 -0
  59. dodal/devices/insertion_device/energy_motor_lookup.py +1 -1
  60. dodal/devices/insertion_device/enum.py +17 -0
  61. dodal/devices/insertion_device/lookup_table_models.py +66 -36
  62. dodal/devices/insertion_device/polarisation.py +36 -0
  63. dodal/devices/oav/oav_detector.py +66 -1
  64. dodal/devices/oav/utils.py +17 -0
  65. dodal/devices/robot.py +35 -18
  66. dodal/devices/selectable_source.py +38 -0
  67. dodal/devices/zebra/zebra.py +15 -0
  68. dodal/devices/zebra/zebra_constants_mapping.py +1 -0
  69. dodal/plans/configure_arm_trigger_and_disarm_detector.py +0 -1
  70. dodal/testing/__init__.py +0 -0
  71. dodal/testing/electron_analyser/device_factory.py +4 -4
  72. dodal/testing/fixtures/devices/apple2.py +1 -1
  73. dodal/testing/fixtures/run_engine.py +4 -0
  74. dodal/devices/electron_analyser/abstract/__init__.py +0 -25
  75. dodal/devices/electron_analyser/abstract/base_detector.py +0 -63
  76. dodal/devices/electron_analyser/abstract/types.py +0 -12
  77. dodal/devices/electron_analyser/detector.py +0 -143
  78. dodal/devices/electron_analyser/specs/detector.py +0 -34
  79. dodal/devices/electron_analyser/types.py +0 -57
  80. dodal/devices/electron_analyser/vgscienta/detector.py +0 -48
  81. {dls_dodal-1.67.0.dist-info → dls_dodal-1.69.0.dist-info}/WHEEL +0 -0
  82. {dls_dodal-1.67.0.dist-info → dls_dodal-1.69.0.dist-info}/entry_points.txt +0 -0
  83. {dls_dodal-1.67.0.dist-info → dls_dodal-1.69.0.dist-info}/licenses/LICENSE +0 -0
  84. {dls_dodal-1.67.0.dist-info → dls_dodal-1.69.0.dist-info}/top_level.txt +0 -0
  85. /dodal/devices/electron_analyser/specs/{enums.py → specs_enums.py} +0 -0
  86. /dodal/devices/electron_analyser/vgscienta/{enums.py → vgscienta_enums.py} +0 -0
dodal/beamlines/i09_2.py CHANGED
@@ -10,10 +10,10 @@ from dodal.devices.i09.enums import Grating
10
10
  from dodal.devices.i09_2_shared.i09_apple2 import (
11
11
  J09_GAP_POLY_DEG_COLUMNS,
12
12
  J09_PHASE_POLY_DEG_COLUMNS,
13
- J09Apple2Controller,
14
13
  )
15
- from dodal.devices.insertion_device.apple2_undulator import (
14
+ from dodal.devices.insertion_device import (
16
15
  Apple2,
16
+ Apple2EnforceLHMoveController,
17
17
  BeamEnergy,
18
18
  InsertionDeviceEnergy,
19
19
  InsertionDevicePolarisation,
@@ -70,18 +70,18 @@ def jid_phase() -> UndulatorPhaseAxes:
70
70
 
71
71
 
72
72
  @device_factory()
73
- def jid() -> Apple2:
73
+ def jid() -> Apple2[UndulatorPhaseAxes]:
74
74
  """I09 soft x-ray insertion device."""
75
- return Apple2(
75
+ return Apple2[UndulatorPhaseAxes](
76
76
  id_gap=jid_gap(),
77
77
  id_phase=jid_phase(),
78
78
  )
79
79
 
80
80
 
81
81
  @device_factory()
82
- def jid_controller() -> J09Apple2Controller:
82
+ def jid_controller() -> Apple2EnforceLHMoveController[UndulatorPhaseAxes]:
83
83
  """J09 insertion device controller."""
84
- return J09Apple2Controller(
84
+ return Apple2EnforceLHMoveController[UndulatorPhaseAxes](
85
85
  apple2=jid(),
86
86
  gap_energy_motor_lut=ConfigServerEnergyMotorLookup(
87
87
  lut_config=LookupTableColumnConfig(poly_deg=J09_GAP_POLY_DEG_COLUMNS),
@@ -93,6 +93,7 @@ def jid_controller() -> J09Apple2Controller:
93
93
  config_client=J09_CONF_CLIENT,
94
94
  path=Path(LOOK_UPTABLE_DIR, PHASE_LOOKUP_FILE_NAME),
95
95
  ),
96
+ units="keV",
96
97
  )
97
98
 
98
99
 
@@ -26,7 +26,7 @@ from dodal.devices.i10.i10_apple2 import (
26
26
 
27
27
  # Imports taken from i10 while we work out how to deal with split end stations
28
28
  from dodal.devices.i10.i10_setting_data import I10Grating
29
- from dodal.devices.insertion_device.apple2_undulator import (
29
+ from dodal.devices.insertion_device import (
30
30
  BeamEnergy,
31
31
  InsertionDeviceEnergy,
32
32
  InsertionDevicePolarisation,
dodal/beamlines/i16.py ADDED
@@ -0,0 +1,34 @@
1
+ from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
2
+ from dodal.device_manager import DeviceManager
3
+ from dodal.devices.temperture_controller import Lakeshore336, Lakeshore340
4
+ from dodal.devices.undulator import UndulatorInMm, UndulatorOrder
5
+ from dodal.log import set_beamline as set_log_beamline
6
+ from dodal.utils import BeamlinePrefix, get_beamline_name
7
+
8
+ BL = get_beamline_name("i16")
9
+ set_log_beamline(BL)
10
+ set_utils_beamline(BL)
11
+ PREFIX = BeamlinePrefix(BL)
12
+
13
+
14
+ devices = DeviceManager()
15
+
16
+
17
+ @devices.factory()
18
+ def id() -> UndulatorInMm:
19
+ return UndulatorInMm(prefix=f"{PREFIX.insertion_prefix}-MO-SERVC-01:")
20
+
21
+
22
+ @devices.factory()
23
+ def harmonic() -> UndulatorOrder:
24
+ return UndulatorOrder()
25
+
26
+
27
+ @devices.factory()
28
+ def lakeshore340() -> Lakeshore340:
29
+ return Lakeshore340(prefix=f"{PREFIX.beamline_prefix}-EA-LS340-01:")
30
+
31
+
32
+ @devices.factory()
33
+ def lakeshore336() -> Lakeshore336:
34
+ return Lakeshore336(prefix=f"{PREFIX.beamline_prefix}-EA-LS336-01:")
dodal/beamlines/i17.py CHANGED
@@ -8,7 +8,7 @@ from dodal.common.beamlines.beamline_utils import (
8
8
  )
9
9
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
10
10
  from dodal.devices.i17.i17_apple2 import I17Apple2Controller
11
- from dodal.devices.insertion_device.apple2_undulator import (
11
+ from dodal.devices.insertion_device import (
12
12
  Apple2,
13
13
  Apple2Controller,
14
14
  BeamEnergy,
dodal/beamlines/i20_1.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from pathlib import Path
2
2
 
3
3
  from ophyd_async.epics.motor import Motor
4
+ from ophyd_async.epics.pmac import PmacIO
4
5
  from ophyd_async.fastcs.panda import HDFPanda
5
6
 
6
7
  from dodal.common.beamlines.beamline_utils import (
@@ -58,6 +59,19 @@ def turbo_slit_x() -> Motor:
58
59
  return Motor(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:XFINE")
59
60
 
60
61
 
62
+ @device_factory()
63
+ def turbo_slit_pmac() -> PmacIO:
64
+ """
65
+ PMac controller using running fly scans with trajectory
66
+ """
67
+ motor = turbo_slit_x()
68
+ return PmacIO(
69
+ prefix=f"{PREFIX.beamline_prefix}-MO-STEP-06:",
70
+ raw_motors=[motor],
71
+ coord_nums=[3],
72
+ )
73
+
74
+
61
75
  @device_factory()
62
76
  def panda() -> HDFPanda:
63
77
  return HDFPanda(
dodal/beamlines/i21.py CHANGED
@@ -1,15 +1,32 @@
1
+ from pathlib import Path
2
+
3
+ from daq_config_server.client import ConfigServer
4
+
1
5
  from dodal.common.beamlines.beamline_utils import (
2
6
  device_factory,
3
7
  )
4
8
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
5
- from dodal.devices.i21 import Grating
6
- from dodal.devices.insertion_device.apple2_undulator import (
9
+ from dodal.devices.i21 import (
10
+ Grating,
11
+ )
12
+ from dodal.devices.insertion_device import (
7
13
  Apple2,
14
+ Apple2EnforceLHMoveController,
15
+ BeamEnergy,
16
+ InsertionDeviceEnergy,
17
+ InsertionDevicePolarisation,
8
18
  UndulatorGap,
9
19
  UndulatorPhaseAxes,
10
20
  )
21
+ from dodal.devices.insertion_device.energy_motor_lookup import (
22
+ ConfigServerEnergyMotorLookup,
23
+ )
24
+ from dodal.devices.insertion_device.lookup_table_models import LookupTableColumnConfig
11
25
  from dodal.devices.pgm import PlaneGratingMonochromator
12
26
  from dodal.devices.synchrotron import Synchrotron
27
+ from dodal.devices.temperture_controller import (
28
+ Lakeshore336,
29
+ )
13
30
  from dodal.log import set_beamline as set_log_beamline
14
31
  from dodal.utils import BeamlinePrefix, get_beamline_name
15
32
 
@@ -18,6 +35,14 @@ PREFIX = BeamlinePrefix(BL)
18
35
  set_log_beamline(BL)
19
36
  set_utils_beamline(BL)
20
37
 
38
+ I21_PHASE_POLY_DEG_COLUMNS = ["b"]
39
+ I21_GRATING_COLUMNS = "Grating"
40
+
41
+ I21_CONF_CLIENT = ConfigServer(url="https://daq-config.diamond.ac.uk")
42
+ LOOK_UPTABLE_DIR = "/dls_sw/i21/software/gda/workspace_git/gda-diamond.git/configurations/i21-config/lookupTables/"
43
+ GAP_LOOKUP_FILE_NAME = "IDEnergy2GapCalibrations.csv"
44
+ PHASE_LOOKUP_FILE_NAME = "IDEnergy2PhaseCalibrations.csv"
45
+
21
46
 
22
47
  @device_factory()
23
48
  def synchrotron() -> Synchrotron:
@@ -49,9 +74,51 @@ def id_phase() -> UndulatorPhaseAxes:
49
74
 
50
75
 
51
76
  @device_factory()
52
- def id() -> Apple2:
77
+ def id() -> Apple2[UndulatorPhaseAxes]:
53
78
  """I21 insertion device."""
54
- return Apple2(
79
+ return Apple2[UndulatorPhaseAxes](
55
80
  id_gap=id_gap(),
56
81
  id_phase=id_phase(),
57
82
  )
83
+
84
+
85
+ @device_factory()
86
+ def id_controller() -> Apple2EnforceLHMoveController[UndulatorPhaseAxes]:
87
+ """i21 insertion device controller."""
88
+ return Apple2EnforceLHMoveController[UndulatorPhaseAxes](
89
+ apple2=id(),
90
+ gap_energy_motor_lut=ConfigServerEnergyMotorLookup(
91
+ lut_config=LookupTableColumnConfig(grating=I21_GRATING_COLUMNS),
92
+ config_client=I21_CONF_CLIENT,
93
+ path=Path(LOOK_UPTABLE_DIR, GAP_LOOKUP_FILE_NAME),
94
+ ),
95
+ phase_energy_motor_lut=ConfigServerEnergyMotorLookup(
96
+ lut_config=LookupTableColumnConfig(
97
+ grating=I21_GRATING_COLUMNS, poly_deg=I21_PHASE_POLY_DEG_COLUMNS
98
+ ),
99
+ config_client=I21_CONF_CLIENT,
100
+ path=Path(LOOK_UPTABLE_DIR, GAP_LOOKUP_FILE_NAME),
101
+ ),
102
+ units="eV",
103
+ )
104
+
105
+
106
+ @device_factory()
107
+ def id_energy() -> InsertionDeviceEnergy:
108
+ return InsertionDeviceEnergy(id_controller=id_controller())
109
+
110
+
111
+ @device_factory()
112
+ def id_polarisation() -> InsertionDevicePolarisation:
113
+ return InsertionDevicePolarisation(id_controller=id_controller())
114
+
115
+
116
+ @device_factory()
117
+ def energy_jid() -> BeamEnergy:
118
+ """Beam energy."""
119
+ return BeamEnergy(id_energy=id_energy(), mono=pgm().energy)
120
+
121
+
122
+ @device_factory()
123
+ def sample_temperature_controller() -> Lakeshore336:
124
+ return Lakeshore336(prefix=f"{PREFIX.beamline_prefix}-EA-TCTRL-01:")
dodal/beamlines/i23.py CHANGED
@@ -1,16 +1,13 @@
1
+ from functools import cache
1
2
  from pathlib import Path
2
3
 
3
- from ophyd_async.core import InOut, StrictEnum
4
+ from ophyd_async.core import InOut, PathProvider, StrictEnum
4
5
  from ophyd_async.epics.adpilatus import PilatusDetector
5
6
 
6
- from dodal.common.beamlines.beamline_utils import (
7
- device_factory,
8
- get_path_provider,
9
- set_path_provider,
10
- )
11
7
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
12
8
  from dodal.common.beamlines.device_helpers import HDF5_SUFFIX
13
9
  from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider
10
+ from dodal.device_manager import DeviceManager
14
11
  from dodal.devices.motors import SixAxisGonio
15
12
  from dodal.devices.oav.pin_image_recognition import PinTipDetection
16
13
  from dodal.devices.positioner import Positioner1D
@@ -25,18 +22,22 @@ from dodal.log import set_beamline as set_log_beamline
25
22
  from dodal.utils import BeamlinePrefix, get_beamline_name, get_hostname
26
23
 
27
24
  BL = get_beamline_name("i23")
25
+ PREFIX = BeamlinePrefix(BL)
28
26
  set_log_beamline(BL)
29
27
  set_utils_beamline(BL)
30
28
 
31
- set_path_provider(
32
- StaticVisitPathProvider(
29
+ devices = DeviceManager()
30
+
31
+
32
+ @devices.fixture
33
+ @cache
34
+ def path_provider() -> PathProvider:
35
+ return StaticVisitPathProvider(
33
36
  BL,
34
37
  Path("/tmp"),
35
38
  client=LocalDirectoryServiceClient(),
36
39
  )
37
- )
38
40
 
39
- PREFIX = BeamlinePrefix(BL)
40
41
 
41
42
  I23_ZEBRA_MAPPING = ZebraMapping(
42
43
  outputs=ZebraTTLOutputs(TTL_DETECTOR=1, TTL_SHUTTER=4),
@@ -59,51 +60,44 @@ def _is_i23_machine():
59
60
  return hostname.startswith("i23-ws") or hostname.startswith("i23-control")
60
61
 
61
62
 
62
- @device_factory(skip=lambda: not _is_i23_machine())
63
+ @devices.factory(skip=lambda: not _is_i23_machine())
63
64
  def oav_pin_tip_detection() -> PinTipDetection:
64
- """Get the i23 OAV pin-tip detection device."""
65
-
66
65
  return PinTipDetection(
67
66
  f"{PREFIX.beamline_prefix}-DI-OAV-01:",
68
67
  "pin_tip_detection",
69
68
  )
70
69
 
71
70
 
72
- @device_factory()
71
+ @devices.factory()
73
72
  def shutter() -> ZebraShutter:
74
- """Get the i23 zebra controlled shutter."""
75
73
  return ZebraShutter(f"{PREFIX.beamline_prefix}-EA-SHTR-01:")
76
74
 
77
75
 
78
- @device_factory()
76
+ @devices.factory()
79
77
  def gonio() -> SixAxisGonio:
80
- """Get the i23 goniometer"""
81
78
  return SixAxisGonio(f"{PREFIX.beamline_prefix}-MO-GONIO-01:")
82
79
 
83
80
 
84
- @device_factory()
81
+ @devices.factory()
85
82
  def zebra() -> Zebra:
86
- """Get the i23 zebra"""
87
83
  return Zebra(
88
84
  prefix=f"{PREFIX.beamline_prefix}-EA-ZEBRA-01:ZEBRA:",
89
85
  mapping=I23_ZEBRA_MAPPING,
90
86
  )
91
87
 
92
88
 
93
- @device_factory()
94
- def pilatus() -> PilatusDetector:
95
- """Get the i23 pilatus"""
89
+ @devices.factory()
90
+ def pilatus(path_provider: PathProvider) -> PilatusDetector:
96
91
  return PilatusDetector(
97
92
  prefix=f"{PREFIX.beamline_prefix}-EA-PILAT-01:",
98
- path_provider=get_path_provider(),
93
+ path_provider=path_provider,
99
94
  drv_suffix="cam1:",
100
95
  fileio_suffix=HDF5_SUFFIX,
101
96
  )
102
97
 
103
98
 
104
- @device_factory()
99
+ @devices.factory()
105
100
  def detector_motion() -> Positioner1D[I23DetectorPositions]:
106
- """Get the i23 detector"""
107
101
  return Positioner1D[I23DetectorPositions](
108
102
  f"{PREFIX.beamline_prefix}-EA-DET-01:Z",
109
103
  datatype=I23DetectorPositions,
dodal/beamlines/i24.py CHANGED
@@ -1,12 +1,12 @@
1
- from pathlib import PurePath
1
+ from functools import cache
2
+ from pathlib import Path
2
3
 
3
- from ophyd_async.core import AutoIncrementingPathProvider, StaticFilenameProvider
4
+ from ophyd_async.core import AutoMaxIncrementingPathProvider, PathProvider
4
5
 
5
- from dodal.common.beamlines.beamline_utils import (
6
- BL,
7
- device_factory,
8
- )
6
+ from dodal.common.beamlines.beamline_utils import BL
9
7
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
8
+ from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider
9
+ from dodal.device_manager import DeviceManager
10
10
  from dodal.devices.attenuator.attenuator import EnumFilterAttenuator
11
11
  from dodal.devices.attenuator.filter_selections import (
12
12
  I24FilterOneSelections,
@@ -25,12 +25,14 @@ from dodal.devices.i24.vgonio import VerticalGoniometer
25
25
  from dodal.devices.motors import YZStage
26
26
  from dodal.devices.oav.oav_detector import OAVBeamCentreFile
27
27
  from dodal.devices.oav.oav_parameters import OAVConfigBeamCentre
28
+ from dodal.devices.synchrotron import Synchrotron
28
29
  from dodal.devices.zebra.zebra import Zebra
29
30
  from dodal.devices.zebra.zebra_constants_mapping import (
30
31
  ZebraMapping,
31
32
  ZebraSources,
32
33
  ZebraTTLOutputs,
33
34
  )
35
+ from dodal.devices.zebra.zebra_controlled_shutter import ZebraShutter
34
36
  from dodal.log import set_beamline as set_log_beamline
35
37
  from dodal.utils import BeamlinePrefix, get_beamline_name
36
38
 
@@ -45,111 +47,67 @@ set_log_beamline(BL)
45
47
  set_utils_beamline(BL)
46
48
 
47
49
  I24_ZEBRA_MAPPING = ZebraMapping(
48
- outputs=ZebraTTLOutputs(TTL_EIGER=1, TTL_PILATUS=2, TTL_FAST_SHUTTER=4),
50
+ outputs=ZebraTTLOutputs(TTL_EIGER=1, TTL_JUNGFRAU=2, TTL_FAST_SHUTTER=4),
49
51
  sources=ZebraSources(),
50
52
  )
51
53
 
52
54
  PREFIX = BeamlinePrefix(BL)
53
55
 
56
+ devices = DeviceManager()
57
+
58
+
59
+ @devices.fixture
60
+ @cache
61
+ def path_provider() -> PathProvider:
62
+ return StaticVisitPathProvider(
63
+ BL,
64
+ Path("/tmp"),
65
+ client=LocalDirectoryServiceClient(),
66
+ )
67
+
54
68
 
55
- @device_factory()
69
+ @devices.factory()
56
70
  def attenuator() -> EnumFilterAttenuator:
57
- """Get a read-only attenuator device for i24, instantiate it if it hasn't already
58
- been. If this is called when already instantiated in i24, it will return the
59
- existing object."""
60
71
  return EnumFilterAttenuator(
61
72
  f"{PREFIX.beamline_prefix}-OP-ATTN-01:",
62
73
  filter_selection=(I24FilterOneSelections, I24FilterTwoSelections),
63
74
  )
64
75
 
65
76
 
66
- @device_factory()
77
+ @devices.factory()
67
78
  def aperture() -> Aperture:
68
- """Get the i24 aperture device, instantiate it if it hasn't already been.
69
- If this is called when already instantiated in i24, it will return the existing object.
70
- """
71
- return Aperture(
72
- f"{PREFIX.beamline_prefix}-AL-APTR-01:",
73
- )
79
+ return Aperture(f"{PREFIX.beamline_prefix}-AL-APTR-01:")
74
80
 
75
81
 
76
- @device_factory()
82
+ @devices.factory()
77
83
  def beamstop() -> Beamstop:
78
- """Get the i24 beamstop device, instantiate it if it hasn't already been.
79
- If this is called when already instantiated in i24, it will return the existing object.
80
- """
81
- return Beamstop(
82
- f"{PREFIX.beamline_prefix}-MO-BS-01:",
83
- )
84
+ return Beamstop(f"{PREFIX.beamline_prefix}-MO-BS-01:")
84
85
 
85
86
 
86
- @device_factory()
87
+ @devices.factory()
87
88
  def backlight() -> DualBacklight:
88
- """Get the i24 backlight device, instantiate it if it hasn't already been.
89
- If this is called when already instantiated in i24, it will return the existing object.
90
- """
91
- return DualBacklight(
92
- prefix=PREFIX.beamline_prefix,
93
- )
89
+ return DualBacklight(prefix=PREFIX.beamline_prefix)
94
90
 
95
91
 
96
- @device_factory()
92
+ @devices.factory()
97
93
  def detector_motion() -> YZStage:
98
- """Get the i24 detector motion device, instantiate it if it hasn't already been.
99
- If this is called when already instantiated in i24, it will return the existing object.
100
- """
101
- return YZStage(
102
- prefix=f"{PREFIX.beamline_prefix}-EA-DET-01:",
103
- )
94
+ return YZStage(prefix=f"{PREFIX.beamline_prefix}-EA-DET-01:")
104
95
 
105
96
 
106
- @device_factory()
97
+ @devices.factory()
107
98
  def dcm() -> DCM:
108
- """Get the i24 DCM device, instantiate it if it hasn't already been.
109
- If this is called when already instantiated in i24, it will return the existing object.
110
- """
111
99
  return DCM(
112
100
  prefix=f"{PREFIX.beamline_prefix}-DI-DCM-01:",
113
101
  motion_prefix=f"{PREFIX.beamline_prefix}-MO-DCM-01:",
114
102
  )
115
103
 
116
104
 
117
- # TODO implement ophyd-async eiger see
118
- # https://github.com/DiamondLightSource/mx-bluesky/issues/62
119
- # @skip_device(lambda: BL == "s24")
120
- # def eiger(
121
- # wait_for_connection: bool = True,
122
- # fake_with_ophyd_sim: bool = False,
123
- # params: DetectorParams | None = None,
124
- # ) -> EigerDetector:
125
- # """Get the i24 Eiger device, instantiate it if it hasn't already been.
126
- # If this is called when already instantiated, it will return the existing object.
127
- # If called with params, will update those params to the Eiger object.
128
- # """
129
- #
130
- # def set_params(eiger: EigerDetector):
131
- # if params is not None:
132
- # eiger.set_detector_parameters(params)
133
- #
134
- # return device_instantiation(
135
- # device_factory=EigerDetector,
136
- # name="eiger",
137
- # prefix="-EA-EIGER-01:",
138
- # wait=wait_for_connection,
139
- # fake=fake_with_ophyd_sim,
140
- # post_create=set_params,
141
- # )
142
-
143
-
144
- @device_factory()
105
+ @devices.factory()
145
106
  def pmac() -> PMAC:
146
- """Get the i24 PMAC device, instantiate it if it hasn't already been.
147
- If this is called when already instantiated in i24, it will return the existing object.
148
- """
149
107
  return PMAC(PREFIX.beamline_prefix)
150
108
 
151
109
 
152
- @device_factory()
110
+ @devices.factory()
153
111
  def oav() -> OAVBeamCentreFile:
154
112
  return OAVBeamCentreFile(
155
113
  prefix=f"{PREFIX.beamline_prefix}-DI-OAV-01:",
@@ -157,62 +115,54 @@ def oav() -> OAVBeamCentreFile:
157
115
  )
158
116
 
159
117
 
160
- @device_factory()
118
+ @devices.factory()
161
119
  def vgonio() -> VerticalGoniometer:
162
- """Get the i24 vertical goniometer device, instantiate it if it hasn't already been.
163
- If this is called when already instantiated, it will return the existing object.
164
- """
165
120
  return VerticalGoniometer(f"{PREFIX.beamline_prefix}-MO-VGON-01:")
166
121
 
167
122
 
168
- @device_factory()
123
+ @devices.factory()
169
124
  def zebra() -> Zebra:
170
- """Get the i24 zebra device, instantiate it if it hasn't already been.
171
- If this is called when already instantiated in i24, it will return the existing object.
172
- """
173
125
  return Zebra(
174
126
  prefix=f"{PREFIX.beamline_prefix}-EA-ZEBRA-01:",
175
127
  mapping=I24_ZEBRA_MAPPING,
176
128
  )
177
129
 
178
130
 
179
- @device_factory()
131
+ @devices.factory()
180
132
  def shutter() -> HutchShutter:
181
- """Get the i24 hutch shutter device, instantiate it if it hasn't already been.
182
- If this is called when already instantiated, it will return the existing object.
183
- """
184
133
  return HutchShutter(f"{PREFIX.beamline_prefix}-PS-SHTR-01:")
185
134
 
186
135
 
187
- @device_factory()
136
+ @devices.factory()
188
137
  def focus_mirrors() -> FocusMirrorsMode:
189
- """Get the i24 focus mirror devise to find the beam size."""
190
138
  return FocusMirrorsMode(f"{PREFIX.beamline_prefix}-OP-MFM-01:")
191
139
 
192
140
 
193
- @device_factory()
141
+ @devices.factory()
194
142
  def eiger_beam_center() -> DetectorBeamCenter:
195
- """A device for setting/reading the beamcenter from the eiger on i24."""
196
- return DetectorBeamCenter(
197
- f"{PREFIX.beamline_prefix}-EA-EIGER-01:CAM:",
198
- "eiger_bc",
199
- )
143
+ return DetectorBeamCenter(f"{PREFIX.beamline_prefix}-EA-EIGER-01:CAM:", "eiger_bc")
200
144
 
201
145
 
202
- @device_factory()
146
+ @devices.factory()
203
147
  def commissioning_jungfrau(
204
- path_to_dir: str = "/tmp/jf", # Device factory doesn't allow for required args,
205
- filename: str = "jf_output", # but these should be manually entered when commissioning
148
+ path_provider: PathProvider,
206
149
  ) -> CommissioningJungfrau:
207
150
  """Get the commissionning Jungfrau 9M device, which uses a temporary filewriter
208
- device in place of Odin while the detector is in commissioning.
209
- Instantiates the device if it hasn't already been.
210
- If this is called when already instantiated, it will return the existing object."""
211
-
151
+ device in place of Odin while the detector is in commissioning."""
212
152
  return CommissioningJungfrau(
213
153
  f"{PREFIX.beamline_prefix}-EA-JFRAU-01:",
214
154
  f"{PREFIX.beamline_prefix}-JUNGFRAU-META:FD:",
215
- AutoIncrementingPathProvider(
216
- StaticFilenameProvider(filename), PurePath(path_to_dir)
217
- ),
155
+ AutoMaxIncrementingPathProvider(path_provider),
156
+ )
157
+
158
+
159
+ @devices.factory()
160
+ def synchrotron() -> Synchrotron:
161
+ return Synchrotron()
162
+
163
+
164
+ @devices.factory()
165
+ def sample_shutter() -> ZebraShutter:
166
+ return ZebraShutter(
167
+ f"{PREFIX.beamline_prefix}-EA-SHTR-01:",
218
168
  )
dodal/beamlines/p60.py CHANGED
@@ -2,7 +2,7 @@ from dodal.common.beamlines.beamline_utils import (
2
2
  device_factory,
3
3
  )
4
4
  from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline
5
- from dodal.devices.electron_analyser import DualEnergySource
5
+ from dodal.devices.electron_analyser.base import DualEnergySource
6
6
  from dodal.devices.electron_analyser.vgscienta import VGScientaDetector
7
7
  from dodal.devices.p60 import (
8
8
  LabXraySource,
@@ -11,6 +11,7 @@ from dodal.devices.p60 import (
11
11
  PassEnergy,
12
12
  PsuMode,
13
13
  )
14
+ from dodal.devices.selectable_source import SourceSelector
14
15
  from dodal.log import set_beamline as set_log_beamline
15
16
  from dodal.utils import BeamlinePrefix, get_beamline_name
16
17
 
@@ -20,6 +21,11 @@ set_log_beamline(BL)
20
21
  set_utils_beamline(BL)
21
22
 
22
23
 
24
+ @device_factory()
25
+ def source_selector() -> SourceSelector:
26
+ return SourceSelector()
27
+
28
+
23
29
  @device_factory()
24
30
  def al_kalpha_source() -> LabXraySourceReadable:
25
31
  return LabXraySourceReadable(LabXraySource.AL_KALPHA)
@@ -32,7 +38,11 @@ def mg_kalpha_source() -> LabXraySourceReadable:
32
38
 
33
39
  @device_factory()
34
40
  def energy_source() -> DualEnergySource:
35
- return DualEnergySource(al_kalpha_source().energy_ev, mg_kalpha_source().energy_ev)
41
+ return DualEnergySource(
42
+ al_kalpha_source().energy_ev,
43
+ mg_kalpha_source().energy_ev,
44
+ source_selector().selected_source,
45
+ )
36
46
 
37
47
 
38
48
  # Connect will work again after this work completed
dodal/common/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from .coordination import group_uuid, inject
2
2
  from .enums import EnabledDisabledUpper, InOutUpper, OnOffUpper
3
- from .maths import in_micros, step_to_num
3
+ from .maths import Rectangle2D, in_micros, step_to_num
4
4
  from .types import MsgGenerator, PlanGenerator
5
5
 
6
6
  __all__ = [
@@ -13,4 +13,5 @@ __all__ = [
13
13
  "MsgGenerator",
14
14
  "PlanGenerator",
15
15
  "step_to_num",
16
+ "Rectangle2D",
16
17
  ]