mx-bluesky 1.5.10__py3-none-any.whl → 1.5.11__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 (76) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/aithre_lasershaping/goniometer_controls.py +2 -2
  3. mx_bluesky/beamlines/i02_1/parameters/gridscan.py +1 -1
  4. mx_bluesky/beamlines/i04/experiment_plans/i04_grid_detect_then_xray_centre_plan.py +7 -7
  5. mx_bluesky/beamlines/i04/thawing_plan.py +9 -9
  6. mx_bluesky/beamlines/i24/jungfrau_commissioning/experiment_plans/do_darks.py +55 -10
  7. mx_bluesky/beamlines/i24/jungfrau_commissioning/plan_stubs/do_external_acquisition.py +1 -1
  8. mx_bluesky/beamlines/i24/jungfrau_commissioning/plan_stubs/plan_utils.py +1 -1
  9. mx_bluesky/beamlines/i24/serial/__init__.py +7 -5
  10. mx_bluesky/beamlines/i24/serial/dcid.py +3 -3
  11. mx_bluesky/beamlines/i24/serial/extruder/{i24ssx_Extruder_Collect_py3v2.py → i24ssx_extruder_collect_py3v2.py} +65 -35
  12. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Collect_py3v1.py → i24ssx_chip_collect_py3v1.py} +5 -5
  13. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_Manager_py3v1.py → i24ssx_chip_manager_py3v1.py} +46 -46
  14. mx_bluesky/beamlines/i24/serial/fixed_target/{i24ssx_Chip_StartUp_py3v1.py → i24ssx_chip_startup_py3v1.py} +3 -3
  15. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +33 -33
  16. mx_bluesky/beamlines/i24/serial/log.py +11 -11
  17. mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
  18. mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -12
  19. mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +13 -32
  20. mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +5 -5
  21. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +22 -249
  22. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +2 -2
  23. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +4 -4
  24. mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +102 -15
  25. mx_bluesky/beamlines/i24/serial/write_nexus.py +4 -4
  26. mx_bluesky/common/experiment_plans/common_flyscan_xray_centre_plan.py +6 -6
  27. mx_bluesky/common/experiment_plans/common_grid_detect_then_xray_centre_plan.py +2 -2
  28. mx_bluesky/common/experiment_plans/inner_plans/do_fgs.py +1 -1
  29. mx_bluesky/common/experiment_plans/inner_plans/read_hardware.py +2 -2
  30. mx_bluesky/common/experiment_plans/inner_plans/udc_default_state.py +22 -1
  31. mx_bluesky/common/experiment_plans/inner_plans/write_sample_status.py +2 -2
  32. mx_bluesky/common/experiment_plans/oav_snapshot_plan.py +1 -1
  33. mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +3 -3
  34. mx_bluesky/common/external_interaction/callbacks/common/plan_reactive_callback.py +1 -1
  35. mx_bluesky/common/external_interaction/callbacks/common/zocalo_callback.py +2 -2
  36. mx_bluesky/common/external_interaction/callbacks/sample_handling/sample_handling_callback.py +3 -3
  37. mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +7 -5
  38. mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -2
  39. mx_bluesky/common/external_interaction/config_server.py +2 -2
  40. mx_bluesky/common/external_interaction/ispyb/exp_eye_store.py +4 -2
  41. mx_bluesky/common/external_interaction/ispyb/ispyb_store.py +0 -1
  42. mx_bluesky/common/external_interaction/nexus/nexus_utils.py +2 -2
  43. mx_bluesky/common/external_interaction/nexus/write_nexus.py +3 -3
  44. mx_bluesky/common/parameters/constants.py +1 -1
  45. mx_bluesky/common/parameters/gridscan.py +2 -2
  46. mx_bluesky/common/utils/exceptions.py +9 -7
  47. mx_bluesky/common/utils/log.py +4 -4
  48. mx_bluesky/common/utils/tracing.py +5 -5
  49. mx_bluesky/common/utils/utils.py +8 -8
  50. mx_bluesky/hyperion/__main__.py +5 -5
  51. mx_bluesky/hyperion/baton_handler.py +15 -8
  52. mx_bluesky/hyperion/device_setup_plans/smargon.py +5 -5
  53. mx_bluesky/hyperion/device_setup_plans/utils.py +1 -1
  54. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +1 -1
  55. mx_bluesky/hyperion/experiment_plans/hyperion_flyscan_xray_centre_plan.py +15 -13
  56. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +2 -2
  57. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +9 -9
  58. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +2 -2
  59. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +3 -3
  60. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +2 -2
  61. mx_bluesky/hyperion/external_interaction/agamemnon.py +2 -2
  62. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +2 -2
  63. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +1 -1
  64. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +2 -2
  65. mx_bluesky/hyperion/external_interaction/config_server.py +2 -2
  66. mx_bluesky/hyperion/parameters/constants.py +2 -2
  67. mx_bluesky/hyperion/parameters/gridscan.py +4 -4
  68. mx_bluesky/hyperion/plan_runner.py +6 -6
  69. mx_bluesky/hyperion/runner.py +10 -8
  70. mx_bluesky/jupyter_example.ipynb +3 -3
  71. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.11.dist-info}/METADATA +6 -5
  72. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.11.dist-info}/RECORD +76 -76
  73. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.11.dist-info}/WHEEL +0 -0
  74. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.11.dist-info}/entry_points.txt +0 -0
  75. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.11.dist-info}/licenses/LICENSE +0 -0
  76. {mx_bluesky-1.5.10.dist-info → mx_bluesky-1.5.11.dist-info}/top_level.txt +0 -0
