mx-bluesky 0.3.1__py3-none-any.whl → 1.2.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 (142) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/i04/__init__.py +3 -0
  3. mx_bluesky/{i04 → beamlines/i04}/thawing_plan.py +5 -4
  4. mx_bluesky/{i24 → beamlines/i24}/serial/blueapi_config.yaml +1 -1
  5. mx_bluesky/{i24 → beamlines/i24}/serial/dcid.py +2 -2
  6. mx_bluesky/{i24 → beamlines/i24}/serial/extruder/EX-gui-edm/DetStage.edl +3 -3
  7. mx_bluesky/{i24 → beamlines/i24}/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +7 -7
  8. mx_bluesky/{i24 → beamlines/i24}/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +12 -9
  9. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +3 -3
  10. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/DetStage.edl +3 -3
  11. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +245 -200
  12. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +4 -4
  13. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +8 -8
  14. mx_bluesky/beamlines/i24/serial/fixed_target/__init__.py +0 -0
  15. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +80 -70
  16. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +20 -21
  17. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +5 -5
  18. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +7 -4
  19. mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/i24ssx_moveonclick.py +59 -39
  20. mx_bluesky/{i24 → beamlines/i24}/serial/log.py +1 -9
  21. mx_bluesky/beamlines/i24/serial/parameters/__init__.py +15 -0
  22. mx_bluesky/{i24 → beamlines/i24}/serial/parameters/constants.py +1 -1
  23. mx_bluesky/{i24 → beamlines/i24}/serial/parameters/experiment_parameters.py +4 -25
  24. mx_bluesky/{i24 → beamlines/i24}/serial/parameters/utils.py +5 -3
  25. mx_bluesky/{i24 → beamlines/i24}/serial/run_serial.py +1 -1
  26. mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/pv_abstract.py +1 -1
  27. mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/setup_beamline.py +2 -2
  28. mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/setup_detector.py +5 -5
  29. mx_bluesky/{i24 → beamlines/i24}/serial/write_nexus.py +6 -3
  30. mx_bluesky/hyperion/__init__.py +1 -0
  31. mx_bluesky/hyperion/__main__.py +374 -0
  32. mx_bluesky/hyperion/device_setup_plans/__init__.py +0 -0
  33. mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +134 -0
  34. mx_bluesky/hyperion/device_setup_plans/manipulate_sample.py +110 -0
  35. mx_bluesky/hyperion/device_setup_plans/position_detector.py +16 -0
  36. mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +60 -0
  37. mx_bluesky/hyperion/device_setup_plans/setup_oav.py +87 -0
  38. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +210 -0
  39. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +214 -0
  40. mx_bluesky/hyperion/device_setup_plans/smargon.py +25 -0
  41. mx_bluesky/hyperion/device_setup_plans/utils.py +55 -0
  42. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +93 -0
  43. mx_bluesky/hyperion/exceptions.py +47 -0
  44. mx_bluesky/hyperion/experiment_plans/__init__.py +30 -0
  45. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +93 -0
  46. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +537 -0
  47. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +209 -0
  48. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +46 -0
  49. mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +173 -0
  50. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +81 -0
  51. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +463 -0
  52. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +119 -0
  53. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +164 -0
  54. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +237 -0
  55. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +162 -0
  56. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +436 -0
  57. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +60 -0
  58. mx_bluesky/hyperion/external_interaction/__init__.py +9 -0
  59. mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +10 -0
  60. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +148 -0
  61. mx_bluesky/hyperion/external_interaction/callbacks/aperture_change_callback.py +22 -0
  62. mx_bluesky/hyperion/external_interaction/callbacks/common/__init__.py +0 -0
  63. mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +64 -0
  64. mx_bluesky/hyperion/external_interaction/callbacks/common/ispyb_mapping.py +62 -0
  65. mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +88 -0
  66. mx_bluesky/hyperion/external_interaction/callbacks/ispyb_callback_base.py +203 -0
  67. mx_bluesky/hyperion/external_interaction/callbacks/log_uid_tag_callback.py +20 -0
  68. mx_bluesky/hyperion/external_interaction/callbacks/logging_callback.py +29 -0
  69. mx_bluesky/hyperion/external_interaction/callbacks/plan_reactive_callback.py +101 -0
  70. mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +86 -0
  71. mx_bluesky/hyperion/external_interaction/callbacks/rotation/__init__.py +0 -0
  72. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +174 -0
  73. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_mapping.py +17 -0
  74. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +102 -0
  75. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/__init__.py +0 -0
  76. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +269 -0
  77. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_mapping.py +53 -0
  78. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +95 -0
  79. mx_bluesky/hyperion/external_interaction/callbacks/zocalo_callback.py +92 -0
  80. mx_bluesky/hyperion/external_interaction/config_server.py +35 -0
  81. mx_bluesky/hyperion/external_interaction/exceptions.py +13 -0
  82. mx_bluesky/hyperion/external_interaction/ispyb/__init__.py +0 -0
  83. mx_bluesky/hyperion/external_interaction/ispyb/data_model.py +95 -0
  84. mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +125 -0
  85. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_store.py +276 -0
  86. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_utils.py +27 -0
  87. mx_bluesky/hyperion/external_interaction/nexus/__init__.py +0 -0
  88. mx_bluesky/hyperion/external_interaction/nexus/nexus_utils.py +148 -0
  89. mx_bluesky/hyperion/external_interaction/nexus/write_nexus.py +114 -0
  90. mx_bluesky/hyperion/log.py +99 -0
  91. mx_bluesky/hyperion/parameters/__init__.py +2 -0
  92. mx_bluesky/hyperion/parameters/cli.py +68 -0
  93. mx_bluesky/{parameters → hyperion/parameters}/components.py +80 -26
  94. mx_bluesky/hyperion/parameters/constants.py +158 -0
  95. mx_bluesky/hyperion/parameters/gridscan.py +221 -0
  96. mx_bluesky/hyperion/parameters/load_centre_collect.py +50 -0
  97. mx_bluesky/hyperion/parameters/robot_load.py +16 -0
  98. mx_bluesky/hyperion/parameters/rotation.py +160 -0
  99. mx_bluesky/hyperion/resources/panda/panda-gridscan.yaml +964 -0
  100. mx_bluesky/hyperion/tracing.py +28 -0
  101. mx_bluesky/hyperion/utils/context.py +84 -0
  102. mx_bluesky/hyperion/utils/utils.py +25 -0
  103. mx_bluesky/hyperion/utils/validation.py +196 -0
  104. mx_bluesky/jupyter_example.ipynb +3 -2
  105. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.2.0.dist-info}/METADATA +26 -11
  106. mx_bluesky-1.2.0.dist-info/RECORD +140 -0
  107. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.2.0.dist-info}/WHEEL +1 -1
  108. mx_bluesky-1.2.0.dist-info/entry_points.txt +8 -0
  109. mx_bluesky/i04/__init__.py +0 -3
  110. mx_bluesky/i24/serial/parameters/__init__.py +0 -15
  111. mx_bluesky/parameters/__init__.py +0 -31
  112. mx_bluesky-0.3.1.dist-info/RECORD +0 -67
  113. mx_bluesky-0.3.1.dist-info/entry_points.txt +0 -4
  114. /mx_bluesky/{i24 → beamlines}/__init__.py +0 -0
  115. /mx_bluesky/{i04 → beamlines/i04}/callbacks/murko_callback.py +0 -0
  116. /mx_bluesky/{i24/serial/extruder → beamlines/i24}/__init__.py +0 -0
  117. /mx_bluesky/{i24 → beamlines/i24}/serial/__init__.py +0 -0
  118. /mx_bluesky/{i24 → beamlines/i24}/serial/extruder/EX-gui-edm/microdrop_alignment.edl +0 -0
  119. /mx_bluesky/{i24/serial/fixed_target → beamlines/i24/serial/extruder}/__init__.py +0 -0
  120. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/ME14E-GeneralPurpose.edl +0 -0
  121. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/PMAC_Command.edl +0 -0
  122. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/Shutter_Control.edl +0 -0
  123. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/microdrop_alignment.edl +0 -0
  124. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/nudgechip.edl +0 -0
  125. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/short1-laser.png +0 -0
  126. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/short2-laser.png +0 -0
  127. /mx_bluesky/{i24 → beamlines/i24}/serial/fixed_target/ft_utils.py +0 -0
  128. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/cs/cs_maker.json +0 -0
  129. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/cs/motor_direction.txt +0 -0
  130. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/pvar_files/minichip-oxford.pvar +0 -0
  131. /mx_bluesky/{i24 → beamlines/i24}/serial/parameters/fixed_target/pvar_files/oxford.pvar +0 -0
  132. /mx_bluesky/{i24 → beamlines/i24}/serial/run_extruder.sh +0 -0
  133. /mx_bluesky/{i24 → beamlines/i24}/serial/run_fixed_target.sh +0 -0
  134. /mx_bluesky/{i24 → beamlines/i24}/serial/run_ssx.sh +0 -0
  135. /mx_bluesky/{i24 → beamlines/i24}/serial/set_visit_directory.sh +0 -0
  136. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/__init__.py +0 -0
  137. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/ca.py +0 -0
  138. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/pv.py +0 -0
  139. /mx_bluesky/{i24 → beamlines/i24}/serial/setup_beamline/setup_zebra_plans.py +0 -0
  140. /mx_bluesky/{i24 → beamlines/i24}/serial/start_blueapi.sh +0 -0
  141. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.2.0.dist-info}/LICENSE +0 -0
  142. {mx_bluesky-0.3.1.dist-info → mx_bluesky-1.2.0.dist-info}/top_level.txt +0 -0
