dls-dodal 1.69.0__py3-none-any.whl → 2.0.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.
- {dls_dodal-1.69.0.dist-info → dls_dodal-2.0.0.dist-info}/METADATA +1 -1
- dls_dodal-2.0.0.dist-info/RECORD +354 -0
- {dls_dodal-1.69.0.dist-info → dls_dodal-2.0.0.dist-info}/WHEEL +1 -1
- dodal/_version.py +2 -2
- dodal/beamlines/__init__.py +10 -17
- dodal/beamlines/adsim.py +17 -17
- dodal/beamlines/b01_1.py +11 -0
- dodal/beamlines/b07.py +17 -21
- dodal/beamlines/b07_1.py +20 -22
- dodal/beamlines/b07_shared.py +12 -0
- dodal/beamlines/b16.py +1 -1
- dodal/beamlines/b21.py +15 -6
- dodal/beamlines/i02_1.py +3 -3
- dodal/beamlines/i02_2.py +1 -1
- dodal/beamlines/i03.py +4 -4
- dodal/beamlines/i04.py +16 -8
- dodal/beamlines/i05.py +7 -45
- dodal/beamlines/i05_1.py +4 -13
- dodal/beamlines/i05_shared.py +51 -0
- dodal/beamlines/i06_1.py +7 -5
- dodal/beamlines/{i06.py → i06_shared.py} +25 -14
- dodal/beamlines/i07.py +14 -16
- dodal/beamlines/i09.py +54 -51
- dodal/beamlines/i09_1.py +25 -64
- dodal/beamlines/i09_1_shared.py +61 -0
- dodal/beamlines/i09_2.py +6 -100
- dodal/beamlines/i09_2_shared.py +110 -0
- dodal/beamlines/i10.py +60 -54
- dodal/beamlines/i10_1.py +99 -10
- dodal/beamlines/{i10_optics.py → i10_shared.py} +80 -66
- dodal/beamlines/i11.py +31 -18
- dodal/beamlines/i13_1.py +1 -1
- dodal/beamlines/i15.py +6 -6
- dodal/beamlines/i15_1.py +6 -6
- dodal/beamlines/i17.py +37 -28
- dodal/beamlines/i18.py +3 -4
- dodal/beamlines/i19_1.py +95 -34
- dodal/beamlines/i19_2.py +68 -52
- dodal/beamlines/i19_optics.py +26 -13
- dodal/beamlines/i20_1.py +6 -14
- dodal/beamlines/i21.py +35 -28
- dodal/beamlines/i22.py +19 -4
- dodal/beamlines/i23.py +1 -2
- dodal/beamlines/i24.py +11 -10
- dodal/beamlines/k07.py +99 -5
- dodal/beamlines/p38.py +3 -3
- dodal/beamlines/p60.py +28 -17
- dodal/beamlines/p99.py +16 -15
- dodal/beamlines/training_rig.py +20 -12
- dodal/cli.py +36 -2
- dodal/common/beamlines/beamline_parameters.py +2 -1
- dodal/common/beamlines/beamline_utils.py +11 -9
- dodal/common/beamlines/commissioning_mode.py +6 -3
- dodal/common/coordination.py +12 -14
- dodal/common/crystal_metadata.py +5 -8
- dodal/common/device_utils.py +4 -3
- dodal/common/maths.py +28 -40
- dodal/common/udc_directory_provider.py +13 -8
- dodal/common/visit.py +18 -21
- dodal/common/watcher_utils.py +13 -12
- dodal/device_manager.py +94 -54
- dodal/devices/aperturescatterguard.py +26 -27
- dodal/devices/areadetector/plugins/cam.py +1 -3
- dodal/devices/areadetector/plugins/mjpg.py +6 -5
- dodal/devices/attenuator/attenuator.py +12 -11
- dodal/devices/beamlines/b07/__init__.py +3 -0
- dodal/devices/{b07_1 → beamlines/b07_1}/__init__.py +2 -2
- dodal/devices/{b07_1 → beamlines/b07_1}/ccmc.py +5 -10
- dodal/devices/{b16 → beamlines/b16}/detector.py +2 -3
- dodal/devices/{i02_1 → beamlines/i02_1}/fast_grid_scan.py +2 -3
- dodal/devices/{i02_1 → beamlines/i02_1}/sample_motors.py +1 -1
- dodal/devices/{i03 → beamlines/i03}/beamsize.py +11 -7
- dodal/devices/{i03 → beamlines/i03}/dcm.py +1 -2
- dodal/devices/{i03 → beamlines/i03}/undulator_dcm.py +4 -5
- dodal/devices/beamlines/i04/beam_centre.py +151 -0
- dodal/devices/{i04 → beamlines/i04}/beamsize.py +11 -7
- dodal/devices/{i04 → beamlines/i04}/murko_results.py +5 -5
- dodal/devices/{i04 → beamlines/i04}/transfocator.py +10 -15
- dodal/devices/beamlines/i05/__init__.py +3 -0
- dodal/devices/beamlines/i06_shared/__init__.py +3 -0
- dodal/devices/beamlines/i06_shared/i06_enum.py +7 -0
- dodal/devices/{i07 → beamlines/i07}/dcm.py +2 -3
- dodal/devices/{i07 → beamlines/i07}/id.py +8 -9
- dodal/devices/beamlines/i09/__init__.py +3 -0
- dodal/devices/{i09_1_shared → beamlines/i09_1_shared}/hard_energy.py +5 -6
- dodal/devices/{i09_1_shared → beamlines/i09_1_shared}/hard_undulator_functions.py +19 -16
- dodal/devices/{i10 → beamlines/i10}/diagnostics.py +4 -3
- dodal/devices/{i10 → beamlines/i10}/i10_apple2.py +31 -45
- dodal/devices/{i10 → beamlines/i10}/rasor/rasor_current_amp.py +1 -24
- dodal/devices/{i10 → beamlines/i10}/rasor/rasor_motors.py +2 -2
- dodal/devices/{i10 → beamlines/i10}/slits.py +5 -3
- dodal/devices/beamlines/i10_1/__init__.py +9 -0
- dodal/devices/beamlines/i10_1/electromagnet/magnet.py +16 -0
- dodal/devices/beamlines/i10_1/electromagnet/stages.py +14 -0
- dodal/devices/beamlines/i10_1/scaler_cards.py +13 -0
- dodal/devices/{i11 → beamlines/i11}/cyberstar_blower.py +1 -1
- dodal/devices/{i11 → beamlines/i11}/diff_stages.py +4 -6
- dodal/devices/{i11 → beamlines/i11}/mythen.py +3 -4
- dodal/devices/{i11 → beamlines/i11}/nx100robot.py +6 -6
- dodal/devices/{i11 → beamlines/i11}/spinner.py +1 -1
- dodal/devices/{i13_1 → beamlines/i13_1}/merlin.py +1 -1
- dodal/devices/{i15 → beamlines/i15}/dcm.py +1 -2
- dodal/devices/{i15 → beamlines/i15}/focussing_mirror.py +5 -5
- dodal/devices/{i15 → beamlines/i15}/jack.py +2 -2
- dodal/devices/{i15 → beamlines/i15}/multilayer_mirror.py +1 -1
- dodal/devices/{i17 → beamlines/i17}/i17_apple2.py +10 -16
- dodal/devices/{i18 → beamlines/i18}/diode.py +1 -1
- dodal/devices/{i19 → beamlines/i19}/access_controlled/attenuator_motor_squad.py +12 -8
- dodal/devices/{i19 → beamlines/i19}/access_controlled/blueapi_device.py +16 -15
- dodal/devices/beamlines/i19/access_controlled/piezo_control.py +72 -0
- dodal/devices/{i19 → beamlines/i19}/access_controlled/shutter.py +11 -9
- dodal/devices/{i19 → beamlines/i19}/backlight.py +3 -1
- dodal/devices/{i19 → beamlines/i19}/mapt_configuration.py +2 -1
- dodal/devices/{i19 → beamlines/i19}/pin_col_stages.py +11 -8
- dodal/devices/beamlines/i19/pin_tip.py +32 -0
- dodal/devices/beamlines/i21/__init__.py +3 -0
- dodal/devices/{i22 → beamlines/i22}/dcm.py +1 -2
- dodal/devices/{i22 → beamlines/i22}/fswitch.py +1 -3
- dodal/devices/{i22 → beamlines/i22}/nxsas.py +5 -4
- dodal/devices/{i24 → beamlines/i24}/beam_center.py +1 -1
- dodal/devices/{i24 → beamlines/i24}/beamstop.py +2 -2
- dodal/devices/{i24 → beamlines/i24}/commissioning_jungfrau.py +3 -2
- dodal/devices/{i24 → beamlines/i24}/dcm.py +1 -3
- dodal/devices/{i24 → beamlines/i24}/dual_backlight.py +3 -3
- dodal/devices/{i24 → beamlines/i24}/pmac.py +9 -7
- dodal/devices/{p60 → beamlines/p60}/lab_xray_source.py +1 -1
- dodal/devices/beamlines/p99/__init__.py +0 -0
- dodal/devices/{p99 → beamlines/p99}/andor2_point.py +11 -15
- dodal/devices/bimorph_mirror.py +22 -20
- dodal/devices/collimation_table.py +3 -2
- dodal/devices/common_dcm.py +30 -20
- dodal/devices/controllers.py +2 -2
- dodal/devices/cryostream.py +8 -0
- dodal/devices/current_amplifiers/current_amplifier.py +16 -18
- dodal/devices/current_amplifiers/current_amplifier_detector.py +9 -10
- dodal/devices/current_amplifiers/femto.py +8 -9
- dodal/devices/current_amplifiers/sr570.py +16 -16
- dodal/devices/current_amplifiers/struck_scaler_counter.py +5 -5
- dodal/devices/detector/det_resolution.py +9 -8
- dodal/devices/detector/detector.py +4 -2
- dodal/devices/diamond_filter.py +3 -4
- dodal/devices/eiger.py +3 -3
- dodal/devices/eiger_odin.py +1 -1
- dodal/devices/electron_analyser/base/base_controller.py +13 -13
- dodal/devices/electron_analyser/base/base_detector.py +15 -20
- dodal/devices/electron_analyser/base/base_driver_io.py +39 -46
- dodal/devices/electron_analyser/base/base_region.py +27 -30
- dodal/devices/electron_analyser/base/base_util.py +18 -16
- dodal/devices/electron_analyser/base/energy_sources.py +13 -19
- dodal/devices/eurotherm.py +3 -2
- dodal/devices/fast_grid_scan.py +31 -34
- dodal/devices/fast_shutter.py +24 -21
- dodal/devices/flux.py +1 -1
- dodal/devices/focusing_mirror.py +29 -11
- dodal/devices/hutch_shutter.py +6 -6
- dodal/devices/insertion_device/__init__.py +8 -0
- dodal/devices/insertion_device/apple2_controller.py +51 -60
- dodal/devices/insertion_device/apple2_undulator.py +40 -64
- dodal/devices/insertion_device/apple_knot_controller.py +222 -0
- dodal/devices/insertion_device/energy.py +100 -27
- dodal/devices/insertion_device/energy_motor_lookup.py +20 -27
- dodal/devices/insertion_device/lookup_table_models.py +45 -50
- dodal/devices/insertion_device/polarisation.py +1 -1
- dodal/devices/ipin.py +1 -1
- dodal/devices/linkam3.py +7 -5
- dodal/devices/motors.py +107 -19
- dodal/devices/mx_phase1/beamstop.py +2 -4
- dodal/devices/oav/oav_calculations.py +20 -13
- dodal/devices/oav/oav_detector.py +28 -23
- dodal/devices/oav/oav_parameters.py +4 -9
- dodal/devices/oav/oav_to_redis_forwarder.py +22 -18
- dodal/devices/oav/pin_image_recognition/__init__.py +4 -6
- dodal/devices/oav/pin_image_recognition/manual_test.py +1 -2
- dodal/devices/oav/pin_image_recognition/utils.py +30 -32
- dodal/devices/oav/snapshots/grid_overlay.py +10 -9
- dodal/devices/oav/snapshots/snapshot_image_processing.py +15 -13
- dodal/devices/oav/utils.py +9 -12
- dodal/devices/p45.py +3 -9
- dodal/devices/pgm.py +8 -14
- dodal/devices/pressure_jump_cell.py +93 -32
- dodal/devices/qbpm.py +1 -3
- dodal/devices/robot.py +12 -4
- dodal/devices/s4_slit_gaps.py +1 -1
- dodal/devices/selectable_source.py +5 -2
- dodal/devices/slits.py +2 -5
- dodal/devices/smargon.py +2 -3
- dodal/devices/temperture_controller/lakeshore/lakeshore.py +38 -64
- dodal/devices/temperture_controller/lakeshore/lakeshore_io.py +21 -35
- dodal/devices/tetramm.py +7 -7
- dodal/devices/turbo_slit.py +8 -7
- dodal/devices/undulator.py +42 -56
- dodal/devices/util/adjuster_plans.py +2 -3
- dodal/devices/util/epics_util.py +10 -10
- dodal/devices/util/lookup_tables.py +17 -18
- dodal/devices/v2f.py +2 -3
- dodal/devices/watsonmarlow323_pump.py +1 -1
- dodal/devices/xbpm_feedback.py +3 -2
- dodal/devices/xspress3/xspress3.py +8 -11
- dodal/devices/xspress3/xspress3_channel.py +3 -6
- dodal/devices/zebra/zebra.py +6 -7
- dodal/devices/zebra/zebra_constants_mapping.py +11 -7
- dodal/devices/zebra/zebra_controlled_shutter.py +2 -1
- dodal/devices/zocalo/zocalo_interaction.py +14 -14
- dodal/devices/zocalo/zocalo_results.py +33 -33
- dodal/log.py +23 -20
- dodal/plan_stubs/check_topup.py +15 -15
- dodal/plan_stubs/data_session.py +6 -6
- dodal/plan_stubs/motor_utils.py +22 -18
- dodal/plan_stubs/pressure_jump_cell.py +18 -0
- dodal/plan_stubs/wrapped.py +40 -55
- dodal/plans/bimorph.py +63 -52
- dodal/plans/device_setup_plans/__init__.py +5 -0
- dodal/plans/device_setup_plans/setup_pin_tip_params.py +63 -0
- dodal/plans/preprocessors/verify_undulator_gap.py +10 -8
- dodal/plans/spec_path.py +3 -5
- dodal/plans/verify_undulator_gap.py +1 -2
- dodal/plans/wrapped.py +4 -3
- dodal/testing/electron_analyser/device_factory.py +5 -7
- dodal/testing/fixtures/devices/apple2.py +38 -0
- dodal/testing/fixtures/run_engine.py +3 -7
- dodal/testing/fixtures/utils.py +1 -2
- dodal/utils.py +60 -58
- dls_dodal-1.69.0.dist-info/RECORD +0 -338
- dodal/beamline_specific_utils/i05_shared.py +0 -14
- dodal/devices/b07/__init__.py +0 -3
- dodal/devices/i04/beam_centre.py +0 -84
- dodal/devices/i05/__init__.py +0 -3
- dodal/devices/i09/__init__.py +0 -3
- dodal/devices/i21/__init__.py +0 -5
- {dls_dodal-1.69.0.dist-info → dls_dodal-2.0.0.dist-info}/entry_points.txt +0 -0
- {dls_dodal-1.69.0.dist-info → dls_dodal-2.0.0.dist-info}/licenses/LICENSE +0 -0
- {dls_dodal-1.69.0.dist-info → dls_dodal-2.0.0.dist-info}/top_level.txt +0 -0
- /dodal/{beamline_specific_utils → devices/beamlines}/__init__.py +0 -0
- /dodal/devices/{b07 → beamlines/b07}/enums.py +0 -0
- /dodal/devices/{b07_1 → beamlines/b07_1}/enums.py +0 -0
- /dodal/devices/{b16 → beamlines/b16}/__init__.py +0 -0
- /dodal/devices/{i02_1 → beamlines/i02_1}/__init__.py +0 -0
- /dodal/devices/{i02_2 → beamlines/i02_2}/__init__.py +0 -0
- /dodal/devices/{i03 → beamlines/i03}/__init__.py +0 -0
- /dodal/devices/{i03 → beamlines/i03}/constants.py +0 -0
- /dodal/devices/{i04 → beamlines/i04}/__init__.py +0 -0
- /dodal/devices/{i04 → beamlines/i04}/constants.py +0 -0
- /dodal/devices/{i04 → beamlines/i04}/max_pixel.py +0 -0
- /dodal/devices/{i05 → beamlines/i05}/enums.py +0 -0
- /dodal/devices/{i07 → beamlines/i07}/__init__.py +0 -0
- /dodal/devices/{i09 → beamlines/i09}/enums.py +0 -0
- /dodal/devices/{i09_1 → beamlines/i09_1}/__init__.py +0 -0
- /dodal/devices/{i09_1 → beamlines/i09_1}/enums.py +0 -0
- /dodal/devices/{i09_1_shared → beamlines/i09_1_shared}/__init__.py +0 -0
- /dodal/devices/{i09_2_shared → beamlines/i09_2_shared}/__init__.py +0 -0
- /dodal/devices/{i09_2_shared → beamlines/i09_2_shared}/i09_apple2.py +0 -0
- /dodal/devices/{i10 → beamlines/i10}/__init__.py +0 -0
- /dodal/devices/{i10 → beamlines/i10}/i10_setting_data.py +0 -0
- /dodal/devices/{i10 → beamlines/i10}/mirrors.py +0 -0
- /dodal/devices/{i10 → beamlines/i10}/rasor/__init__.py +0 -0
- /dodal/devices/{i10 → beamlines/i10}/rasor/rasor_scaler_cards.py +0 -0
- /dodal/devices/{i11 → beamlines/i10_1/electromagnet}/__init__.py +0 -0
- /dodal/devices/{i13_1 → beamlines/i11}/__init__.py +0 -0
- /dodal/devices/{i15 → beamlines/i13_1}/__init__.py +0 -0
- /dodal/devices/{i13_1 → beamlines/i13_1}/merlin_controller.py +0 -0
- /dodal/devices/{i17 → beamlines/i15}/__init__.py +0 -0
- /dodal/devices/{i15 → beamlines/i15}/laue.py +0 -0
- /dodal/devices/{i15 → beamlines/i15}/motors.py +0 -0
- /dodal/devices/{i15 → beamlines/i15}/rail.py +0 -0
- /dodal/devices/{i18 → beamlines/i17}/__init__.py +0 -0
- /dodal/devices/{i19 → beamlines/i18}/__init__.py +0 -0
- /dodal/devices/{i18 → beamlines/i18}/kb_mirror.py +0 -0
- /dodal/devices/{i19/access_controlled → beamlines/i19}/__init__.py +0 -0
- /dodal/devices/{i20_1 → beamlines/i19/access_controlled}/__init__.py +0 -0
- /dodal/devices/{i19 → beamlines/i19}/access_controlled/hutch_access.py +0 -0
- /dodal/devices/{i19 → beamlines/i19}/beamstop.py +0 -0
- /dodal/devices/{i19 → beamlines/i19}/diffractometer.py +0 -0
- /dodal/devices/{i22 → beamlines/i20_1}/__init__.py +0 -0
- /dodal/devices/{i21 → beamlines/i21}/enums.py +0 -0
- /dodal/devices/{i24 → beamlines/i22}/__init__.py +0 -0
- /dodal/devices/{p99 → beamlines/i24}/__init__.py +0 -0
- /dodal/devices/{i24 → beamlines/i24}/aperture.py +0 -0
- /dodal/devices/{i24 → beamlines/i24}/focus_mirrors.py +0 -0
- /dodal/devices/{i24 → beamlines/i24}/vgonio.py +0 -0
- /dodal/devices/{p60 → beamlines/p60}/__init__.py +0 -0
- /dodal/devices/{p60 → beamlines/p60}/enums.py +0 -0
- /dodal/devices/{p99 → beamlines/p99}/sample_stage.py +0 -0
dodal/plans/bimorph.py
CHANGED
|
@@ -15,14 +15,14 @@ from dodal.devices.slits import Slits
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class SlitDimension(str, Enum):
|
|
18
|
-
"""Enum representing the dimensions of a 2d slit
|
|
18
|
+
"""Enum representing the dimensions of a 2d slit.
|
|
19
19
|
|
|
20
20
|
Used to describe which dimension the pencil beam scan should move across.
|
|
21
21
|
The other dimension will be held constant.
|
|
22
22
|
|
|
23
23
|
Attributes:
|
|
24
|
-
X: Represents X dimension
|
|
25
|
-
Y: Represents Y dimension
|
|
24
|
+
X: Represents X dimension.
|
|
25
|
+
Y: Represents Y dimension.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
X = "X"
|
|
@@ -33,10 +33,10 @@ def move_slits(slits: Slits, dimension: SlitDimension, gap: float, center: float
|
|
|
33
33
|
"""Moves ones dimension of Slits object to given position.
|
|
34
34
|
|
|
35
35
|
Args:
|
|
36
|
-
slits: Slits to move
|
|
37
|
-
dimension: SlitDimension (X or Y)
|
|
38
|
-
gap
|
|
39
|
-
center
|
|
36
|
+
slits (Slits): Slits to move.
|
|
37
|
+
dimension (SlitDimension): SlitDimension (X or Y).
|
|
38
|
+
gap (float): Size of gap.
|
|
39
|
+
center (float): Position of center.
|
|
40
40
|
"""
|
|
41
41
|
if dimension == SlitDimension.X:
|
|
42
42
|
yield from bps.mv(slits.x_gap, gap)
|
|
@@ -50,13 +50,14 @@ def check_valid_bimorph_state(
|
|
|
50
50
|
voltage_list: list[float], abs_range: float, abs_diff: float
|
|
51
51
|
) -> bool:
|
|
52
52
|
"""Checks that a set of bimorph voltages is valid.
|
|
53
|
+
|
|
53
54
|
Args:
|
|
54
|
-
voltage_list
|
|
55
|
-
abs_range
|
|
56
|
-
abs_diff
|
|
55
|
+
voltage_list (list[float]): Amount each actuator will be increased by per scan.
|
|
56
|
+
abs_range (float): Absolute value of maximum possible voltage of each actuator.
|
|
57
|
+
abs_diff (float): Absolute maximum difference between two consecutive actuators.
|
|
57
58
|
|
|
58
59
|
Returns:
|
|
59
|
-
Bool
|
|
60
|
+
Bool: Representing state validity.
|
|
60
61
|
"""
|
|
61
62
|
for voltage in voltage_list:
|
|
62
63
|
if abs(voltage) > abs_range:
|
|
@@ -78,13 +79,17 @@ def validate_bimorph_plan(
|
|
|
78
79
|
"""Checks that every position the bimorph will move through will not error.
|
|
79
80
|
|
|
80
81
|
Args:
|
|
81
|
-
initial_voltage_list
|
|
82
|
-
voltage_increment
|
|
83
|
-
abs_range
|
|
84
|
-
abs_diff
|
|
82
|
+
initial_voltage_list (list[float]): Starting position.
|
|
83
|
+
voltage_increment (float): Amount each actuator will be increased by per scan.
|
|
84
|
+
abs_range (float): Absolute value of maximum possible voltage of each actuator.
|
|
85
|
+
abs_diff (float): Absolute maximum difference between two consecutive actuators.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Bool: Representing state validity.
|
|
85
89
|
|
|
86
90
|
Raises:
|
|
87
|
-
Exception if the plan will lead to an error state
|
|
91
|
+
Exception if the plan will lead to an error state.
|
|
92
|
+
"""
|
|
88
93
|
voltage_list = initial_voltage_list.copy()
|
|
89
94
|
|
|
90
95
|
if not check_valid_bimorph_state(voltage_list, abs_range, abs_diff):
|
|
@@ -101,7 +106,7 @@ def validate_bimorph_plan(
|
|
|
101
106
|
|
|
102
107
|
@dataclass
|
|
103
108
|
class BimorphState:
|
|
104
|
-
"""Data class containing positions of BimorphMirror and Slits"""
|
|
109
|
+
"""Data class containing positions of BimorphMirror and Slits."""
|
|
105
110
|
|
|
106
111
|
voltages: list[float]
|
|
107
112
|
x_gap: float
|
|
@@ -114,11 +119,12 @@ def capture_bimorph_state(mirror: BimorphMirror, slits: Slits):
|
|
|
114
119
|
"""Plan stub that captures current position of BimorphMirror and Slits.
|
|
115
120
|
|
|
116
121
|
Args:
|
|
117
|
-
mirror: BimorphMirror to read from
|
|
118
|
-
slits: Slits to read from
|
|
122
|
+
mirror (BimorphMirror): BimorphMirror to read from.
|
|
123
|
+
slits (Slits): Slits to read from.
|
|
119
124
|
|
|
120
125
|
Returns:
|
|
121
|
-
A BimorphState containing BimorphMirror and Slits positions
|
|
126
|
+
A BimorphState containing BimorphMirror and Slits positions.
|
|
127
|
+
"""
|
|
122
128
|
original_voltage_list = []
|
|
123
129
|
|
|
124
130
|
for channel in mirror.channels.values():
|
|
@@ -142,9 +148,9 @@ def restore_bimorph_state(mirror: BimorphMirror, slits: Slits, state: BimorphSta
|
|
|
142
148
|
"""Moves BimorphMirror and Slits to state given in BirmophState.
|
|
143
149
|
|
|
144
150
|
Args:
|
|
145
|
-
mirror: BimorphMirror to move
|
|
146
|
-
slits: Slits to move
|
|
147
|
-
state: BimorphState to move to.
|
|
151
|
+
mirror (BimorphMirror): BimorphMirror to move.
|
|
152
|
+
slits (Slits): Slits to move.
|
|
153
|
+
state (BimorphState): BimorphState to move to.
|
|
148
154
|
"""
|
|
149
155
|
yield from move_slits(slits, SlitDimension.X, state.x_gap, state.x_center)
|
|
150
156
|
yield from move_slits(slits, SlitDimension.Y, state.y_gap, state.y_center)
|
|
@@ -158,11 +164,11 @@ def bimorph_position_generator(
|
|
|
158
164
|
"""Generator that produces bimorph positions, starting with the initial_voltage_list.
|
|
159
165
|
|
|
160
166
|
Args:
|
|
161
|
-
initial_voltage_list
|
|
162
|
-
voltage_increment
|
|
167
|
+
initial_voltage_list (list[float]): Starting position for bimorph.
|
|
168
|
+
voltage_increment (float): Amount to increase each actuator by in turn.
|
|
163
169
|
|
|
164
170
|
Yields:
|
|
165
|
-
List bimorph positions, starting with initial_voltage_list
|
|
171
|
+
List bimorph positions, starting with initial_voltage_list.
|
|
166
172
|
"""
|
|
167
173
|
voltage_list = initial_voltage_list.copy()
|
|
168
174
|
|
|
@@ -196,23 +202,25 @@ def bimorph_optimisation(
|
|
|
196
202
|
bimorph mirror, of using a 2-dimensional slit.
|
|
197
203
|
|
|
198
204
|
Args:
|
|
199
|
-
detectors
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
voltage_increment
|
|
203
|
-
active_dimension: SlitDimension that slit will move in (X or Y)
|
|
204
|
-
active_slit_center_start
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
205
|
+
detectors (list[Readable]): Detectors.
|
|
206
|
+
mirror (BimorphMirror): BimorphMirror to move.
|
|
207
|
+
slits (Slits): Slits.
|
|
208
|
+
voltage_increment (float): Voltage increment applied to each bimorph electrode.
|
|
209
|
+
active_dimension (SlitDimension): SlitDimension that slit will move in (X or Y).
|
|
210
|
+
active_slit_center_start (float): Start position of center of slit in active
|
|
211
|
+
dimension.
|
|
212
|
+
active_slit_center_end (float): Final position of center of slit in active
|
|
213
|
+
dimension.
|
|
214
|
+
active_slit_size (float): Size of slit in active dimension.
|
|
215
|
+
inactive_slit_center (float): Center of slit in inactive dimension.
|
|
216
|
+
inactive_slit_size (float): Size of slit in inactive dimension.
|
|
217
|
+
number_of_slit_positions (int): Number of slit positions per pencil beam scan.
|
|
218
|
+
bimorph_settle_time (float): Time in seconds to wait after bimorph move.
|
|
219
|
+
slit_settle_time (float): Time in seconds to wait after slit move.
|
|
220
|
+
initial_voltage_list (list[float], optional): Starting voltages for bimorph
|
|
221
|
+
(defaults to current voltages).
|
|
222
|
+
metadata (dict[string, Any], optional): Metadata to add to start document.
|
|
214
223
|
"""
|
|
215
|
-
|
|
216
224
|
_metadata = {
|
|
217
225
|
"plan_args": {
|
|
218
226
|
"detectors": {det.name for det in detectors},
|
|
@@ -314,16 +322,19 @@ def inner_scan(
|
|
|
314
322
|
"""Inner plan stub, which moves Slits and performs a read.
|
|
315
323
|
|
|
316
324
|
Args:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
detectors (list[Readable]): Detectors to collect from.
|
|
326
|
+
mirror (BimorphMirror): BimorphMirror to move.
|
|
327
|
+
slits (Slits): Slits.
|
|
328
|
+
oav: oav on-axis viewer.
|
|
329
|
+
active_dimension (SlitDimension): SlitDimension that slit will move in (X or Y).
|
|
330
|
+
active_slit_center_start (float): Start position of center of slit in active
|
|
331
|
+
dimension.
|
|
332
|
+
active_slit_center_end (float): Final position of center of slit in active
|
|
333
|
+
dimension.
|
|
334
|
+
active_slit_size (float): Size of slit in active dimension.
|
|
335
|
+
number_of_slit_positions (int): Number of slit positions per pencil beam scan.
|
|
336
|
+
slit_settle_time (float): Time in seconds to wait after slit move.
|
|
337
|
+
stream_name (str): Name to pass to trigger_and_read.
|
|
327
338
|
"""
|
|
328
339
|
for value in linspace(
|
|
329
340
|
active_slit_center_start, active_slit_center_end, number_of_slit_positions
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from functools import partial
|
|
2
|
+
|
|
3
|
+
import bluesky.plan_stubs as bps
|
|
4
|
+
|
|
5
|
+
from dodal.devices.oav.oav_parameters import OAVParameters
|
|
6
|
+
from dodal.devices.oav.pin_image_recognition import PinTipDetection
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def setup_pin_tip_detection_params(
|
|
10
|
+
pin_tip_detect_device: PinTipDetection,
|
|
11
|
+
parameters: OAVParameters,
|
|
12
|
+
group: str = "pin_tip_parameters",
|
|
13
|
+
wait: bool = True,
|
|
14
|
+
):
|
|
15
|
+
set_using_group = partial(bps.abs_set, group=group)
|
|
16
|
+
# select which blur to apply to image
|
|
17
|
+
yield from set_using_group(
|
|
18
|
+
pin_tip_detect_device.preprocess_operation, parameters.preprocess
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# sets length scale for blurring
|
|
22
|
+
yield from set_using_group(
|
|
23
|
+
pin_tip_detect_device.preprocess_ksize, parameters.preprocess_K_size
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# sets iteration for blur
|
|
27
|
+
yield from set_using_group(
|
|
28
|
+
pin_tip_detect_device.preprocess_iterations, parameters.preprocess_iter
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# Canny edge detect - lower
|
|
32
|
+
yield from set_using_group(
|
|
33
|
+
pin_tip_detect_device.canny_lower_threshold,
|
|
34
|
+
parameters.canny_edge_lower_threshold,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Canny edge detect - upper
|
|
38
|
+
yield from set_using_group(
|
|
39
|
+
pin_tip_detect_device.canny_upper_threshold,
|
|
40
|
+
parameters.canny_edge_upper_threshold,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# "Open" morphological operation
|
|
44
|
+
yield from set_using_group(pin_tip_detect_device.open_ksize, parameters.open_ksize)
|
|
45
|
+
|
|
46
|
+
# "Close" morphological operation
|
|
47
|
+
yield from set_using_group(
|
|
48
|
+
pin_tip_detect_device.close_ksize, parameters.close_ksize
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Sample detection direction
|
|
52
|
+
yield from set_using_group(
|
|
53
|
+
pin_tip_detect_device.scan_direction, parameters.direction
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Minimum height
|
|
57
|
+
yield from set_using_group(
|
|
58
|
+
pin_tip_detect_device.min_tip_height,
|
|
59
|
+
parameters.minimum_height,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if wait:
|
|
63
|
+
yield from bps.wait(group=group)
|
|
@@ -9,18 +9,20 @@ def verify_undulator_gap_before_run_wrapper(
|
|
|
9
9
|
devices: CheckUndulatorDevices,
|
|
10
10
|
run_key_to_wrap: str | None = None,
|
|
11
11
|
):
|
|
12
|
-
"""
|
|
13
|
-
|
|
12
|
+
"""Modifies the wrapped plan so that it checks the undulator gap before
|
|
13
|
+
specified run is opened and sets it to the correct value if needed.
|
|
14
14
|
|
|
15
|
-
After a beam dump, the undulator gap may not return correctly, scientists have often
|
|
15
|
+
After a beam dump, the undulator gap may not return correctly, scientists have often
|
|
16
|
+
requested that this check is done before collections.
|
|
16
17
|
|
|
17
18
|
Args:
|
|
18
|
-
plan: The plan performing the run.
|
|
19
|
-
devices (CheckUndulatorDevices): Any device composite including the DCM and
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
plan (MsgGenerator): The plan performing the run.
|
|
20
|
+
devices (CheckUndulatorDevices): Any device composite including the DCM and
|
|
21
|
+
undulator.
|
|
22
|
+
run_key_to_wrap (str, optional): The plan to verify the undulator gap is
|
|
23
|
+
inserted after the 'open_run' message is seen with the matching run key. If
|
|
24
|
+
not specified, instead wrap the first run encountered.
|
|
22
25
|
"""
|
|
23
|
-
|
|
24
26
|
# If no run_key specified, make sure we only do check on first run encountered
|
|
25
27
|
_wrapped_run_name: None | str = None
|
|
26
28
|
|
dodal/plans/spec_path.py
CHANGED
|
@@ -48,18 +48,16 @@ def spec_scan(
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
def _as_cycler(spec: Spec[Movable]) -> Cycler:
|
|
51
|
-
"""
|
|
52
|
-
Convert a scanspec to a cycler for compatibility with legacy Bluesky plans such as
|
|
51
|
+
"""Convert a scanspec to a cycler for compatibility with legacy Bluesky plans such as
|
|
53
52
|
`bp.scan_nd`. Use the midpoints of the scanspec since cyclers are normally used
|
|
54
53
|
for software triggered scans.
|
|
55
54
|
|
|
56
55
|
Args:
|
|
57
|
-
spec: A scanspec
|
|
56
|
+
spec (Spec[Movable]): A scanspec.
|
|
58
57
|
|
|
59
58
|
Returns:
|
|
60
|
-
Cycler: A new cycler
|
|
59
|
+
Cycler: A new cycler.
|
|
61
60
|
"""
|
|
62
|
-
|
|
63
61
|
midpoints = spec.frames().midpoints
|
|
64
62
|
# Need to "add" the cyclers for all the axes together. The code below is
|
|
65
63
|
# effectively: cycler(motor1, [...]) + cycler(motor2, [...]) + ...
|
|
@@ -13,7 +13,6 @@ class CheckUndulatorDevices(Protocol):
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def verify_undulator_gap(devices: CheckUndulatorDevices):
|
|
16
|
-
"""Verify Undulator gap is correct - it may not be after a beam dump"""
|
|
17
|
-
|
|
16
|
+
"""Verify Undulator gap is correct - it may not be after a beam dump."""
|
|
18
17
|
energy_in_keV = yield from bps.rd(devices.dcm.energy_in_keV.user_readback) # noqa: N806
|
|
19
18
|
yield from bps.abs_set(devices.undulator, energy_in_keV, wait=True)
|
dodal/plans/wrapped.py
CHANGED
|
@@ -18,8 +18,8 @@ Non-serialisable fields are ignored when they are optional
|
|
|
18
18
|
https://github.com/DiamondLightSource/blueapi/issues/711
|
|
19
19
|
|
|
20
20
|
We may also need other adjustments for UI purposes, e.g.
|
|
21
|
-
Forcing uniqueness or orderedness of Readables
|
|
22
|
-
Limits and metadata (e.g. units)
|
|
21
|
+
- Forcing uniqueness or orderedness of Readables.
|
|
22
|
+
- Limits and metadata (e.g. units).
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
|
|
@@ -47,7 +47,8 @@ def count(
|
|
|
47
47
|
) -> MsgGenerator:
|
|
48
48
|
"""Reads from a number of devices.
|
|
49
49
|
Wraps bluesky.plans.count(det, num, delay, md=metadata) exposing only serializable
|
|
50
|
-
parameters and metadata.
|
|
50
|
+
parameters and metadata.
|
|
51
|
+
"""
|
|
51
52
|
if isinstance(delay, Sequence):
|
|
52
53
|
assert len(delay) == num - 1, (
|
|
53
54
|
f"Number of delays given must be {num - 1}: was given {len(delay)}"
|
|
@@ -14,14 +14,13 @@ def create_driver(
|
|
|
14
14
|
driver_class: type[TAbstractAnalyserDriverIO],
|
|
15
15
|
**kwargs: Any,
|
|
16
16
|
) -> TAbstractAnalyserDriverIO:
|
|
17
|
-
"""
|
|
18
|
-
Helper function that helps to reduce the code to setup an analyser driver. The
|
|
17
|
+
"""Helper function that helps to reduce the code to setup an analyser driver. The
|
|
19
18
|
parameters used for the enum types are taken directly from the subscripts of the
|
|
20
19
|
class so the user only needs to provide it in one place.
|
|
21
20
|
|
|
22
21
|
Args:
|
|
23
22
|
driver_class: The class for the driver which must include the enums in the
|
|
24
|
-
|
|
23
|
+
subscript, for example MyDriverClass[MyLensMode, ...].
|
|
25
24
|
kwargs: Additional key worded arguments that the driver needs for initalisation.
|
|
26
25
|
"""
|
|
27
26
|
parameters = {
|
|
@@ -38,16 +37,15 @@ def create_detector(
|
|
|
38
37
|
detector_class: type[TElectronAnalyserDetector],
|
|
39
38
|
**kwargs: Any,
|
|
40
39
|
) -> TElectronAnalyserDetector:
|
|
41
|
-
"""
|
|
42
|
-
Helper function that helps to reduce the code to setup an analyser detector. The
|
|
40
|
+
"""Helper function that helps to reduce the code to setup an analyser detector. The
|
|
43
41
|
parameters used for the enum types are taken directly from the subscripts of the
|
|
44
42
|
class so the user only needs to provide it in one place.
|
|
45
43
|
|
|
46
44
|
Args:
|
|
47
45
|
detector_class: The class for the detector which must include the enums in the
|
|
48
|
-
|
|
46
|
+
subscript, for example MyDetectorClass[MyLensMode, ...].
|
|
49
47
|
kwargs: Additional key worded arguments that the detector needs for
|
|
50
|
-
|
|
48
|
+
initalisation.
|
|
51
49
|
"""
|
|
52
50
|
parameters = {
|
|
53
51
|
"lens_mode_type": get_args(detector_class)[0],
|
|
@@ -14,6 +14,10 @@ from dodal.devices.insertion_device import (
|
|
|
14
14
|
UndulatorJawPhase,
|
|
15
15
|
UndulatorPhaseAxes,
|
|
16
16
|
)
|
|
17
|
+
from dodal.devices.insertion_device.apple2_undulator import (
|
|
18
|
+
Apple2,
|
|
19
|
+
UndulatorLockedPhaseAxes,
|
|
20
|
+
)
|
|
17
21
|
|
|
18
22
|
|
|
19
23
|
@pytest.fixture
|
|
@@ -76,3 +80,37 @@ async def mock_jaw_phase(prefix: str = "BLXX-EA-DET-007:") -> UndulatorJawPhase:
|
|
|
76
80
|
set_mock_value(mock_jaw_phase.jaw_phase.user_setpoint_readback, 0)
|
|
77
81
|
set_mock_value(mock_jaw_phase.status, EnabledDisabledUpper.ENABLED)
|
|
78
82
|
return mock_jaw_phase
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@pytest.fixture
|
|
86
|
+
async def mock_locked_phase_axes(
|
|
87
|
+
prefix: str = "BLXX-EA-DET-007:",
|
|
88
|
+
) -> UndulatorLockedPhaseAxes:
|
|
89
|
+
async with init_devices(mock=True):
|
|
90
|
+
mock_phase_axes = UndulatorLockedPhaseAxes(
|
|
91
|
+
prefix=prefix,
|
|
92
|
+
top_outer="RPQ1",
|
|
93
|
+
btm_inner="RPQ4",
|
|
94
|
+
)
|
|
95
|
+
assert mock_phase_axes.name == "mock_phase_axes"
|
|
96
|
+
set_mock_value(mock_phase_axes.gate, UndulatorGateStatus.CLOSE)
|
|
97
|
+
set_mock_value(mock_phase_axes.top_outer.velocity, 2)
|
|
98
|
+
set_mock_value(mock_phase_axes.btm_inner.velocity, 2)
|
|
99
|
+
set_mock_value(mock_phase_axes.top_outer.user_readback, 2)
|
|
100
|
+
set_mock_value(mock_phase_axes.btm_inner.user_readback, 2)
|
|
101
|
+
set_mock_value(mock_phase_axes.top_outer.user_setpoint_readback, 2)
|
|
102
|
+
set_mock_value(mock_phase_axes.btm_inner.user_setpoint_readback, 2)
|
|
103
|
+
set_mock_value(mock_phase_axes.status, EnabledDisabledUpper.ENABLED)
|
|
104
|
+
return mock_phase_axes
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@pytest.fixture
|
|
108
|
+
async def mock_locked_apple2(
|
|
109
|
+
mock_id_gap: UndulatorGap,
|
|
110
|
+
mock_locked_phase_axes: UndulatorLockedPhaseAxes,
|
|
111
|
+
) -> Apple2[UndulatorLockedPhaseAxes]:
|
|
112
|
+
mock_locked_apple2 = Apple2[UndulatorLockedPhaseAxes](
|
|
113
|
+
id_gap=mock_id_gap,
|
|
114
|
+
id_phase=mock_locked_phase_axes,
|
|
115
|
+
)
|
|
116
|
+
return mock_locked_apple2
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Allow external repos to reuse these fixtures so defined in single place.
|
|
3
|
-
"""
|
|
1
|
+
"""Allow external repos to reuse these fixtures so defined in single place."""
|
|
4
2
|
|
|
5
3
|
import asyncio
|
|
6
4
|
import copy
|
|
@@ -46,8 +44,7 @@ async def run_engine(_global_run_engine: RunEngine) -> AsyncGenerator[RunEngine,
|
|
|
46
44
|
|
|
47
45
|
@pytest_asyncio.fixture(scope="session", loop_scope="session")
|
|
48
46
|
async def _global_run_engine() -> AsyncGenerator[RunEngine, None]:
|
|
49
|
-
"""
|
|
50
|
-
Obtain a run engine, with its own event loop and thread.
|
|
47
|
+
"""Obtain a run engine, with its own event loop and thread.
|
|
51
48
|
|
|
52
49
|
On closure of the scope, the run engine is stopped and the event loop closed
|
|
53
50
|
in order to release all resources it consumes.
|
|
@@ -102,8 +99,7 @@ def run_engine_documents(run_engine: RunEngine) -> Mapping[str, list[dict]]:
|
|
|
102
99
|
|
|
103
100
|
@pytest.fixture(autouse=_ENABLE_FILEHANDLE_LEAK_CHECKS)
|
|
104
101
|
def check_for_filehandle_leaks(request: FixtureRequest):
|
|
105
|
-
"""
|
|
106
|
-
Test fixture that can be enabled in order to check for leaked filehandles
|
|
102
|
+
"""Test fixture that can be enabled in order to check for leaked filehandles
|
|
107
103
|
(typically caused by a rogue RunEngine instance).
|
|
108
104
|
|
|
109
105
|
Note that this test is not enabled by default due to imposing a significant
|
dodal/testing/fixtures/utils.py
CHANGED
|
@@ -9,8 +9,7 @@ import pytest
|
|
|
9
9
|
|
|
10
10
|
@pytest.fixture
|
|
11
11
|
async def event_loop_fuzzing():
|
|
12
|
-
"""
|
|
13
|
-
This fixture can be used to try and detect / reproduce intermittent test failures
|
|
12
|
+
"""This fixture can be used to try and detect / reproduce intermittent test failures
|
|
14
13
|
caused by race conditions and timing issues, which are often difficult to replicate
|
|
15
14
|
due to caching etc. causing timing to be different on a development machine compared
|
|
16
15
|
to when the test runs in CI.
|