@@ -459,7 +459,7 @@ def load_lite_map() -> MsgGenerator:
459
459
  SSX_LOGGER.debug("Run load stock map with 'clear' setting.")
460
460
  yield from load_stock_map("clear")
461
461
  # fmt: off
462
- # Oxford_block_dict is wrong (columns and rows need to flip) added in script below to generate it automatically however kept this for backwards compatiability/reference
462
+ # Oxford_block_dict is wrong (columns and rows need to flip) added in script below to generate it automatically however kept this for backwards compatibility/reference
463
463
  oxford_block_dict = { # noqa: F841
464
464
  'A1': '01', 'A2': '02', 'A3': '03', 'A4': '04', 'A5': '05', 'A6': '06', 'A7': '07', 'A8': '08',
465
465
  'B1': '16', 'B2': '15', 'B3': '14', 'B4': '13', 'B5': '12', 'B6': '11', 'B7': '10', 'B8': '09',
@@ -523,7 +523,7 @@ def load_lite_map() -> MsgGenerator:
523
523
  def moveto(place: str = "origin", pmac: PMAC = inject("pmac")) -> MsgGenerator:
524
524
  SSX_LOGGER.info(f"Move to: {place}")
525
525
  if place == Fiducials.zero:
526
- SSX_LOGGER.info("Chip aspecific move.")
526
+ SSX_LOGGER.info("Chip moving to zero")
527
527
  yield from bps.trigger(pmac.to_xyz_zero)
528
528
  return
529
529
 
@@ -705,7 +705,7 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
705
705
 
706
706
  Skew:
707
707
  Skew is the difference between the Sz1 and Sz2 after rotation is taken out.
708
- This should be measured in situ prior to expriment, ie. measure by hand using
708
+ This should be measured in situ prior to experiment, ie. measure by hand using
709
709
  opposite and adjacent RBV after calibration of scale factors.
710
710
  """
711
711
  chip_type = int(caget(CHIPTYPE_PV))
@@ -738,10 +738,10 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
738
738
  float(cs_info["scalez"]),
739
739
  )
740
740
  skew = float(cs_info["skew"])
741
- Sx_dir, Sy_dir, Sz_dir = (
742
- int(cs_info["Sx_dir"]),
743
- int(cs_info["Sy_dir"]),
744
- int(cs_info["Sz_dir"]),
741
+ sx_dir, sy_dir, sz_dir = (
742
+ int(cs_info["sx_dir"]),
743
+ int(cs_info["sy_dir"]),
744
+ int(cs_info["sz_dir"]),
745
745
  )
746
746
  except KeyError:
747
747
  SSX_LOGGER.error("Wrong or missing key in the cs json file.")
@@ -751,60 +751,60 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
751
751
  if val not in [1, -1]:
752
752
  raise ValueError("Wrong value for direction. Please set to either -1 or 1.")
753
753
 
754
- check_dir(Sx_dir)
755
- check_dir(Sy_dir)
756
- check_dir(Sz_dir)
754
+ check_dir(sx_dir)
755
+ check_dir(sy_dir)
756
+ check_dir(sz_dir)
757
757
 
758
758
  # Rotation Around Z
759
- # If stages upsidedown (I24) change sign of Sz
760
- Sz1 = -1 * f1_y / fiducial_dict[chip_type][0]
761
- Sz2 = f2_x / fiducial_dict[chip_type][1]
762
- Sz = Sz_dir * ((Sz1 + Sz2) / 2)
763
- Cz = np.sqrt(1 - Sz**2)
764
- SSX_LOGGER.info(f"Sz1 , {Sz1:1.4f}, {np.degrees(np.arcsin(Sz1)):1.4f}")
765
- SSX_LOGGER.info(f"Sz2 , {Sz2:1.4f}, {np.degrees(np.arcsin(Sz2)):1.4f}")
766
- SSX_LOGGER.info(f"Sz , {Sz:1.4f}, {np.degrees(np.arcsin(Sz)):1.4f}")
767
- SSX_LOGGER.info(f"Cz , {Cz:1.4f}, {np.degrees(np.arcsin(Cz)):1.4f}")
759
+ # If stages upsidedown (I24) change sign of sz
760
+ sz1 = -1 * f1_y / fiducial_dict[chip_type][0]
761
+ sz2 = f2_x / fiducial_dict[chip_type][1]
762
+ sz = sz_dir * ((sz1 + sz2) / 2)
763
+ cz = np.sqrt(1 - sz**2)
764
+ SSX_LOGGER.info(f"sz1 , {sz1:1.4f}, {np.degrees(np.arcsin(sz1)):1.4f}")
765
+ SSX_LOGGER.info(f"sz2 , {sz2:1.4f}, {np.degrees(np.arcsin(sz2)):1.4f}")
766
+ SSX_LOGGER.info(f"sz , {sz:1.4f}, {np.degrees(np.arcsin(sz)):1.4f}")
767
+ SSX_LOGGER.info(f"cz , {cz:1.4f}, {np.degrees(np.arcsin(cz)):1.4f}")
768
768
  # Rotation Around Y
769
- Sy = Sy_dir * f1_z / fiducial_dict[chip_type][0]
770
- Cy = np.sqrt(1 - Sy**2)
771
- SSX_LOGGER.info(f"Sy , {Sy:1.4f}, {np.degrees(np.arcsin(Sy)):1.4f}")
772
- SSX_LOGGER.info(f"Cy , {Cy:1.4f}, {np.degrees(np.arcsin(Cy)):1.4f}")
769
+ sy = sy_dir * f1_z / fiducial_dict[chip_type][0]
770
+ cy = np.sqrt(1 - sy**2)
771
+ SSX_LOGGER.info(f"sy , {sy:1.4f}, {np.degrees(np.arcsin(sy)):1.4f}")
772
+ SSX_LOGGER.info(f"cy , {cy:1.4f}, {np.degrees(np.arcsin(cy)):1.4f}")
773
773
  # Rotation Around X
774
- # If stages upsidedown (I24) change sign of Sx
775
- Sx = Sx_dir * f2_z / fiducial_dict[chip_type][1]
776
- Cx = np.sqrt(1 - Sx**2)
777
- SSX_LOGGER.info(f"Sx , {Sx:1.4f}, {np.degrees(np.arcsin(Sx)):1.4f}")
778
- SSX_LOGGER.info(f"Cx , {Cx:1.4f}, {np.degrees(np.arcsin(Cx)):1.4f}")
774
+ # If stages upsidedown (I24) change sign of sx
775
+ sx = sx_dir * f2_z / fiducial_dict[chip_type][1]
776
+ cx = np.sqrt(1 - sx**2)
777
+ SSX_LOGGER.info(f"sx , {sx:1.4f}, {np.degrees(np.arcsin(sx)):1.4f}")
778
+ SSX_LOGGER.info(f"cx , {cx:1.4f}, {np.degrees(np.arcsin(cx)):1.4f}")
779
779
 
780
- x1factor = mtr1_dir * scalex * (Cy * Cz)
781
- y1factor = mtr2_dir * scaley * (-1.0 * Cx * Sz)
782
- z1factor = mtr3_dir * scalez * Sy
780
+ x1factor = mtr1_dir * scalex * (cy * cz)
781
+ y1factor = mtr2_dir * scaley * (-1.0 * cx * sz)
782
+ z1factor = mtr3_dir * scalez * sy
783
783
 
784
- x2factor = mtr1_dir * scalex * ((Sx * Sy * Cz) + (Cx * Sz))
785
- y2factor = mtr2_dir * scaley * ((Cx * Cz) - (Sx * Sy * Sz))
786
- z2factor = mtr3_dir * scalez * (-1.0 * Sx * Cy)
784
+ x2factor = mtr1_dir * scalex * ((sx * sy * cz) + (cx * sz))
785
+ y2factor = mtr2_dir * scaley * ((cx * cz) - (sx * sy * sz))
786
+ z2factor = mtr3_dir * scalez * (-1.0 * sx * cy)
787
787
 
788
- x3factor = mtr1_dir * scalex * ((Sx * Sz) - (Cx * Sy * Cz))
789
- y3factor = mtr2_dir * scaley * ((Cx * Sy * Sz) + (Sx * Cz))
790
- z3factor = mtr3_dir * scalez * (Cx * Cy)
788
+ x3factor = mtr1_dir * scalex * ((sx * sz) - (cx * sy * cz))
789
+ y3factor = mtr2_dir * scaley * ((cx * sy * sz) + (sx * cz))
790
+ z3factor = mtr3_dir * scalez * (cx * cy)
791
791
 
792
792
  SSX_LOGGER.info(f"Skew being used is: {skew:1.4f}")
793
- s1 = np.degrees(np.arcsin(Sz1))
794
- s2 = np.degrees(np.arcsin(Sz2))
795
- rot = np.degrees(np.arcsin((Sz1 + Sz2) / 2))
793
+ s1 = np.degrees(np.arcsin(sz1))
794
+ s2 = np.degrees(np.arcsin(sz2))
795
+ rot = np.degrees(np.arcsin((sz1 + sz2) / 2))
796
796
  calc_skew = (s1 - rot) - (s2 - rot)
797
797
  SSX_LOGGER.info(f"s1:{s1:1.4f} s2:{s2:1.4f} rot:{rot:1.4f}")
798
798
  SSX_LOGGER.info(f"Calculated rotation from current fiducials is: {rot:1.4f}")
799
799
  SSX_LOGGER.info(f"Calculated Skew from current fiducials is: {calc_skew:1.4f}")
800
800
  SSX_LOGGER.info("Calculated Skew has been known to have the wrong sign")
801
801
 
802
- sinD = np.sin((skew / 2) * (np.pi / 180))
803
- cosD = np.cos((skew / 2) * (np.pi / 180))
804
- new_x1factor = (x1factor * cosD) + (y1factor * sinD)
805
- new_y1factor = (x1factor * sinD) + (y1factor * cosD)
806
- new_x2factor = (x2factor * cosD) + (y2factor * sinD)
807
- new_y2factor = (x2factor * sinD) + (y2factor * cosD)
802
+ sin_d = np.sin((skew / 2) * (np.pi / 180))
803
+ cod_d = np.cos((skew / 2) * (np.pi / 180))
804
+ new_x1factor = (x1factor * cod_d) + (y1factor * sin_d)
805
+ new_y1factor = (x1factor * sin_d) + (y1factor * cod_d)
806
+ new_x2factor = (x2factor * cod_d) + (y2factor * sin_d)
807
+ new_y2factor = (x2factor * sin_d) + (y2factor * cod_d)
808
808
 
809
809
  cs1 = f"#1->{new_x1factor:+1.3f}X{new_y1factor:+1.3f}Y{z1factor:+1.3f}Z"
810
810
  cs2 = f"#2->{new_x2factor:+1.3f}X{new_y2factor:+1.3f}Y{z2factor:+1.3f}Z"
@@ -70,10 +70,10 @@ def pathli(l_in=None, way="typewriter", reverse=False):
70
70
  def zippum(list_1_args, list_2_args):
71
71
  list_1, type_1, reverse_1 = list_1_args
72
72
  list_2, type_2, reverse_2 = list_2_args
73
- A_path = pathli(list_1, type_1, reverse_1)
74
- B_path = pathli(list_2, type_2, reverse_2)
73
+ a_path = pathli(list_1, type_1, reverse_1)
74
+ b_path = pathli(list_2, type_2, reverse_2)
75
75
  zipped_list = []
76
- for a, b in zip(A_path, B_path, strict=False):
76
+ for a, b in zip(a_path, b_path, strict=False):
77
77
  zipped_list.append(a + b)
78
78
  return zipped_list
79
79
 
@@ -13,7 +13,7 @@ from dodal.devices.i24.pmac import PMAC
13
13
  from dodal.devices.oav.oav_detector import OAV
14
14
 
15
15
  from mx_bluesky.beamlines.i24.serial.fixed_target import (
16
- i24ssx_Chip_Manager_py3v1 as manager,
16
+ i24ssx_chip_manager_py3v1 as manager,
17
17
  )
18
18
  from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import Fiducials
19
19
  from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
@@ -52,12 +52,12 @@ def _move_on_mouse_click_plan(
52
52
  position coordinates.
53
53
  """
54
54
  zoomcalibrator = yield from _calculate_zoom_calibrator(oav)
55
- beamX, beamY = yield from _get_beam_centre(oav)
55
+ beam_x, beam_y = yield from _get_beam_centre(oav)
56
56
  x, y = clicked_position
57
- xmove = -10 * (beamX - x) * zoomcalibrator
58
- ymove = 10 * (beamY - y) * zoomcalibrator
57
+ xmove = -10 * (beam_x - x) * zoomcalibrator
58
+ ymove = 10 * (beam_y - y) * zoomcalibrator
59
59
  SSX_LOGGER.info(f"Zoom calibrator {zoomcalibrator}")
60
- SSX_LOGGER.info(f"Beam centre {beamX} {beamY}")
60
+ SSX_LOGGER.info(f"Beam centre {beam_x} {beam_y}")
61
61
  SSX_LOGGER.info(f"Moving X and Y {xmove} {ymove}")
62
62
  xmovepmacstring = "&2#5J:" + str(xmove)
63
63
  ymovepmacstring = "&2#6J:" + str(ymove)
@@ -66,22 +66,22 @@ def _move_on_mouse_click_plan(
66
66
 
67
67
 
68
68
  # Register clicks and move chip stages
69
- def onMouse(event, x, y, flags, param):
69
+ def on_mouse(event, x, y, flags, param):
70
70
  if event == cv.EVENT_LBUTTONUP:
71
- RE = param[0]
71
+ run_engine = param[0]
72
72
  pmac = param[1]
73
73
  oav = param[2]
74
74
  SSX_LOGGER.info(f"Clicked X and Y {x} {y}")
75
- RE(_move_on_mouse_click_plan(oav, pmac, (x, y)))
75
+ run_engine(_move_on_mouse_click_plan(oav, pmac, (x, y)))
76
76
 
77
77
 
78
- def update_ui(oav, frame, RE):
78
+ def update_ui(oav, frame, run_engine):
79
79
  # Get beam x and y values
80
- beamX, beamY = RE(_get_beam_centre(oav)).plan_result
80
+ beam_x, beam_y = run_engine(_get_beam_centre(oav)).plan_result
81
81
 
82
82
  # Overlay text and beam centre
83
83
  cv.ellipse(
84
- frame, (beamX, beamY), (12, 8), 0.0, 0.0, 360, (0, 255, 255), thickness=2
84
+ frame, (beam_x, beam_y), (12, 8), 0.0, 0.0, 360, (0, 255, 255), thickness=2
85
85
  )
86
86
  cv.putText(
87
87
  frame,
@@ -156,13 +156,13 @@ def update_ui(oav, frame, RE):
156
156
  cv.imshow("OAV1view", frame)
157
157
 
158
158
 
159
- def start_viewer(oav: OAV, pmac: PMAC, RE: RunEngine, oav1: str = OAV1_CAM):
160
- # Create a video caputure from OAV1
159
+ def start_viewer(oav: OAV, pmac: PMAC, run_engine: RunEngine, oav1: str = OAV1_CAM):
160
+ # Create a video capture from OAV1
161
161
  cap = cv.VideoCapture(oav1)
162
162
 
163
163
  # Create window named OAV1view and set onmouse to this
164
164
  cv.namedWindow("OAV1view")
165
- cv.setMouseCallback("OAV1view", onMouse, param=[RE, pmac, oav]) # type: ignore
165
+ cv.setMouseCallback("OAV1view", on_mouse, param=[run_engine, pmac, oav]) # type: ignore
166
166
 
167
167
  SSX_LOGGER.info("Showing camera feed. Press escape to close")
168
168
  # Read captured video and store them in success and frame
@@ -172,44 +172,44 @@ def start_viewer(oav: OAV, pmac: PMAC, RE: RunEngine, oav1: str = OAV1_CAM):
172
172
  while success:
173
173
  success, frame = cap.read()
174
174
 
175
- update_ui(oav, frame, RE)
175
+ update_ui(oav, frame, run_engine)
176
176
 
177
177
  k = cv.waitKey(1)
178
178
  if k == 113: # Q
179
- RE(manager.moveto(Fiducials.zero, pmac))
179
+ run_engine(manager.moveto(Fiducials.zero, pmac))
180
180
  if k == 119: # W
181
- RE(manager.moveto(Fiducials.fid1, pmac))
181
+ run_engine(manager.moveto(Fiducials.fid1, pmac))
182
182
  if k == 101: # E
183
- RE(manager.moveto(Fiducials.fid2, pmac))
183
+ run_engine(manager.moveto(Fiducials.fid2, pmac))
184
184
  if k == 97: # A
185
- RE(bps.trigger(pmac.home, wait=True))
185
+ run_engine(bps.trigger(pmac.home, wait=True))
186
186
  print("Current position set as origin")
187
187
  if k == 115: # S
188
- RE(manager.fiducial(1))
188
+ run_engine(manager.fiducial(1))
189
189
  if k == 100: # D
190
- RE(manager.fiducial(2))
190
+ run_engine(manager.fiducial(2))
191
191
  if k == 99: # C
192
- RE(manager.cs_maker(pmac))
192
+ run_engine(manager.cs_maker(pmac))
193
193
  if k == 98: # B
194
- RE(
194
+ run_engine(
195
195
  manager.block_check()
196
196
  ) # doesn't work well for blockcheck as image doesn't update
197
197
  if k == 104: # H
198
- RE(bps.abs_set(pmac.pmac_string, "&2#6J:-10", wait=True))
198
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#6J:-10", wait=True))
199
199
  if k == 110: # N
200
- RE(bps.abs_set(pmac.pmac_string, "&2#6J:10", wait=True))
200
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#6J:10", wait=True))
201
201
  if k == 109: # M
202
- RE(bps.abs_set(pmac.pmac_string, "&2#5J:-10", wait=True))
202
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#5J:-10", wait=True))
203
203
  if k == 98: # B
204
- RE(bps.abs_set(pmac.pmac_string, "&2#5J:10", wait=True))
204
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#5J:10", wait=True))
205
205
  if k == 105: # I
206
- RE(bps.abs_set(pmac.pmac_string, "&2#7J:-150", wait=True))
206
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#7J:-150", wait=True))
207
207
  if k == 111: # O
208
- RE(bps.abs_set(pmac.pmac_string, "&2#7J:150", wait=True))
208
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#7J:150", wait=True))
209
209
  if k == 117: # U
210
- RE(bps.abs_set(pmac.pmac_string, "&2#7J:-1000", wait=True))
210
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#7J:-1000", wait=True))
211
211
  if k == 112: # P
212
- RE(bps.abs_set(pmac.pmac_string, "&2#7J:1000", wait=True))
212
+ run_engine(bps.abs_set(pmac.pmac_string, "&2#7J:1000", wait=True))
213
213
  if k == 0x1B: # esc
214
214
  cv.destroyWindow("OAV1view")
215
215
  print("Pressed escape. Closing window")
@@ -220,8 +220,8 @@ def start_viewer(oav: OAV, pmac: PMAC, RE: RunEngine, oav1: str = OAV1_CAM):
220
220
 
221
221
 
222
222
  if __name__ == "__main__":
223
- RE = RunEngine(call_returns_result=True)
223
+ run_engine = RunEngine(call_returns_result=True)
224
224
  # Get devices out of dodal
225
225
  oav: OAV = i24.oav(connect_immediately=True)
226
226
  pmac: PMAC = i24.pmac(connect_immediately=True)
227
- start_viewer(oav, pmac, RE)
227
+ start_viewer(oav, pmac, run_engine)
@@ -9,7 +9,7 @@ import bluesky.plan_stubs as bps
9
9
  from bluesky.log import logger as bluesky_logger
10
10
  from bluesky.utils import MsgGenerator
11
11
  from dodal.log import DEFAULT_GRAYLOG_PORT, ophyd_async_logger
12
- from dodal.log import LOGGER as dodal_logger
12
+ from dodal.log import LOGGER as DODAL_LOGGER
13
13
 
14
14
  from mx_bluesky.common.utils.log import do_default_logging_setup
15
15
 
@@ -19,7 +19,7 @@ VISIT_PATH = Path("/dls_sw/i24/etc/ssx_current_visit.txt")
19
19
  # Logging set up
20
20
  SSX_LOGGER = logging.getLogger("I24serial")
21
21
  SSX_LOGGER.addHandler(logging.NullHandler())
22
- SSX_LOGGER.parent = dodal_logger
22
+ SSX_LOGGER.parent = DODAL_LOGGER
23
23
 
24
24
 
25
25
  logging_config = {
@@ -101,14 +101,14 @@ def config(
101
101
  """
102
102
  if logfile:
103
103
  logs = _get_logging_file_path() / logfile
104
- fileFormatter = logging.Formatter(
104
+ file_formatter = logging.Formatter(
105
105
  "%(asctime)s %(levelname)s: \t(%(name)s) %(message)s",
106
106
  datefmt="%d-%m-%Y %I:%M:%S",
107
107
  )
108
- FH = logging.FileHandler(logs, mode=write_mode, encoding="utf-8", delay=delayed)
109
- FH.setLevel(logging.DEBUG)
110
- FH.setFormatter(fileFormatter)
111
- SSX_LOGGER.addHandler(FH)
108
+ fh = logging.FileHandler(logs, mode=write_mode, encoding="utf-8", delay=delayed)
109
+ fh.setLevel(logging.DEBUG)
110
+ fh.setFormatter(file_formatter)
111
+ SSX_LOGGER.addHandler(fh)
112
112
  do_default_logging_setup(
113
113
  "mx-bluesky.log",
114
114
  DEFAULT_GRAYLOG_PORT,
@@ -116,8 +116,8 @@ def config(
116
116
  integrate_all_logs=False,
117
117
  )
118
118
  # Remove dodal StreamHandler to avoid duplication of messages above debug
119
- dodal_logger.removeHandler(dodal_logger.handlers[0])
120
- _integrate_bluesky_logs(dodal_logger)
119
+ DODAL_LOGGER.removeHandler(DODAL_LOGGER.handlers[0])
120
+ _integrate_bluesky_logs(DODAL_LOGGER)
121
121
 
122
122
 
123
123
  def log_on_entry(func):
@@ -151,6 +151,6 @@ def clean_up_log_config_at_end() -> MsgGenerator:
151
151
  # See https://github.com/DiamondLightSource/mx-bluesky/issues/609
152
152
  for handler in SSX_LOGGER.handlers:
153
153
  SSX_LOGGER.removeHandler(handler)
154
- for handler in dodal_logger.handlers:
155
- dodal_logger.removeHandler(handler)
154
+ for handler in DODAL_LOGGER.handlers:
155
+ DODAL_LOGGER.removeHandler(handler)
156
156
  yield from bps.null()
@@ -3,7 +3,7 @@
3
3
  "scaley": 10011.9,
4
4
  "scalez": 10000.0,
5
5
  "skew": 0.025,
6
- "Sx_dir": 1,
7
- "Sy_dir": 1,
8
- "Sz_dir": 1
6
+ "sx_dir": 1,
7
+ "sy_dir": 1,
8
+ "sz_dir": 1
9
9
  }
@@ -38,15 +38,3 @@ def caput(pv, new_val):
38
38
  else:
39
39
  a = Popen(["caput", pv, str(new_val)], stdout=PIPE, stderr=PIPE)
40
40
  a_stdout, a_stderr = a.communicate()
41
-
42
-
43
- def evaluate(val):
44
- try:
45
- int(val)
46
- return int(val)
47
- except Exception:
48
- try:
49
- float(val)
50
- return float(val)
51
- except ValueError:
52
- return val
@@ -4,36 +4,17 @@ PVs
4
4
  # Now with Eiger goodness
5
5
  """
6
6
 
7
- import os
8
- import sys
9
-
10
-
11
- def __show__(name):
12
- """Checks available variables given a string, uses first two letters"""
13
- for things in globals():
14
- if name[:2].lower() in things.lower():
15
- print("Available:", things)
16
- print()
17
-
18
-
19
- def __which__():
20
- """Return script directory, used for finding which pv.py you are running"""
21
- pathname, scriptname = os.path.split(sys.argv[0])
22
- print("Current dir: " + os.path.abspath(pathname))
23
- print("path to pv.py: ")
24
-
25
-
26
7
  requested_transmission = "BL24I-OP-ATTN-01:T2A:SETVAL1"
27
8
 
28
9
 
29
10
  # Eiger
30
11
  eiger_filepath = "BL24I-EA-EIGER-01:CAM:FilePath"
31
12
  eiger_filename = "BL24I-EA-EIGER-01:CAM:FileName"
32
- eiger_ODfilepath = "BL24I-EA-EIGER-01:OD:FilePath"
33
- eiger_ODfilename = "BL24I-EA-EIGER-01:OD:FileName"
34
- eiger_seqID = "BL24I-EA-EIGER-01:CAM:SequenceId"
13
+ eiger_od_filepath = "BL24I-EA-EIGER-01:OD:FilePath"
14
+ eiger_od_filename = "BL24I-EA-EIGER-01:OD:FileName"
15
+ eiger_seq_id = "BL24I-EA-EIGER-01:CAM:SequenceId"
35
16
  eiger_numimages = "BL24I-EA-EIGER-01:CAM:NumImages"
36
- eiger_ODnumcapture = "BL24I-EA-EIGER-01:OD:NumCapture"
17
+ eiger_od_num_capture = "BL24I-EA-EIGER-01:OD:NumCapture"
37
18
  eiger_numexpimage = "BL24I-EA-EIGER-01:CAM:NumExposures"
38
19
  eiger_acquiretime = "BL24I-EA-EIGER-01:CAM:AcquireTime"
39
20
  eiger_acquireperiod = "BL24I-EA-EIGER-01:CAM:AcquirePeriod"
@@ -47,37 +28,37 @@ eiger_stream = "BL24I-EA-EIGER-01:CAM:StreamEnable"
47
28
  eiger_monitor = "BL24I-EA-EIGER-01:CAM:MonitorEnable"
48
29
  eiger_datasource = "BL24I-EA-EIGER-01:CAM:DataSource"
49
30
  eiger_statuspoll = "BL24I-EA-EIGER-01:CAM:ReadStatus.SCAN"
50
- eiger_ROImode = "BL24I-EA-EIGER-01:CAM:ROIMode"
31
+ eiger_roi_mode = "BL24I-EA-EIGER-01:CAM:ROIMode"
51
32
  eiger_ff = "BL24I-EA-EIGER-01:CAM:FlatfieldApplied"
52
33
  eiger_compress = "BL24I-EA-EIGER-01:CAM:FWCompression"
53
34
  eiger_compresstype = "BL24I-EA-EIGER-01:CAM:CompressionAlgo"
54
- eiger_ODcompress = "BL24I-EA-EIGER-01:OD:Compression"
55
- eiger_ODdatatype = "BL24I-EA-EIGER-01:OD:DataType"
35
+ eiger_od_compress = "BL24I-EA-EIGER-01:OD:Compression"
36
+ eiger_od_datatype = "BL24I-EA-EIGER-01:OD:DataType"
56
37
  eiger_bitdepthrbv = "BL24I-EA-EIGER-01:CAM:BitDepthImage_RBV"
57
38
  eiger_countmode = "BL24I-EA-EIGER-01:CAM:CountingMode"
58
39
  eiger_autosum = "BL24I-EA-EIGER-01:CAM:AutoSummation"
59
40
  eiger_hdrdetail = "BL24I-EA-EIGER-01:CAM:StreamHdrDetail"
60
41
  eiger_hdrappen = "BL24I-EA-EIGER-01:CAM:StreamHdrAppendix"
61
- eiger_ODcapture = "BL24I-EA-EIGER-01:OD:Capture"
42
+ eiger_od_capture = "BL24I-EA-EIGER-01:OD:Capture"
62
43
  eiger_acquire = "BL24I-EA-EIGER-01:CAM:Acquire"
63
44
  eiger_wavelength = "BL24I-EA-EIGER-01:CAM:Wavelength"
64
45
  eiger_detdist = "BL24I-EA-EIGER-01:CAM:DetDist"
65
46
  eiger_beamx = "BL24I-EA-EIGER-01:CAM:BeamX"
66
47
  eiger_beamy = "BL24I-EA-EIGER-01:CAM:BeamY"
67
48
  eiger_omegaincr = "BL24I-EA-EIGER-01:CAM:OmegaIncr"
68
- eiger_ODfilenameRBV = "BL24I-EA-EIGER-01:OD:FP:FileName_RBV"
49
+ eiger_od_filename_rbv = "BL24I-EA-EIGER-01:OD:FP:FileName_RBV"
69
50
 
70
51
  # BPMs
71
52
  qbpm1_inten = "BL24I-DI-QBPM-01:INTEN"
72
- qbpm1_intenN = "BL24I-DI-QBPM-01:INTEN_N"
53
+ qbpm1_inten_n = "BL24I-DI-QBPM-01:INTEN_N"
73
54
  qbpm2_inten = "BL24I-DI-QBPM-02:INTEN"
74
- qbpm2_intenN = "BL24I-DI-QBPM-02:INTEN_N"
55
+ qbpm2_inten_n = "BL24I-DI-QBPM-02:INTEN_N"
75
56
  qbpm3_inten = "BL24I-DI-QBPM-03:INTEN"
76
- qbpm3_intenN = "BL24I-DI-QBPM-03:INTEN_N"
57
+ qbpm3_inten_n = "BL24I-DI-QBPM-03:INTEN_N"
77
58
  # Cividec
78
59
  cividec_x = "BL24I-AL-XBPM-01:XS"
79
60
  cividec_y = "BL24I-AL-XBPM-01:YS"
80
- cividec_sumI = "BL24I-EA-XBPM-01:SumAll:Sigma_RBV"
61
+ cividec_sum_i = "BL24I-EA-XBPM-01:SumAll:Sigma_RBV"
81
62
  cividec_beamx = "BL24I-EA-XBPM-01:PosX:MeanValue_RBV"
82
63
  cividec_beamy = "BL24I-EA-XBPM-01:PosY:MeanValue_RBV"
83
64
  # Lancelot
@@ -22,15 +22,15 @@ class Eiger:
22
22
  det_y_threshold = 70.0
23
23
  det_y_target = 59.0
24
24
 
25
- class pv:
25
+ class PV:
26
26
  detector_distance = pv.eiger_detdist
27
27
  wavelength = pv.eiger_wavelength
28
28
  transmission = "BL24I-EA-PILAT-01:cam1:FilterTransm"
29
- filenameRBV = pv.eiger_ODfilenameRBV
30
- file_name = pv.eiger_ODfilename
31
- file_path = pv.eiger_ODfilepath
29
+ filename_rbv = pv.eiger_od_filename_rbv
30
+ file_name = pv.eiger_od_filename
31
+ file_path = pv.eiger_od_filepath
32
32
  file_template = None
33
- sequence_id = pv.eiger_seqID
33
+ sequence_id = pv.eiger_seq_id
34
34
  beamx = pv.eiger_beamx
35
35
  beamy = pv.eiger_beamy
36
36
  bit_depth = pv.eiger_bitdepthrbv