@@ -3,8 +3,8 @@ beginScreenProperties
3
3
  major 4
4
4
  minor 0
5
5
  release 1
6
- x 3168
7
- y 118
6
+ x 1062
7
+ y 369
8
8
  w 650
9
9
  h 400
10
10
  font "arial-medium-r-18.0"
@@ -219,7 +219,7 @@ font "arial-medium-r-18.0"
219
219
  buttonLabel "Upload Parameters"
220
220
  numCmds 1
221
221
  command {
222
- 0 "blueapi -c CONFIG_LOCATION controller run upload_parameters '\{\"chipid\":\"oxford\"\}'"
222
+ 0 "blueapi -c CONFIG_LOCATION controller run upload_parameters '\{\"pmac\":\"pmac\"\}'"
223
223
  }
224
224
  endObjectProperties
225
225
 
@@ -2410,7 +2410,7 @@ font "helvetica-medium-r-18.0"
2410
2410
  buttonLabel "Define Chip In PMAC"
2411
2411
  numCmds 1
2412
2412
  command {
2413
- 0 "blueapi -c CONFIG_LOCATION controller run define_current_chip '\{\"chipid\":\"oxford\"\}'"
2413
+ 0 "blueapi -c CONFIG_LOCATION controller run define_current_chip '\{\"chipid\":\"oxford\",\"pmac\":\"pmac\"\}'"
2414
2414
  }
2415
2415
  endObjectProperties
2416
2416
 
@@ -3,8 +3,8 @@ beginScreenProperties
3
3
  major 4
4
4
  minor 0
5
5
  release 1
6
- x 2970
7
- y 362
6
+ x 830
7
+ y 200
8
8
  w 900
9
9
  h 700
10
10
  font "arial-medium-r-18.0"
@@ -707,7 +707,7 @@ botShadowColor index 14
707
707
  font "arial-medium-r-18.0"
708
708
  numCmds 1
709
709
  command {
710
- 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser1off\"\}'"
710
+ 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser1off\",\"pmac\":\"pmac\"\}'"
711
711
  }
712
712
  endObjectProperties
713
713
 
@@ -749,7 +749,7 @@ botShadowColor index 14
749
749
  font "arial-medium-r-18.0"
750
750
  numCmds 1
751
751
  command {
752
- 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser1on\"\}'"
752
+ 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser1on\",\"pmac\":\"pmac\"\}'"
753
753
  }
754
754
  endObjectProperties
755
755
 
@@ -976,7 +976,7 @@ botShadowColor index 14
976
976
  font "arial-medium-r-18.0"
977
977
  numCmds 1
978
978
  command {
979
- 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser2off\"\}'"
979
+ 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser2off\",\"pmac\":\"pmac\"\}'"
980
980
  }
981
981
  endObjectProperties
982
982
 
@@ -1018,7 +1018,7 @@ botShadowColor index 14
1018
1018
  font "arial-medium-r-18.0"
1019
1019
  numCmds 1
1020
1020
  command {
1021
- 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser2on\"\}'"
1021
+ 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser2on\",\"pmac\":\"pmac\"\}'"
1022
1022
  }
1023
1023
  endObjectProperties
1024
1024
 
@@ -1334,7 +1334,7 @@ botShadowColor index 14
1334
1334
  font "arial-medium-r-18.0"
1335
1335
  numCmds 1
1336
1336
  command {
1337
- 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser1burn\"\}'"
1337
+ 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser1burn\",\"pmac\":\"pmac\"\}'"
1338
1338
  }
1339
1339
  endObjectProperties
1340
1340
 
@@ -1376,7 +1376,7 @@ botShadowColor index 14
1376
1376
  font "arial-medium-r-18.0"
1377
1377
  numCmds 1
1378
1378
  command {
1379
- 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser2burn\"\}'"
1379
+ 0 "blueapi -c CONFIG_LOCATION controller run laser_control '\{\"laser_setting\":\"laser2burn\",\"pmac\":\"pmac\"\}'"
1380
1380
  }
1381
1381
  endObjectProperties
1382
1382
 
@@ -23,26 +23,29 @@ from dodal.devices.i24.i24_detector_motion import DetectorMotion
23
23
  from dodal.devices.i24.pmac import PMAC
24
24
  from dodal.devices.zebra import Zebra
25
25
 
26
- from mx_bluesky.i24.serial import log
27
- from mx_bluesky.i24.serial.dcid import DCID
28
- from mx_bluesky.i24.serial.fixed_target.ft_utils import (
26
+ from mx_bluesky.beamlines.i24.serial import log
27
+ from mx_bluesky.beamlines.i24.serial.dcid import DCID
28
+ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
29
29
  ChipType,
30
30
  MappingType,
31
31
  PumpProbeSetting,
32
32
  )
33
- from mx_bluesky.i24.serial.parameters import (
33
+ from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_Chip_Manager_py3v1 import (
34
+ write_parameter_file,
35
+ )
36
+ from mx_bluesky.beamlines.i24.serial.parameters import (
34
37
  ChipDescription,
35
38
  FixedTargetParameters,
36
39
  SSXType,
37
40
  )
38
- from mx_bluesky.i24.serial.parameters.constants import (
41
+ from mx_bluesky.beamlines.i24.serial.parameters.constants import (
39
42
  LITEMAP_PATH,
40
43
  PARAM_FILE_NAME,
41
44
  PARAM_FILE_PATH_FT,
42
45
  )
43
- from mx_bluesky.i24.serial.setup_beamline import caget, cagetstring, caput, pv
44
- from mx_bluesky.i24.serial.setup_beamline import setup_beamline as sup
45
- from mx_bluesky.i24.serial.setup_beamline.setup_zebra_plans import (
46
+ from mx_bluesky.beamlines.i24.serial.setup_beamline import caget, cagetstring, caput, pv
47
+ from mx_bluesky.beamlines.i24.serial.setup_beamline import setup_beamline as sup
48
+ from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_zebra_plans import (
46
49
  SHUTTER_OPEN_TIME,
47
50
  arm_zebra,
48
51
  close_fast_shutter,
@@ -51,7 +54,7 @@ from mx_bluesky.i24.serial.setup_beamline.setup_zebra_plans import (
51
54
  reset_zebra_when_collection_done_plan,
52
55
  setup_zebra_for_fastchip_plan,
53
56
  )
54
- from mx_bluesky.i24.serial.write_nexus import call_nexgen
57
+ from mx_bluesky.beamlines.i24.serial.write_nexus import call_nexgen
55
58
 
56
59
  ABORTED = False
57
60
 
@@ -59,7 +62,7 @@ logger = logging.getLogger("I24ssx.fixed_target")
59
62
 
60
63
 
61
64
  def setup_logging():
62
- # Log should now change name daily.
65
+ # Log should now change name daily
63
66
  logfile = time.strftime("i24fixedtarget_%d%B%y.log").lower()
64
67
  log.config(logfile)
65
68
 
@@ -77,7 +80,10 @@ def calculate_collection_timeout(parameters: FixedTargetParameters) -> float:
77
80
  https://confluence.diamond.ac.uk/display/MXTech/Dynamics+and+fixed+targets.
78
81
 
79
82
  Args:
80
- parameters (FixedTargerParameters): The collection paramelters
83
+ parameters (FixedTargerParameters): The collection parameters.
84
+
85
+ Returns:
86
+ The estimated collection time, in s.
81
87
  """
82
88
  buffer = 30
83
89
  pump_setting = parameters.pump_repeat
@@ -275,54 +281,42 @@ def load_motion_program_data(
275
281
  def get_prog_num(
276
282
  chip_type: ChipType, map_type: MappingType, pump_repeat: PumpProbeSetting
277
283
  ) -> int:
278
- logger.info("Get Program Number")
279
- if pump_repeat == PumpProbeSetting.NoPP:
280
- if chip_type in [ChipType.Oxford, ChipType.OxfordInner]:
281
- logger.info(
282
- f"Pump_repeat: {str(pump_repeat)} \tOxford Chip: {str(chip_type)}"
283
- )
284
- if map_type == MappingType.NoMap:
285
- logger.info("Map type 0 = None")
286
- logger.info("Program number: 11")
287
- return 11
288
- elif map_type == MappingType.Lite:
289
- logger.info("Map type 1 = Mapping Lite")
290
- logger.info("Program number: 12")
291
- return 12
292
- elif map_type == MappingType.Full:
293
- logger.info("Map type 2 = Full Mapping")
294
- logger.info("Program number: 13") # once fixed return 13
295
- msg = "Mapping Type FULL is broken as of 11.09.17"
296
- logger.error(msg)
297
- raise ValueError(msg)
298
- else:
299
- logger.debug(f"Unknown Mapping Type; map_type = {map_type}")
300
- return 0
301
- elif chip_type == ChipType.Custom:
302
- logger.info(
303
- f"Pump_repeat: {str(pump_repeat)} \tCustom Chip: {str(chip_type)}"
304
- )
305
- logger.info("Program number: 11")
306
- return 11
307
- elif chip_type == ChipType.Minichip:
308
- logger.info(
309
- f"Pump_repeat: {str(pump_repeat)} \tMini Oxford Chip: {str(chip_type)}"
310
- )
311
- logger.info("Program number: 11")
312
- return 11
313
- else:
314
- logger.debug(f"Unknown chip_type, chip_tpe = {chip_type}")
315
- return 0
316
- elif pump_repeat in [
317
- pp.value for pp in PumpProbeSetting if pp != PumpProbeSetting.NoPP
318
- ]:
319
- logger.info(f"Pump_repeat: {str(pump_repeat)} \t Chip Type: {str(chip_type)}")
320
- logger.info("Map Type = Mapping Lite with Pump Probe")
284
+ """Get the motion program number based on the experiment parameters set by \
285
+ the user.
286
+ Any pump probe experiment will return program number 14 (assumes lite mapping).
287
+ For non pump probe experiments, the program number depends on the chip and map type:
288
+ - Custom, Mini and PSI chips, as well as Oxford chips with no map return 11
289
+ - Oxford chips with lite mapping return 12
290
+ - Oxford chips with full mapping should return 13. Currently disabled, will \
291
+ raise an error.
292
+ """
293
+ logger.info("Get Program Number for the motion program.")
294
+ logger.info(f"Pump_repeat: {str(pump_repeat)} \t Chip Type: {str(chip_type)}")
295
+ if pump_repeat != PumpProbeSetting.NoPP:
296
+ logger.info("Assuming Map type = Mapping Lite.")
321
297
  logger.info("Program number: 14")
322
298
  return 14
323
- else:
324
- logger.warning(f"Unknown pump_repeat, pump_repeat = {pump_repeat}")
325
- return 0
299
+
300
+ if chip_type not in [ChipType.Oxford, ChipType.OxfordInner]:
301
+ logger.info("Program number: 11")
302
+ return 11
303
+
304
+ if map_type == MappingType.NoMap:
305
+ logger.info(f"Map type: {str(map_type)}")
306
+ logger.info("Program number: 11")
307
+ return 11
308
+ if map_type == MappingType.Lite:
309
+ logger.info(f"Map type: {str(map_type)}")
310
+ logger.info("Program number: 12")
311
+ return 12
312
+ if map_type == MappingType.Full:
313
+ # TODO See https://github.com/DiamondLightSource/mx-bluesky/issues/515
314
+ logger.info(f"Map type: {str(map_type)}")
315
+ logger.info("Program number: 13")
316
+ # TODO once reinstated return 13
317
+ msg = "Full mapping is broken and currently disabled."
318
+ logger.error(msg)
319
+ raise ValueError(msg)
326
320
 
327
321
 
328
322
  @log.log_on_entry
@@ -475,7 +469,7 @@ def start_i24(
475
469
  caput(pv.pilat_acquire, "1") # Arm pilatus
476
470
  yield from arm_zebra(zebra)
477
471
  caput(pv.pilat_filename, filename)
478
- time.sleep(1.5)
472
+ sleep(1.5)
479
473
 
480
474
  elif parameters.detector_name == "eiger":
481
475
  logger.info("Using Eiger detector")
@@ -549,7 +543,7 @@ def start_i24(
549
543
  )
550
544
  yield from arm_zebra(zebra)
551
545
 
552
- time.sleep(1.5)
546
+ sleep(1.5)
553
547
 
554
548
  else:
555
549
  msg = f"Unknown Detector Type, det_type = {parameters.detector_name}"
@@ -606,9 +600,7 @@ def run_aborted_plan(pmac: PMAC, dcid: DCID):
606
600
  P variable.
607
601
  """
608
602
  logger.warning("Data Collection Aborted")
609
- yield from bps.abs_set(pmac.pmac_string, "A", wait=True)
610
- yield from bps.sleep(1.0)
611
- yield from bps.abs_set(pmac.pmac_string, "P2401=0", wait=True)
603
+ yield from bps.trigger(pmac.abort_program, wait=True)
612
604
 
613
605
  end_time = datetime.now()
614
606
  dcid.collection_complete(end_time, aborted=True)
@@ -658,10 +650,6 @@ def main_fixed_target_plan(
658
650
  yield from bps.trigger(pmac.to_xyz_zero)
659
651
  sleep(2.0)
660
652
 
661
- prog_num = get_prog_num(
662
- parameters.chip.chip_type, parameters.map_type, parameters.pump_repeat
663
- )
664
-
665
653
  # Now ready for data collection. Open fast shutter (zebra gate)
666
654
  logger.info("Opening fast shutter.")
667
655
  yield from open_fast_shutter(zebra)
@@ -680,11 +668,30 @@ def main_fixed_target_plan(
680
668
  wavelength,
681
669
  )
682
670
 
683
- timeout_time = calculate_collection_timeout(parameters)
684
- logger.info(f"Run PMAC with program number {prog_num}")
685
- yield from bps.abs_set(pmac.run_program, prog_num, timeout_time, wait=True)
671
+ yield from kickoff_and_complete_collection(pmac, parameters)
686
672
 
687
- logger.debug("Collection completed without errors.")
673
+
674
+ def kickoff_and_complete_collection(pmac: PMAC, parameters: FixedTargetParameters):
675
+ prog_num = get_prog_num(
676
+ parameters.chip.chip_type, parameters.map_type, parameters.pump_repeat
677
+ )
678
+ yield from bps.abs_set(pmac.program_number, prog_num, group="setup_pmac")
679
+ # Calculate approx collection time
680
+ total_collection_time = calculate_collection_timeout(parameters)
681
+ logger.info(f"Estimated collection time: {total_collection_time}s.")
682
+ yield from bps.abs_set(
683
+ pmac.collection_time, total_collection_time, group="setup_pmac"
684
+ )
685
+ yield from bps.wait(group="setup_pmac") # Make sure the soft signals are set
686
+
687
+ @bpp.run_decorator(md={"subplan_name": "run_ft_collection"})
688
+ def run_collection():
689
+ logger.info(f"Kick off PMAC with program number {prog_num}.")
690
+ yield from bps.kickoff(pmac.run_program, wait=True)
691
+ yield from bps.complete(pmac.run_program, wait=True)
692
+ logger.info("Collection completed without errors.")
693
+
694
+ yield from run_collection()
688
695
 
689
696
 
690
697
  @log.log_on_entry
@@ -747,6 +754,9 @@ def run_fixed_target_plan(
747
754
  ) -> MsgGenerator:
748
755
  setup_logging()
749
756
 
757
+ # in the first instance, write params here
758
+ yield from write_parameter_file(detector_stage)
759
+
750
760
  logger.info("Getting parameters from file.")
751
761
  parameters = FixedTargetParameters.from_file(PARAM_FILE_PATH_FT / PARAM_FILE_NAME)
752
762
 
@@ -23,16 +23,20 @@ from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
23
23
  from dodal.devices.i24.i24_detector_motion import DetectorMotion
24
24
  from dodal.devices.i24.pmac import PMAC, EncReset, LaserSettings
25
25
 
26
- from mx_bluesky.i24.serial import log
27
- from mx_bluesky.i24.serial.fixed_target import i24ssx_Chip_Mapping_py3v1 as mapping
28
- from mx_bluesky.i24.serial.fixed_target import i24ssx_Chip_StartUp_py3v1 as startup
29
- from mx_bluesky.i24.serial.fixed_target.ft_utils import (
26
+ from mx_bluesky.beamlines.i24.serial import log
27
+ from mx_bluesky.beamlines.i24.serial.fixed_target import (
28
+ i24ssx_Chip_Mapping_py3v1 as mapping,
29
+ )
30
+ from mx_bluesky.beamlines.i24.serial.fixed_target import (
31
+ i24ssx_Chip_StartUp_py3v1 as startup,
32
+ )
33
+ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
30
34
  ChipType,
31
35
  Fiducials,
32
36
  MappingType,
33
37
  )
34
- from mx_bluesky.i24.serial.parameters import get_chip_format
35
- from mx_bluesky.i24.serial.parameters.constants import (
38
+ from mx_bluesky.beamlines.i24.serial.parameters import get_chip_format
39
+ from mx_bluesky.beamlines.i24.serial.parameters.constants import (
36
40
  CS_FILES_PATH,
37
41
  FULLMAP_PATH,
38
42
  LITEMAP_PATH,
@@ -40,8 +44,10 @@ from mx_bluesky.i24.serial.parameters.constants import (
40
44
  PARAM_FILE_PATH_FT,
41
45
  PVAR_FILE_PATH,
42
46
  )
43
- from mx_bluesky.i24.serial.setup_beamline import Pilatus, caget, caput, pv
44
- from mx_bluesky.i24.serial.setup_beamline.setup_detector import get_detector_type
47
+ from mx_bluesky.beamlines.i24.serial.setup_beamline import Pilatus, caget, caput, pv
48
+ from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_detector import (
49
+ get_detector_type,
50
+ )
45
51
 
46
52
  logger = logging.getLogger("I24ssx.chip_manager")
47
53
 
@@ -117,9 +123,8 @@ def initialise_stages(
117
123
 
118
124
  @log.log_on_entry
119
125
  def write_parameter_file(
120
- detector_stage: DetectorMotion = inject("detector_motion"),
126
+ detector_stage: DetectorMotion,
121
127
  ) -> MsgGenerator:
122
- setup_logging()
123
128
  param_path: Path = PARAM_FILE_PATH_FT
124
129
  # Create directory if it doesn't yet exist.
125
130
  param_path.mkdir(parents=True, exist_ok=True)
@@ -250,24 +255,18 @@ def save_screen_map() -> MsgGenerator:
250
255
 
251
256
 
252
257
  @log.log_on_entry
253
- def upload_parameters(
254
- chipid: str = "oxford", pmac: PMAC = inject("pmac"), width: int | None = None
255
- ) -> MsgGenerator:
258
+ def upload_parameters(pmac: PMAC = inject("pmac")) -> MsgGenerator:
256
259
  setup_logging()
257
- logger.info("Uploading Parameters to the GeoBrick")
258
- if chipid == "oxford":
259
- caput(CHIPTYPE_PV, 0)
260
- width = 8
261
- else:
262
- if width is None:
263
- raise Exception("Supply a width if chipid is not oxford")
260
+ logger.info("Uploading Parameters for Oxford Chip to the GeoBrick")
261
+ caput(CHIPTYPE_PV, 0)
262
+ width = 8
264
263
 
265
264
  map_file: Path = LITEMAP_PATH / "currentchip.map"
266
265
  if not map_file.exists():
267
266
  raise FileNotFoundError(f"The file {map_file} has not yet been created")
268
267
 
269
268
  with open(map_file) as f:
270
- logger.info(f"Chipid {chipid}")
269
+ logger.info(f"Chipid {ChipType.Oxford}")
271
270
  logger.info(f"width {width}")
272
271
  x = 1
273
272
  for line in f.readlines()[: width**2]:
@@ -10,17 +10,17 @@ import time
10
10
  import numpy as np
11
11
  from matplotlib import pyplot as plt
12
12
 
13
- from mx_bluesky.i24.serial import log
14
- from mx_bluesky.i24.serial.fixed_target.ft_utils import ChipType
15
- from mx_bluesky.i24.serial.fixed_target.i24ssx_Chip_StartUp_py3v1 import (
13
+ from mx_bluesky.beamlines.i24.serial import log
14
+ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType
15
+ from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_Chip_StartUp_py3v1 import (
16
16
  check_files,
17
17
  get_shot_order,
18
18
  get_xy,
19
19
  read_parameter_file,
20
20
  write_file,
21
21
  )
22
- from mx_bluesky.i24.serial.parameters import get_chip_format
23
- from mx_bluesky.i24.serial.parameters.constants import PARAM_FILE_PATH_FT
22
+ from mx_bluesky.beamlines.i24.serial.parameters import get_chip_format
23
+ from mx_bluesky.beamlines.i24.serial.parameters.constants import PARAM_FILE_PATH_FT
24
24
 
25
25
  logger = logging.getLogger("I24ssx.chip_mapping")
26
26
 
@@ -10,10 +10,13 @@ from pathlib import Path
10
10
 
11
11
  import numpy as np
12
12
 
13
- from mx_bluesky.i24.serial import log
14
- from mx_bluesky.i24.serial.fixed_target.ft_utils import ChipType
15
- from mx_bluesky.i24.serial.parameters import FixedTargetParameters, get_chip_format
16
- from mx_bluesky.i24.serial.parameters.constants import (
13
+ from mx_bluesky.beamlines.i24.serial import log
14
+ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType
15
+ from mx_bluesky.beamlines.i24.serial.parameters import (
16
+ FixedTargetParameters,
17
+ get_chip_format,
18
+ )
19
+ from mx_bluesky.beamlines.i24.serial.parameters.constants import (
17
20
  HEADER_FILES_PATH,
18
21
  PARAM_FILE_NAME,
19
22
  PARAM_FILE_PATH_FT,
@@ -4,6 +4,7 @@ Robin Owen 12 Jan 2021
4
4
  """
5
5
 
6
6
  import logging
7
+ from collections.abc import Sequence
7
8
 
8
9
  import bluesky.plan_stubs as bps
9
10
  import cv2 as cv
@@ -12,16 +13,14 @@ from dodal.beamlines import i24
12
13
  from dodal.devices.i24.pmac import PMAC
13
14
  from dodal.devices.oav.oav_detector import OAV
14
15
 
15
- from mx_bluesky.i24.serial.fixed_target import i24ssx_Chip_Manager_py3v1 as manager
16
- from mx_bluesky.i24.serial.fixed_target.ft_utils import Fiducials
17
- from mx_bluesky.i24.serial.parameters.constants import OAV1_CAM
16
+ from mx_bluesky.beamlines.i24.serial.fixed_target import (
17
+ i24ssx_Chip_Manager_py3v1 as manager,
18
+ )
19
+ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import Fiducials
20
+ from mx_bluesky.beamlines.i24.serial.parameters.constants import OAV1_CAM
18
21
 
19
22
  logger = logging.getLogger("I24ssx.moveonclick")
20
23
 
21
- # Set scale.
22
- # TODO See https://github.com/DiamondLightSource/mx_bluesky/issues/44
23
- zoomcalibrator = 6 # 8 seems to work well for zoom 2
24
-
25
24
 
26
25
  def _get_beam_centre(oav: OAV):
27
26
  """Extract the beam centre x/y positions from the display.configuration file.
@@ -32,20 +31,40 @@ def _get_beam_centre(oav: OAV):
32
31
  return oav.parameters.beam_centre_i, oav.parameters.beam_centre_j
33
32
 
34
33
 
34
+ def _calculate_zoom_calibrator(oav: OAV):
35
+ """Set the scale for the zoom calibrator for the pmac moves."""
36
+ currentzoom = yield from bps.rd(oav.zoom_controller.percentage)
37
+ zoomcalibrator = 1.547 - (0.03 * currentzoom) + (0.0001634 * currentzoom**2)
38
+ return zoomcalibrator
39
+
40
+
41
+ def _move_on_mouse_click_plan(
42
+ oav: OAV, pmac: PMAC, beam_centre: Sequence[int], clicked_position: Sequence[int]
43
+ ):
44
+ """A plan that calculates the zoom calibrator and moves to the clicked \
45
+ position coordinates.
46
+ """
47
+ zoomcalibrator = yield from _calculate_zoom_calibrator(oav)
48
+ beamX, beamY = beam_centre
49
+ x, y = clicked_position
50
+ xmove = -1 * (beamX - x) * zoomcalibrator
51
+ ymove = -1 * (beamY - y) * zoomcalibrator
52
+ logger.info(f"Moving X and Y {xmove} {ymove}")
53
+ xmovepmacstring = "#1J:" + str(xmove)
54
+ ymovepmacstring = "#2J:" + str(ymove)
55
+ yield from bps.abs_set(pmac.pmac_string, xmovepmacstring, wait=True)
56
+ yield from bps.abs_set(pmac.pmac_string, ymovepmacstring, wait=True)
57
+
58
+
35
59
  # Register clicks and move chip stages
36
60
  def onMouse(event, x, y, flags, param):
37
61
  if event == cv.EVENT_LBUTTONUP:
38
- pmac = param[0]
39
- oav = param[1]
62
+ RE = param[0]
63
+ pmac = param[1]
64
+ oav = param[2]
40
65
  beamX, beamY = _get_beam_centre(oav)
41
66
  logger.info(f"Clicked X and Y {x} {y}")
42
- xmove = -1 * (beamX - x) * zoomcalibrator
43
- ymove = -1 * (beamY - y) * zoomcalibrator
44
- logger.info(f"Moving X and Y {xmove} {ymove}")
45
- xmovepmacstring = "#1J:" + str(xmove)
46
- ymovepmacstring = "#2J:" + str(ymove)
47
- yield from bps.abs_set(pmac.pmac_string, xmovepmacstring, wait=True)
48
- yield from bps.abs_set(pmac.pmac_string, ymovepmacstring, wait=True)
67
+ RE(_move_on_mouse_click_plan(oav, pmac, (beamX, beamY), (x, y)))
49
68
 
50
69
 
51
70
  def update_ui(oav, frame):
@@ -56,7 +75,6 @@ def update_ui(oav, frame):
56
75
  cv.ellipse(
57
76
  frame, (beamX, beamY), (12, 8), 0.0, 0.0, 360, (0, 255, 255), thickness=2
58
77
  )
59
- # putText(frame,'text',bottomLeftCornerOfText, font, fontScale, fontColor, thickness, lineType)
60
78
  cv.putText(
61
79
  frame,
62
80
  "Key bindings",
@@ -130,16 +148,13 @@ def update_ui(oav, frame):
130
148
  cv.imshow("OAV1view", frame)
131
149
 
132
150
 
133
- def start_viewer(oav1: str = OAV1_CAM):
134
- # Get devices out of dodal
135
- oav: OAV = i24.oav()
136
- pmac: PMAC = i24.pmac()
151
+ def start_viewer(oav: OAV, pmac: PMAC, RE: RunEngine, oav1: str = OAV1_CAM):
137
152
  # Create a video caputure from OAV1
138
153
  cap = cv.VideoCapture(oav1)
139
154
 
140
155
  # Create window named OAV1view and set onmouse to this
141
156
  cv.namedWindow("OAV1view")
142
- cv.setMouseCallback("OAV1view", onMouse, param=[pmac, oav]) # type: ignore
157
+ cv.setMouseCallback("OAV1view", onMouse, param=[RE, pmac, oav]) # type: ignore
143
158
 
144
159
  logger.info("Showing camera feed. Press escape to close")
145
160
  # Read captured video and store them in success and frame
@@ -153,38 +168,40 @@ def start_viewer(oav1: str = OAV1_CAM):
153
168
 
154
169
  k = cv.waitKey(1)
155
170
  if k == 113: # Q
156
- yield from manager.moveto(Fiducials.zero, pmac)
171
+ RE(manager.moveto(Fiducials.zero, pmac))
157
172
  if k == 119: # W
158
- yield from manager.moveto(Fiducials.fid1, pmac)
173
+ RE(manager.moveto(Fiducials.fid1, pmac))
159
174
  if k == 101: # E
160
- yield from manager.moveto(Fiducials.fid2, pmac)
175
+ RE(manager.moveto(Fiducials.fid2, pmac))
161
176
  if k == 97: # A
162
- yield from bps.trigger(pmac.home, wait=True)
177
+ RE(bps.trigger(pmac.home, wait=True))
163
178
  print("Current position set as origin")
164
179
  if k == 115: # S
165
- yield from manager.fiducial(1)
180
+ RE(manager.fiducial(1))
166
181
  if k == 100: # D
167
- yield from manager.fiducial(2)
182
+ RE(manager.fiducial(2))
168
183
  if k == 99: # C
169
- yield from manager.cs_maker(pmac)
184
+ RE(manager.cs_maker(pmac))
170
185
  if k == 98: # B
171
- yield from manager.block_check() # doesn't work well for blockcheck as image doesn't update
186
+ RE(
187
+ manager.block_check()
188
+ ) # doesn't work well for blockcheck as image doesn't update
172
189
  if k == 104: # H
173
- yield from bps.abs_set(pmac.pmac_string, "#2J:-10", wait=True)
190
+ RE(bps.abs_set(pmac.pmac_string, "#2J:-10", wait=True))
174
191
  if k == 110: # N
175
- yield from bps.abs_set(pmac.pmac_string, "#2J:10", wait=True)
192
+ RE(bps.abs_set(pmac.pmac_string, "#2J:10", wait=True))
176
193
  if k == 109: # M
177
- yield from bps.abs_set(pmac.pmac_string, "#1J:-10", wait=True)
194
+ RE(bps.abs_set(pmac.pmac_string, "#1J:-10", wait=True))
178
195
  if k == 98: # B
179
- yield from bps.abs_set(pmac.pmac_string, "#1J:10", wait=True)
196
+ RE(bps.abs_set(pmac.pmac_string, "#1J:10", wait=True))
180
197
  if k == 105: # I
181
- yield from bps.abs_set(pmac.pmac_string, "#3J:-150", wait=True)
198
+ RE(bps.abs_set(pmac.pmac_string, "#3J:-150", wait=True))
182
199
  if k == 111: # O
183
- yield from bps.abs_set(pmac.pmac_string, "#3J:150", wait=True)
200
+ RE(bps.abs_set(pmac.pmac_string, "#3J:150", wait=True))
184
201
  if k == 117: # U
185
- yield from bps.abs_set(pmac.pmac_string, "#3J:-1000", wait=True)
202
+ RE(bps.abs_set(pmac.pmac_string, "#3J:-1000", wait=True))
186
203
  if k == 112: # P
187
- yield from bps.abs_set(pmac.pmac_string, "#3J:1000", wait=True)
204
+ RE(bps.abs_set(pmac.pmac_string, "#3J:1000", wait=True))
188
205
  if k == 0x1B: # esc
189
206
  cv.destroyWindow("OAV1view")
190
207
  print("Pressed escape. Closing window")
@@ -196,4 +213,7 @@ def start_viewer(oav1: str = OAV1_CAM):
196
213
 
197
214
  if __name__ == "__main__":
198
215
  RE = RunEngine()
199
- RE(start_viewer())
216
+ # Get devices out of dodal
217
+ oav: OAV = i24.oav()
218
+ pmac: PMAC = i24.pmac()
219
+ start_viewer(oav, pmac, RE)
@@ -4,13 +4,12 @@ import logging.config
4
4
  from os import environ
5
5
  from pathlib import Path
6
6
 
7
- from bluesky.log import logger as bluesky_logger
8
7
  from dodal.log import (
9
8
  ERROR_LOG_BUFFER_LINES,
9
+ integrate_bluesky_and_ophyd_logging,
10
10
  set_up_all_logging_handlers,
11
11
  )
12
12
  from dodal.log import LOGGER as dodal_logger
13
- from ophyd_async.log import logger as ophyd_async_logger
14
13
 
15
14
  VISIT_PATH = Path("/dls_sw/i24/etc/ssx_current_visit.txt")
16
15
 
@@ -88,13 +87,6 @@ def _get_logging_file_path() -> Path:
88
87
  return logging_path
89
88
 
90
89
 
91
- def integrate_bluesky_and_ophyd_logging(parent_logger: logging.Logger):
92
- """Integrate only bluesky and ophyd_async loggers."""
93
- for logger in [bluesky_logger, ophyd_async_logger]:
94
- logger.parent = parent_logger
95
- logger.setLevel(logging.DEBUG)
96
-
97
-
98
90
  def default_logging_setup(dev_mode: bool = False):
99
91
  """ Default log setup for i24 serial.
100
92