mx-bluesky 1.1.0__py3-none-any.whl → 1.4.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 (81) hide show
  1. mx_bluesky/__init__.py +8 -3
  2. mx_bluesky/__main__.py +12 -7
  3. mx_bluesky/_version.py +2 -2
  4. mx_bluesky/beamlines/i04/callbacks/murko_callback.py +14 -4
  5. mx_bluesky/beamlines/i04/thawing_plan.py +48 -10
  6. mx_bluesky/beamlines/i24/serial/__init__.py +3 -0
  7. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +68 -90
  8. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +1 -1
  9. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +104 -126
  10. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +139 -162
  11. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +25 -36
  12. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +24 -34
  13. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +14 -11
  14. mx_bluesky/beamlines/i24/serial/log.py +58 -49
  15. mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
  16. mx_bluesky/beamlines/i24/serial/run_extruder.sh +30 -5
  17. mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +31 -7
  18. mx_bluesky/beamlines/i24/serial/run_serial.py +24 -8
  19. mx_bluesky/beamlines/i24/serial/setup_beamline/ca.py +0 -2
  20. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +1 -1
  21. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +8 -18
  22. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +2 -2
  23. mx_bluesky/common/__init__.py +0 -0
  24. mx_bluesky/common/device_setup_plans/read_hardware_for_setup.py +14 -0
  25. mx_bluesky/common/parameters/components.py +221 -0
  26. mx_bluesky/common/parameters/constants.py +133 -0
  27. mx_bluesky/common/plans/__init__.py +1 -0
  28. mx_bluesky/common/plans/do_fgs.py +121 -0
  29. mx_bluesky/common/utils/log.py +116 -0
  30. mx_bluesky/{hyperion → common/utils}/tracing.py +2 -2
  31. mx_bluesky/hyperion/__main__.py +11 -9
  32. mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +31 -26
  33. mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +6 -12
  34. mx_bluesky/hyperion/device_setup_plans/setup_oav.py +6 -12
  35. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +1 -2
  36. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +48 -17
  37. mx_bluesky/hyperion/device_setup_plans/smargon.py +6 -6
  38. mx_bluesky/hyperion/device_setup_plans/utils.py +13 -2
  39. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +4 -4
  40. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +9 -0
  41. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +59 -108
  42. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +7 -5
  43. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +46 -0
  44. mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +19 -18
  45. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +8 -5
  46. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +4 -4
  47. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +17 -17
  48. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +241 -0
  49. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +24 -181
  50. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +6 -4
  51. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +3 -11
  52. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +1 -2
  53. mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +18 -0
  54. mx_bluesky/hyperion/external_interaction/callbacks/common/ispyb_mapping.py +1 -9
  55. mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +18 -13
  56. mx_bluesky/hyperion/external_interaction/callbacks/ispyb_callback_base.py +32 -15
  57. mx_bluesky/hyperion/external_interaction/callbacks/log_uid_tag_callback.py +1 -1
  58. mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +3 -5
  59. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +4 -3
  60. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +23 -18
  61. mx_bluesky/hyperion/external_interaction/config_server.py +22 -10
  62. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_store.py +1 -1
  63. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_utils.py +0 -2
  64. mx_bluesky/hyperion/external_interaction/nexus/nexus_utils.py +2 -2
  65. mx_bluesky/hyperion/external_interaction/nexus/write_nexus.py +1 -1
  66. mx_bluesky/hyperion/log.py +0 -84
  67. mx_bluesky/hyperion/parameters/components.py +1 -242
  68. mx_bluesky/hyperion/parameters/constants.py +22 -118
  69. mx_bluesky/hyperion/parameters/gridscan.py +20 -11
  70. mx_bluesky/hyperion/parameters/load_centre_collect.py +50 -0
  71. mx_bluesky/hyperion/parameters/robot_load.py +16 -0
  72. mx_bluesky/hyperion/parameters/rotation.py +9 -5
  73. mx_bluesky/hyperion/utils/utils.py +17 -0
  74. mx_bluesky/hyperion/utils/validation.py +5 -6
  75. {mx_bluesky-1.1.0.dist-info → mx_bluesky-1.4.0.dist-info}/METADATA +4 -2
  76. {mx_bluesky-1.1.0.dist-info → mx_bluesky-1.4.0.dist-info}/RECORD +80 -70
  77. {mx_bluesky-1.1.0.dist-info → mx_bluesky-1.4.0.dist-info}/WHEEL +1 -1
  78. mx_bluesky/example.py +0 -19
  79. {mx_bluesky-1.1.0.dist-info → mx_bluesky-1.4.0.dist-info}/LICENSE +0 -0
  80. {mx_bluesky-1.1.0.dist-info → mx_bluesky-1.4.0.dist-info}/entry_points.txt +0 -0
  81. {mx_bluesky-1.1.0.dist-info → mx_bluesky-1.4.0.dist-info}/top_level.txt +0 -0
@@ -4,7 +4,6 @@ This version changed to python3 March2020 by RLO
4
4
  """
5
5
 
6
6
  import json
7
- import logging
8
7
  import re
9
8
  import shutil
10
9
  import sys
@@ -23,7 +22,6 @@ from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
23
22
  from dodal.devices.i24.i24_detector_motion import DetectorMotion
24
23
  from dodal.devices.i24.pmac import PMAC, EncReset, LaserSettings
25
24
 
26
- from mx_bluesky.beamlines.i24.serial import log
27
25
  from mx_bluesky.beamlines.i24.serial.fixed_target import (
28
26
  i24ssx_Chip_Mapping_py3v1 as mapping,
29
27
  )
@@ -35,6 +33,11 @@ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
35
33
  Fiducials,
36
34
  MappingType,
37
35
  )
36
+ from mx_bluesky.beamlines.i24.serial.log import (
37
+ SSX_LOGGER,
38
+ _read_visit_directory_from_file,
39
+ log_on_entry,
40
+ )
38
41
  from mx_bluesky.beamlines.i24.serial.parameters import get_chip_format
39
42
  from mx_bluesky.beamlines.i24.serial.parameters.constants import (
40
43
  CS_FILES_PATH,
@@ -49,8 +52,6 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_detector import (
49
52
  get_detector_type,
50
53
  )
51
54
 
52
- logger = logging.getLogger("I24ssx.chip_manager")
53
-
54
55
  # An approximation of the chip size for the move during fiducials alignment.
55
56
  CHIP_MOVES = {
56
57
  ChipType.Oxford: 25.40,
@@ -65,22 +66,15 @@ PUMP_REPEAT_PV = pv.me14e_gp4
65
66
  MAP_FILEPATH_PV = pv.me14e_gp5
66
67
 
67
68
 
68
- def setup_logging():
69
- # Log should now change name daily.
70
- logfile = time.strftime("i24fixedtarget_%d%B%y.log").lower()
71
- log.config(logfile)
72
-
73
-
74
- @log.log_on_entry
69
+ @log_on_entry
75
70
  def initialise_stages(
76
71
  pmac: PMAC = inject("pmac"),
77
72
  ) -> MsgGenerator:
78
73
  """Initialise the portable stages PVs, usually used only once right after setting \
79
74
  up the stages either after use at different facility.
80
75
  """
81
- setup_logging()
82
76
  group = "initialise_stages"
83
- logger.info("Setting velocity, acceleration and limits for stages")
77
+ SSX_LOGGER.info("Setting velocity, acceleration and limits for stages")
84
78
 
85
79
  yield from bps.abs_set(pmac.x.velocity, 20, group=group)
86
80
  yield from bps.abs_set(pmac.y.velocity, 20, group=group)
@@ -110,18 +104,18 @@ def initialise_stages(
110
104
  caput(pv.pilat_cbftemplate, 0)
111
105
 
112
106
  sleep(0.1)
113
- logger.info("Clearing General Purpose PVs 1-120")
107
+ SSX_LOGGER.info("Clearing General Purpose PVs 1-120")
114
108
  for i in range(4, 120):
115
109
  pvar = "ME14E-MO-IOC-01:GP" + str(i)
116
110
  caput(pvar, 0)
117
111
  sys.stdout.write(".")
118
112
  sys.stdout.flush()
119
113
 
120
- logger.info("Initialisation of the stages complete")
114
+ SSX_LOGGER.info("Initialisation of the stages complete")
121
115
  yield from bps.wait(group=group)
122
116
 
123
117
 
124
- @log.log_on_entry
118
+ @log_on_entry
125
119
  def write_parameter_file(
126
120
  detector_stage: DetectorMotion,
127
121
  ) -> MsgGenerator:
@@ -129,7 +123,9 @@ def write_parameter_file(
129
123
  # Create directory if it doesn't yet exist.
130
124
  param_path.mkdir(parents=True, exist_ok=True)
131
125
 
132
- logger.info(f"Writing Parameter File: {(param_path / PARAM_FILE_NAME).as_posix()}")
126
+ SSX_LOGGER.info(
127
+ f"Writing Parameter File: {(param_path / PARAM_FILE_NAME).as_posix()}"
128
+ )
133
129
 
134
130
  filename = caget(pv.me14e_chip_name)
135
131
  det_type = yield from get_detector_type(detector_stage)
@@ -146,12 +142,12 @@ def write_parameter_file(
146
142
  # Note for future reference. Appending underscore causes more hassle and
147
143
  # high probability of users accidentally overwriting data. Use a dash
148
144
  filename = filename + "-"
149
- logger.debug(
145
+ SSX_LOGGER.debug(
150
146
  f"Requested filename ends in a number. Appended dash: {filename}"
151
147
  )
152
148
 
153
149
  params_dict = {
154
- "visit": log._read_visit_directory_from_file().as_posix(), # noqa
150
+ "visit": _read_visit_directory_from_file().as_posix(), # noqa
155
151
  "directory": caget(pv.me14e_filepath),
156
152
  "filename": filename,
157
153
  "exposure_time_s": caget(pv.me14e_exptime),
@@ -172,13 +168,13 @@ def write_parameter_file(
172
168
  with open(param_path / PARAM_FILE_NAME, "w") as f:
173
169
  json.dump(params_dict, f, indent=4)
174
170
 
175
- logger.info("Information written to file \n")
176
- logger.info(pformat(params_dict))
171
+ SSX_LOGGER.info("Information written to file \n")
172
+ SSX_LOGGER.info(pformat(params_dict))
177
173
 
178
174
  if map_type == MappingType.Full:
179
175
  # This step creates some header files (.addr, .spec), containing the parameters,
180
176
  # that are only needed when full mapping is in use.
181
- logger.info("Full mapping in use. Running start up now.")
177
+ SSX_LOGGER.info("Full mapping in use. Running start up now.")
182
178
  startup.run()
183
179
  yield from bps.null()
184
180
 
@@ -207,13 +203,12 @@ def scrape_pvar_file(fid: str, pvar_dir: Path = PVAR_FILE_PATH):
207
203
  return block_start_list
208
204
 
209
205
 
210
- @log.log_on_entry
206
+ @log_on_entry
211
207
  def define_current_chip(
212
208
  chipid: str = "oxford",
213
209
  pmac: PMAC = inject("pmac"),
214
210
  ) -> MsgGenerator:
215
- setup_logging()
216
- logger.debug("Run load stock map for just the first block")
211
+ SSX_LOGGER.debug("Run load stock map for just the first block")
217
212
  yield from load_stock_map("Just The First Block")
218
213
  """
219
214
  Not sure what this is for:
@@ -221,43 +216,41 @@ def define_current_chip(
221
216
  caput(pv.me14e_gp2, 1)
222
217
  """
223
218
  chip_type = int(caget(CHIPTYPE_PV))
224
- logger.info(f"Chip type:{chip_type} Chipid:{chipid}")
219
+ SSX_LOGGER.info(f"Chip type:{chip_type} Chipid:{chipid}")
225
220
  if chipid == "oxford":
226
221
  caput(CHIPTYPE_PV, 0)
227
222
 
228
223
  with open(PVAR_FILE_PATH / f"{chipid}.pvar") as f:
229
- logger.info(f"Opening {chipid}.pvar")
224
+ SSX_LOGGER.info(f"Opening {chipid}.pvar")
230
225
  for line in f.readlines():
231
226
  if line.startswith("#"):
232
227
  continue
233
228
  line_from_file = line.rstrip("\n")
234
- logger.info(f"{line_from_file}")
229
+ SSX_LOGGER.info(f"{line_from_file}")
235
230
  yield from bps.abs_set(pmac.pmac_string, line_from_file)
236
231
 
237
232
 
238
- @log.log_on_entry
233
+ @log_on_entry
239
234
  def save_screen_map() -> MsgGenerator:
240
- setup_logging()
241
235
  litemap_path: Path = LITEMAP_PATH
242
236
  litemap_path.mkdir(parents=True, exist_ok=True)
243
237
 
244
- logger.info(f"Saving {litemap_path.as_posix()} currentchip.map")
238
+ SSX_LOGGER.info(f"Saving {litemap_path.as_posix()} currentchip.map")
245
239
  with open(litemap_path / "currentchip.map", "w") as f:
246
- logger.debug("Printing only blocks with block_val == 1")
240
+ SSX_LOGGER.debug("Printing only blocks with block_val == 1")
247
241
  for x in range(1, 82):
248
242
  block_str = "ME14E-MO-IOC-01:GP%i" % (x + 10)
249
243
  block_val = int(caget(block_str))
250
244
  if block_val == 1:
251
- logger.info("%s %d" % (block_str, block_val))
245
+ SSX_LOGGER.info("%s %d" % (block_str, block_val))
252
246
  line = "%02dstatus P3%02d1 \t%s\n" % (x, x, block_val)
253
247
  f.write(line)
254
248
  yield from bps.null()
255
249
 
256
250
 
257
- @log.log_on_entry
251
+ @log_on_entry
258
252
  def upload_parameters(pmac: PMAC = inject("pmac")) -> MsgGenerator:
259
- setup_logging()
260
- logger.info("Uploading Parameters for Oxford Chip to the GeoBrick")
253
+ SSX_LOGGER.info("Uploading Parameters for Oxford Chip to the GeoBrick")
261
254
  caput(CHIPTYPE_PV, 0)
262
255
  width = 8
263
256
 
@@ -266,8 +259,8 @@ def upload_parameters(pmac: PMAC = inject("pmac")) -> MsgGenerator:
266
259
  raise FileNotFoundError(f"The file {map_file} has not yet been created")
267
260
 
268
261
  with open(map_file) as f:
269
- logger.info(f"Chipid {ChipType.Oxford}")
270
- logger.info(f"width {width}")
262
+ SSX_LOGGER.info(f"Chipid {ChipType.Oxford}")
263
+ SSX_LOGGER.info(f"width {width}")
271
264
  x = 1
272
265
  for line in f.readlines()[: width**2]:
273
266
  cols = line.split()
@@ -288,14 +281,13 @@ def upload_parameters(pmac: PMAC = inject("pmac")) -> MsgGenerator:
288
281
  yield from bps.abs_set(pmac.pmac_string, s, wait=True)
289
282
  sleep(0.02)
290
283
 
291
- logger.warning("Automatic Setting Mapping Type to Lite has been disabled")
292
- logger.debug("Upload parameters done.")
284
+ SSX_LOGGER.warning("Automatic Setting Mapping Type to Lite has been disabled")
285
+ SSX_LOGGER.debug("Upload parameters done.")
293
286
  yield from bps.null()
294
287
 
295
288
 
296
- @log.log_on_entry
289
+ @log_on_entry
297
290
  def upload_full(pmac: PMAC | None = None) -> MsgGenerator:
298
- setup_logging()
299
291
  if not pmac:
300
292
  pmac = i24.pmac()
301
293
 
@@ -310,19 +302,18 @@ def upload_full(pmac: PMAC | None = None) -> MsgGenerator:
310
302
  for _j in range(2):
311
303
  pmac_list.append(f.pop(0).rstrip("\n"))
312
304
  writeline = " ".join(pmac_list)
313
- logger.info(f"{writeline}")
305
+ SSX_LOGGER.info(f"{writeline}")
314
306
  yield from bps.abs_set(pmac.pmac_string, writeline, wait=True)
315
307
  yield from bps.sleep(0.02)
316
- logger.debug("Upload fullmap done")
308
+ SSX_LOGGER.debug("Upload fullmap done")
317
309
  yield from bps.null()
318
310
 
319
311
 
320
- @log.log_on_entry
312
+ @log_on_entry
321
313
  def load_stock_map(map_choice: str = "clear") -> MsgGenerator:
322
314
  # TODO See https://github.com/DiamondLightSource/mx_bluesky/issues/122
323
- setup_logging()
324
- logger.info("Adjusting Lite Map EDM Screen")
325
- logger.debug("Please wait, adjusting lite map")
315
+ SSX_LOGGER.info("Adjusting Lite Map EDM Screen")
316
+ SSX_LOGGER.debug("Please wait, adjusting lite map")
326
317
  #
327
318
  r33 = [19, 18, 17, 26, 31, 32, 33, 24, 25]
328
319
  r55 = [9, 10, 11, 12, 13, 16, 27, 30, 41, 40, 39, 38, 37, 34, 23, 20] + r33
@@ -505,25 +496,24 @@ def load_stock_map(map_choice: str = "clear") -> MsgGenerator:
505
496
  map_dict["half1"] = half1
506
497
  map_dict["half2"] = half2
507
498
 
508
- logger.info("Clearing GP 10-74") # Actually 11-44
499
+ SSX_LOGGER.info("Clearing GP 10-74") # Actually 11-44
509
500
  for i in range(1, 65):
510
501
  pvar = "ME14E-MO-IOC-01:GP" + str(i + 10)
511
502
  caput(pvar, 0)
512
503
  sys.stdout.write(".")
513
504
  sys.stdout.flush()
514
- logger.info("Map cleared")
515
- logger.info(f"Loading Map Choice {map_choice}")
505
+ SSX_LOGGER.info("Map cleared")
506
+ SSX_LOGGER.info(f"Loading Map Choice {map_choice}")
516
507
  for i in map_dict[map_choice]:
517
508
  pvar = "ME14E-MO-IOC-01:GP" + str(i + 10)
518
509
  caput(pvar, 1)
519
- logger.debug("Load stock map done.")
510
+ SSX_LOGGER.debug("Load stock map done.")
520
511
  yield from bps.null()
521
512
 
522
513
 
523
- @log.log_on_entry
514
+ @log_on_entry
524
515
  def load_lite_map() -> MsgGenerator:
525
- setup_logging()
526
- logger.debug("Run load stock map with 'clear' setting.")
516
+ SSX_LOGGER.debug("Run load stock map with 'clear' setting.")
527
517
  yield from load_stock_map("clear")
528
518
  # fmt: off
529
519
  # 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
@@ -540,7 +530,7 @@ def load_lite_map() -> MsgGenerator:
540
530
  # fmt: on
541
531
  chip_type = int(caget(CHIPTYPE_PV))
542
532
  if chip_type in [ChipType.Oxford, ChipType.OxfordInner]:
543
- logger.info("Oxford Block Order")
533
+ SSX_LOGGER.info("Oxford Block Order")
544
534
  rows = ["A", "B", "C", "D", "E", "F", "G", "H"]
545
535
  columns = list(range(1, 10))
546
536
  btn_names = {}
@@ -559,7 +549,7 @@ def load_lite_map() -> MsgGenerator:
559
549
  elif flip is True:
560
550
  z = 8 - (y + 1)
561
551
  else:
562
- logger.warning("Problem in Chip Grid Creation")
552
+ SSX_LOGGER.warning("Problem in Chip Grid Creation")
563
553
  break
564
554
  button_name = str(row) + str(column)
565
555
  lab_num = x * 8 + z
@@ -570,9 +560,9 @@ def load_lite_map() -> MsgGenerator:
570
560
  raise ValueError(f"{chip_type=} unrecognised")
571
561
 
572
562
  litemap_fid = f"{caget(MAP_FILEPATH_PV)}.lite"
573
- logger.info("Please wait, loading LITE map")
574
- logger.debug("Loading Lite Map")
575
- logger.info("Opening %s" % (LITEMAP_PATH / litemap_fid))
563
+ SSX_LOGGER.info("Please wait, loading LITE map")
564
+ SSX_LOGGER.debug("Loading Lite Map")
565
+ SSX_LOGGER.info("Opening %s" % (LITEMAP_PATH / litemap_fid))
576
566
  with open(LITEMAP_PATH / litemap_fid) as fh:
577
567
  f = fh.readlines()
578
568
  for line in f:
@@ -581,57 +571,57 @@ def load_lite_map() -> MsgGenerator:
581
571
  yesno = entry[1]
582
572
  block_num = block_dict[block_name]
583
573
  pvar = "ME14E-MO-IOC-01:GP" + str(int(block_num) + 10)
584
- logger.info(f"Block: {block_name} \tScanned: {yesno} \tPVAR: {pvar}")
585
- logger.debug("Load lite map done")
574
+ SSX_LOGGER.info(f"Block: {block_name} \tScanned: {yesno} \tPVAR: {pvar}")
575
+ SSX_LOGGER.debug("Load lite map done")
586
576
  yield from bps.null()
587
577
 
588
578
 
589
- @log.log_on_entry
579
+ @log_on_entry
590
580
  def load_full_map() -> MsgGenerator:
591
- setup_logging()
581
+ from matplotlib import pyplot as plt
582
+
592
583
  params = startup.read_parameter_file()
593
584
 
594
585
  fullmap_fid = FULLMAP_PATH / f"{caget(MAP_FILEPATH_PV)}.spec"
595
- logger.info(f"Opening {fullmap_fid}")
596
- mapping.plot_file(fullmap_fid, params.chip.chip_type.value)
586
+ SSX_LOGGER.info(f"Opening {fullmap_fid}")
587
+ mapping.plot_file(plt, fullmap_fid, params.chip.chip_type.value)
597
588
  mapping.convert_chip_to_hex(fullmap_fid, params.chip.chip_type.value)
598
589
  shutil.copy2(fullmap_fid.with_suffix(".full"), FULLMAP_PATH / "currentchip.full")
599
- logger.info(
590
+ SSX_LOGGER.info(
600
591
  "Copying {} to {}".format(
601
592
  fullmap_fid.with_suffix(".full"), FULLMAP_PATH / "currentchip.full"
602
593
  )
603
594
  )
604
- logger.debug("Load full map done")
595
+ SSX_LOGGER.debug("Load full map done")
605
596
  yield from bps.null()
606
597
 
607
598
 
608
- @log.log_on_entry
599
+ @log_on_entry
609
600
  def moveto(place: str = "origin", pmac: PMAC = inject("pmac")) -> MsgGenerator:
610
- setup_logging()
611
- logger.info(f"Move to: {place}")
601
+ SSX_LOGGER.info(f"Move to: {place}")
612
602
  if place == Fiducials.zero:
613
- logger.info("Chip aspecific move.")
603
+ SSX_LOGGER.info("Chip aspecific move.")
614
604
  yield from bps.trigger(pmac.to_xyz_zero)
615
605
  return
616
606
 
617
607
  chip_type = ChipType(int(caget(CHIPTYPE_PV)))
618
- logger.info(f"Chip type is {chip_type}")
608
+ SSX_LOGGER.info(f"Chip type is {chip_type}")
619
609
  if chip_type not in list(ChipType):
620
- logger.warning("Unknown chip_type move")
610
+ SSX_LOGGER.warning("Unknown chip_type move")
621
611
  return
622
612
 
623
- logger.info(f"{str(chip_type)} Move")
613
+ SSX_LOGGER.info(f"{str(chip_type)} Move")
624
614
  chip_move = CHIP_MOVES[chip_type]
625
615
 
626
616
  if place == Fiducials.origin:
627
- yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0)
617
+ yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
628
618
  if place == Fiducials.fid1:
629
- yield from bps.mv(pmac.x, chip_move, pmac.y, 0.0)
619
+ yield from bps.mv(pmac.x, chip_move, pmac.y, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
630
620
  if place == Fiducials.fid2:
631
- yield from bps.mv(pmac.x, 0.0, pmac.y, chip_move)
621
+ yield from bps.mv(pmac.x, 0.0, pmac.y, chip_move) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
632
622
 
633
623
 
634
- @log.log_on_entry
624
+ @log_on_entry
635
625
  def moveto_preset(
636
626
  place: str,
637
627
  pmac: PMAC = inject("pmac"),
@@ -639,15 +629,13 @@ def moveto_preset(
639
629
  backlight: DualBacklight = inject("backlight"),
640
630
  det_stage: DetectorMotion = inject("detector_motion"),
641
631
  ) -> MsgGenerator:
642
- setup_logging()
643
-
644
632
  # Non Chip Specific Move
645
633
  if place == "zero":
646
- logger.info(f"Moving to {place}")
634
+ SSX_LOGGER.info(f"Moving to {place}")
647
635
  yield from bps.trigger(pmac.to_xyz_zero)
648
636
 
649
637
  elif place == "load_position":
650
- logger.info("load position")
638
+ SSX_LOGGER.info("load position")
651
639
  yield from bps.abs_set(
652
640
  beamstop.pos_select, BeamstopPositions.ROBOT, group=place
653
641
  )
@@ -656,9 +644,9 @@ def moveto_preset(
656
644
  yield from bps.wait(group=place)
657
645
 
658
646
  elif place == "collect_position":
659
- logger.info("collect position")
647
+ SSX_LOGGER.info("collect position")
660
648
  caput(pv.me14e_filter, 20)
661
- yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0, pmac.z, 0.0)
649
+ yield from bps.mv(pmac.x, 0.0, pmac.y, 0.0, pmac.z, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
662
650
  yield from bps.abs_set(
663
651
  beamstop.pos_select, BeamstopPositions.DATA_COLLECTION, group=place
664
652
  )
@@ -666,53 +654,52 @@ def moveto_preset(
666
654
  yield from bps.wait(group=place)
667
655
 
668
656
  elif place == "microdrop_position":
669
- logger.info("microdrop align position")
670
- yield from bps.mv(pmac.x, 6.0, pmac.y, -7.8, pmac.z, 0.0)
657
+ SSX_LOGGER.info("microdrop align position")
658
+ yield from bps.mv(pmac.x, 6.0, pmac.y, -7.8, pmac.z, 0.0) # type: ignore # See: https://github.com/bluesky/bluesky/issues/1809
671
659
 
672
660
 
673
- @log.log_on_entry
661
+ @log_on_entry
674
662
  def laser_control(laser_setting: str, pmac: PMAC = inject("pmac")) -> MsgGenerator:
675
- setup_logging()
676
- logger.info(f"Move to: {laser_setting}")
663
+ SSX_LOGGER.info(f"Move to: {laser_setting}")
677
664
  if laser_setting == "laser1on": # these are in laser edm
678
- logger.info("Laser 1 /BNC2 shutter is open")
665
+ SSX_LOGGER.info("Laser 1 /BNC2 shutter is open")
679
666
  # Use M712 = 0 if triggering on falling edge. M712 =1 if on rising edge
680
667
  # Be sure to also change laser1off
681
668
  # caput(pv.me14e_pmac_str, ' M712=0 M711=1')
682
669
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_1_ON, wait=True)
683
670
 
684
671
  elif laser_setting == "laser1off":
685
- logger.info("Laser 1 shutter is closed")
672
+ SSX_LOGGER.info("Laser 1 shutter is closed")
686
673
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_1_OFF, wait=True)
687
674
 
688
675
  elif laser_setting == "laser2on":
689
- logger.info("Laser 2 / BNC3 shutter is open")
676
+ SSX_LOGGER.info("Laser 2 / BNC3 shutter is open")
690
677
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_2_ON, wait=True)
691
678
 
692
679
  elif laser_setting == "laser2off":
693
- logger.info("Laser 2 shutter is closed")
680
+ SSX_LOGGER.info("Laser 2 shutter is closed")
694
681
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_2_OFF, wait=True)
695
682
 
696
683
  elif laser_setting == "laser1burn":
697
684
  led_burn_time = caget(pv.me14e_gp103)
698
- logger.info("Laser 1 on")
699
- logger.info(f"Burn time is {led_burn_time} s")
685
+ SSX_LOGGER.info("Laser 1 on")
686
+ SSX_LOGGER.info(f"Burn time is {led_burn_time} s")
700
687
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_1_ON, wait=True)
701
- yield from bps.sleep(led_burn_time)
702
- logger.info("Laser 1 off")
688
+ yield from bps.sleep(float(led_burn_time))
689
+ SSX_LOGGER.info("Laser 1 off")
703
690
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_1_OFF, wait=True)
704
691
 
705
692
  elif laser_setting == "laser2burn":
706
693
  led_burn_time = caget(pv.me14e_gp109)
707
- logger.info("Laser 2 on")
708
- logger.info(f"burntime {led_burn_time} s")
694
+ SSX_LOGGER.info("Laser 2 on")
695
+ SSX_LOGGER.info(f"burntime {led_burn_time} s")
709
696
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_2_ON, wait=True)
710
- yield from bps.sleep(led_burn_time)
711
- logger.info("Laser 2 off")
697
+ yield from bps.sleep(float(led_burn_time))
698
+ SSX_LOGGER.info("Laser 2 off")
712
699
  yield from bps.abs_set(pmac.laser, LaserSettings.LASER_2_OFF, wait=True)
713
700
 
714
701
 
715
- @log.log_on_entry
702
+ @log_on_entry
716
703
  def scrape_mtr_directions(motor_file_path: Path = CS_FILES_PATH):
717
704
  with open(motor_file_path / "motor_direction.txt") as f:
718
705
  lines = f.readlines()
@@ -726,13 +713,12 @@ def scrape_mtr_directions(motor_file_path: Path = CS_FILES_PATH):
726
713
  mtr3_dir = float(line.split("=")[1])
727
714
  else:
728
715
  continue
729
- logger.debug(f"mt1_dir {mtr1_dir} mtr2_dir {mtr2_dir} mtr3_dir {mtr3_dir}")
716
+ SSX_LOGGER.debug(f"mt1_dir {mtr1_dir} mtr2_dir {mtr2_dir} mtr3_dir {mtr3_dir}")
730
717
  return mtr1_dir, mtr2_dir, mtr3_dir
731
718
 
732
719
 
733
- @log.log_on_entry
720
+ @log_on_entry
734
721
  def fiducial(point: int = 1, pmac: PMAC = inject("pmac")) -> MsgGenerator:
735
- setup_logging()
736
722
  scale = 10000.0 # noqa: F841
737
723
 
738
724
  mtr1_dir, mtr2_dir, mtr3_dir = scrape_mtr_directions(CS_FILES_PATH)
@@ -743,18 +729,18 @@ def fiducial(point: int = 1, pmac: PMAC = inject("pmac")) -> MsgGenerator:
743
729
 
744
730
  output_param_path = PARAM_FILE_PATH_FT
745
731
  output_param_path.mkdir(parents=True, exist_ok=True)
746
- logger.info(f"Writing Fiducial File {output_param_path}/fiducial_{point}.txt")
747
- logger.info("MTR\tRBV\tRAW\tCorr\tf_value")
748
- logger.info("MTR1\t%1.4f\t%i" % (rbv_1, mtr1_dir))
749
- logger.info("MTR2\t%1.4f\t%i" % (rbv_2, mtr2_dir))
750
- logger.info("MTR3\t%1.4f\t%i" % (rbv_3, mtr3_dir))
732
+ SSX_LOGGER.info(f"Writing Fiducial File {output_param_path}/fiducial_{point}.txt")
733
+ SSX_LOGGER.info("MTR\tRBV\tRAW\tCorr\tf_value")
734
+ SSX_LOGGER.info("MTR1\t%1.4f\t%i" % (rbv_1, mtr1_dir))
735
+ SSX_LOGGER.info("MTR2\t%1.4f\t%i" % (rbv_2, mtr2_dir))
736
+ SSX_LOGGER.info("MTR3\t%1.4f\t%i" % (rbv_3, mtr3_dir))
751
737
 
752
738
  with open(output_param_path / f"fiducial_{point}.txt", "w") as f:
753
739
  f.write("MTR\tRBV\tCorr\n")
754
740
  f.write("MTR1\t%1.4f\t%i\n" % (rbv_1, mtr1_dir))
755
741
  f.write("MTR2\t%1.4f\t%i\n" % (rbv_2, mtr2_dir))
756
742
  f.write("MTR3\t%1.4f\t%i" % (rbv_3, mtr3_dir))
757
- logger.info(f"Fiducial {point} set.")
743
+ SSX_LOGGER.info(f"Fiducial {point} set.")
758
744
  yield from bps.null()
759
745
 
760
746
 
@@ -769,7 +755,7 @@ def scrape_mtr_fiducials(
769
755
  return f_x, f_y, f_z
770
756
 
771
757
 
772
- @log.log_on_entry
758
+ @log_on_entry
773
759
  def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
774
760
  """
775
761
  Coordinate system.
@@ -800,28 +786,27 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
800
786
  This should be measured in situ prior to expriment, ie. measure by hand using
801
787
  opposite and adjacent RBV after calibration of scale factors.
802
788
  """
803
- setup_logging()
804
789
  chip_type = int(caget(CHIPTYPE_PV))
805
790
  fiducial_dict = {}
806
791
  fiducial_dict[0] = [25.400, 25.400]
807
792
  fiducial_dict[1] = [24.600, 24.600]
808
793
  fiducial_dict[2] = [25.400, 25.400]
809
794
  fiducial_dict[3] = [18.25, 18.25]
810
- logger.info(f"Chip type is {chip_type} with size {fiducial_dict[chip_type]}")
795
+ SSX_LOGGER.info(f"Chip type is {chip_type} with size {fiducial_dict[chip_type]}")
811
796
 
812
797
  mtr1_dir, mtr2_dir, mtr3_dir = scrape_mtr_directions()
813
798
  f1_x, f1_y, f1_z = scrape_mtr_fiducials(1)
814
799
  f2_x, f2_y, f2_z = scrape_mtr_fiducials(2)
815
- logger.info(f"mtr1 direction: {mtr1_dir}")
816
- logger.info(f"mtr2 direction: {mtr2_dir}")
817
- logger.info(f"mtr3 direction: {mtr3_dir}")
800
+ SSX_LOGGER.info(f"mtr1 direction: {mtr1_dir}")
801
+ SSX_LOGGER.info(f"mtr2 direction: {mtr2_dir}")
802
+ SSX_LOGGER.info(f"mtr3 direction: {mtr3_dir}")
818
803
 
819
804
  # Scale parameters saved in json file
820
805
  try:
821
806
  with open(CS_FILES_PATH / "cs_maker.json") as fh:
822
807
  cs_info = json.load(fh)
823
808
  except json.JSONDecodeError:
824
- logger.error("Invalid JSON file.")
809
+ SSX_LOGGER.error("Invalid JSON file.")
825
810
  raise
826
811
 
827
812
  try:
@@ -837,7 +822,7 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
837
822
  int(cs_info["Sz_dir"]),
838
823
  )
839
824
  except KeyError:
840
- logger.error("Wrong or missing key in the cs json file.")
825
+ SSX_LOGGER.error("Wrong or missing key in the cs json file.")
841
826
  raise
842
827
 
843
828
  def check_dir(val):
@@ -854,21 +839,21 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
854
839
  Sz2 = f2_x / fiducial_dict[chip_type][1]
855
840
  Sz = Sz_dir * ((Sz1 + Sz2) / 2)
856
841
  Cz = np.sqrt(1 - Sz**2)
857
- logger.info(f"Sz1 , {Sz1:1.4f}, {np.degrees(np.arcsin(Sz1)):1.4f}")
858
- logger.info(f"Sz2 , {Sz2:1.4f}, {np.degrees(np.arcsin(Sz2)):1.4f}")
859
- logger.info(f"Sz , {Sz:1.4f}, {np.degrees(np.arcsin(Sz)):1.4f}")
860
- logger.info(f"Cz , {Cz:1.4f}, {np.degrees(np.arcsin(Cz)):1.4f}")
842
+ SSX_LOGGER.info(f"Sz1 , {Sz1:1.4f}, {np.degrees(np.arcsin(Sz1)):1.4f}")
843
+ SSX_LOGGER.info(f"Sz2 , {Sz2:1.4f}, {np.degrees(np.arcsin(Sz2)):1.4f}")
844
+ SSX_LOGGER.info(f"Sz , {Sz:1.4f}, {np.degrees(np.arcsin(Sz)):1.4f}")
845
+ SSX_LOGGER.info(f"Cz , {Cz:1.4f}, {np.degrees(np.arcsin(Cz)):1.4f}")
861
846
  # Rotation Around Y
862
847
  Sy = Sy_dir * f1_z / fiducial_dict[chip_type][0]
863
848
  Cy = np.sqrt(1 - Sy**2)
864
- logger.info(f"Sy , {Sy:1.4f}, {np.degrees(np.arcsin(Sy)):1.4f}")
865
- logger.info(f"Cy , {Cy:1.4f}, {np.degrees(np.arcsin(Cy)):1.4f}")
849
+ SSX_LOGGER.info(f"Sy , {Sy:1.4f}, {np.degrees(np.arcsin(Sy)):1.4f}")
850
+ SSX_LOGGER.info(f"Cy , {Cy:1.4f}, {np.degrees(np.arcsin(Cy)):1.4f}")
866
851
  # Rotation Around X
867
852
  # If stages upsidedown (I24) change sign of Sx
868
853
  Sx = Sx_dir * f2_z / fiducial_dict[chip_type][1]
869
854
  Cx = np.sqrt(1 - Sx**2)
870
- logger.info(f"Sx , {Sx:1.4f}, {np.degrees(np.arcsin(Sx)):1.4f}")
871
- logger.info(f"Cx , {Cx:1.4f}, {np.degrees(np.arcsin(Cx)):1.4f}")
855
+ SSX_LOGGER.info(f"Sx , {Sx:1.4f}, {np.degrees(np.arcsin(Sx)):1.4f}")
856
+ SSX_LOGGER.info(f"Cx , {Cx:1.4f}, {np.degrees(np.arcsin(Cx)):1.4f}")
872
857
 
873
858
  x1factor = mtr1_dir * scalex * (Cy * Cz)
874
859
  y1factor = mtr2_dir * scaley * (-1.0 * Cx * Sz)
@@ -882,15 +867,15 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
882
867
  y3factor = mtr2_dir * scaley * ((Cx * Sy * Sz) + (Sx * Cz))
883
868
  z3factor = mtr3_dir * scalez * (Cx * Cy)
884
869
 
885
- logger.info(f"Skew being used is: {skew:1.4f}")
870
+ SSX_LOGGER.info(f"Skew being used is: {skew:1.4f}")
886
871
  s1 = np.degrees(np.arcsin(Sz1))
887
872
  s2 = np.degrees(np.arcsin(Sz2))
888
873
  rot = np.degrees(np.arcsin((Sz1 + Sz2) / 2))
889
874
  calc_skew = (s1 - rot) - (s2 - rot)
890
- logger.info(f"s1:{s1:1.4f} s2:{s2:1.4f} rot:{rot:1.4f}")
891
- logger.info(f"Calculated rotation from current fiducials is: {rot:1.4f}")
892
- logger.info(f"Calculated Skew from current fiducials is: {calc_skew:1.4f}")
893
- logger.info("Calculated Skew has been known to have the wrong sign")
875
+ SSX_LOGGER.info(f"s1:{s1:1.4f} s2:{s2:1.4f} rot:{rot:1.4f}")
876
+ SSX_LOGGER.info(f"Calculated rotation from current fiducials is: {rot:1.4f}")
877
+ SSX_LOGGER.info(f"Calculated Skew from current fiducials is: {calc_skew:1.4f}")
878
+ SSX_LOGGER.info("Calculated Skew has been known to have the wrong sign")
894
879
 
895
880
  sinD = np.sin((skew / 2) * (np.pi / 180))
896
881
  cosD = np.cos((skew / 2) * (np.pi / 180))
@@ -902,16 +887,16 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
902
887
  cs1 = f"#1->{new_x1factor:+1.3f}X{new_y1factor:+1.3f}Y{z1factor:+1.3f}Z"
903
888
  cs2 = f"#2->{new_x2factor:+1.3f}X{new_y2factor:+1.3f}Y{z2factor:+1.3f}Z"
904
889
  cs3 = f"#3->{x3factor:+1.3f}X{y3factor:+1.3f}Y{z3factor:+1.3f}Z"
905
- logger.info(f"PMAC strings. \ncs1: {cs1} \ncs2: {cs2}cs3: {cs3}")
906
- logger.info(
890
+ SSX_LOGGER.info(f"PMAC strings. \ncs1: {cs1} \ncs2: {cs2}cs3: {cs3}")
891
+ SSX_LOGGER.info(
907
892
  """These next values should be 1.
908
893
  This is the sum of the squares of the factors divided by their scale."""
909
894
  )
910
895
  sqfact1 = np.sqrt(x1factor**2 + y1factor**2 + z1factor**2) / scalex
911
896
  sqfact2 = np.sqrt(x2factor**2 + y2factor**2 + z2factor**2) / scaley
912
897
  sqfact3 = np.sqrt(x3factor**2 + y3factor**2 + z3factor**2) / scalez
913
- logger.info(f"{sqfact1:1.4f} \n {sqfact2:1.4f} \n {sqfact3:1.4f}")
914
- logger.debug("Long wait, please be patient")
898
+ SSX_LOGGER.info(f"{sqfact1:1.4f} \n {sqfact2:1.4f} \n {sqfact3:1.4f}")
899
+ SSX_LOGGER.debug("Long wait, please be patient")
915
900
  yield from bps.trigger(pmac.to_xyz_zero)
916
901
  sleep(2.5)
917
902
  yield from set_pmac_strings_for_cs(pmac, {"cs1": cs1, "cs2": cs2, "cs3": cs3})
@@ -919,27 +904,26 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
919
904
  sleep(0.1)
920
905
  yield from bps.trigger(pmac.home, wait=True)
921
906
  sleep(0.1)
922
- logger.debug(f"Chip_type is {chip_type}")
907
+ SSX_LOGGER.debug(f"Chip_type is {chip_type}")
923
908
  if chip_type == 0:
924
909
  yield from bps.abs_set(pmac.pmac_string, "!x0.4y0.4", wait=True)
925
910
  sleep(0.1)
926
911
  yield from bps.trigger(pmac.home, wait=True)
927
912
  else:
928
913
  yield from bps.trigger(pmac.home, wait=True)
929
- logger.debug("CSmaker done.")
914
+ SSX_LOGGER.debug("CSmaker done.")
930
915
  yield from bps.null()
931
916
 
932
917
 
933
918
  def cs_reset(pmac: PMAC = inject("pmac")) -> MsgGenerator:
934
919
  """Used to clear CS when using Custom Chip"""
935
- setup_logging()
936
920
  cs1 = "#1->10000X+0Y+0Z"
937
921
  cs2 = "#2->+0X-10000Y+0Z"
938
922
  cs3 = "#3->0X+0Y-10000Z"
939
923
  strg = "\n".join([cs1, cs2, cs3])
940
924
  print(strg)
941
925
  yield from set_pmac_strings_for_cs(pmac, {"cs1": cs1, "cs2": cs2, "cs3": cs3})
942
- logger.debug("CSreset Done")
926
+ SSX_LOGGER.debug("CSreset Done")
943
927
  yield from bps.null()
944
928
 
945
929
 
@@ -964,16 +948,15 @@ def set_pmac_strings_for_cs(pmac: PMAC, cs_str: dict):
964
948
  yield from bps.abs_set(pmac.pmac_string, cs_str["cs3"], wait=True)
965
949
 
966
950
 
967
- @log.log_on_entry
951
+ @log_on_entry
968
952
  def pumpprobe_calc() -> MsgGenerator:
969
953
  # TODO See https://github.com/DiamondLightSource/mx_bluesky/issues/122
970
- setup_logging()
971
- logger.info("Calculate and show exposure and dwell time for each option.")
954
+ SSX_LOGGER.info("Calculate and show exposure and dwell time for each option.")
972
955
  exptime = float(caget(pv.me14e_exptime))
973
956
  pumpexptime = float(caget(pv.me14e_gp103))
974
957
  movetime = 0.008
975
- logger.info(f"X-ray exposure time {exptime}")
976
- logger.info(f"Laser dwell time {pumpexptime}")
958
+ SSX_LOGGER.info(f"X-ray exposure time {exptime}")
959
+ SSX_LOGGER.info(f"Laser dwell time {pumpexptime}")
977
960
  repeat1 = 2 * 20 * (movetime + (pumpexptime + exptime) / 2)
978
961
  repeat2 = 4 * 20 * (movetime + (pumpexptime + exptime) / 2)
979
962
  repeat3 = 6 * 20 * (movetime + (pumpexptime + exptime) / 2)
@@ -988,48 +971,42 @@ def pumpprobe_calc() -> MsgGenerator:
988
971
  ):
989
972
  rounded = round(repeat, 4)
990
973
  caput(pv_name, rounded)
991
- logger.info(f"Repeat ({pv_name}): {rounded} s")
992
- logger.debug("PP calculations done")
974
+ SSX_LOGGER.info(f"Repeat ({pv_name}): {rounded} s")
975
+ SSX_LOGGER.debug("PP calculations done")
993
976
  yield from bps.null()
994
977
 
995
978
 
996
- @log.log_on_entry
979
+ @log_on_entry
997
980
  def block_check(pmac: PMAC = inject("pmac")) -> MsgGenerator:
998
- setup_logging()
999
981
  # TODO See https://github.com/DiamondLightSource/mx_bluesky/issues/117
1000
982
  caput(pv.me14e_gp9, 0)
1001
983
  while True:
1002
984
  if int(caget(pv.me14e_gp9)) == 0:
1003
985
  chip_type = int(caget(CHIPTYPE_PV))
1004
986
  if chip_type == ChipType.Minichip:
1005
- logger.info("Oxford mini chip in use.")
987
+ SSX_LOGGER.info("Oxford mini chip in use.")
1006
988
  block_start_list = scrape_pvar_file("minichip_oxford.pvar")
1007
989
  elif chip_type == ChipType.Custom:
1008
- logger.error("This is a custom chip, no block check available!")
990
+ SSX_LOGGER.error("This is a custom chip, no block check available!")
1009
991
  raise ValueError(
1010
992
  "Chip type set to 'custom', which has no block check."
1011
993
  "If not using a custom chip, please double check chip in the GUI."
1012
994
  )
1013
995
  else:
1014
- logger.warning("Default is Oxford chip block start list.")
996
+ SSX_LOGGER.warning("Default is Oxford chip block start list.")
1015
997
  block_start_list = scrape_pvar_file("oxford.pvar")
1016
998
  for entry in block_start_list:
1017
999
  if int(caget(pv.me14e_gp9)) != 0:
1018
- logger.warning("Block Check Aborted")
1000
+ SSX_LOGGER.warning("Block Check Aborted")
1019
1001
  sleep(1.0)
1020
1002
  break
1021
1003
  block, x, y = entry
1022
- logger.debug(f"Block: {block} -> (x={x} y={y})")
1004
+ SSX_LOGGER.debug(f"Block: {block} -> (x={x} y={y})")
1023
1005
  yield from bps.abs_set(pmac.pmac_string, f"!x{x}y{y}", wait=True)
1024
1006
  time.sleep(0.4)
1025
1007
  else:
1026
- logger.warning("Block Check Aborted due to GP 9 not equalling 0")
1008
+ SSX_LOGGER.warning("Block Check Aborted due to GP 9 not equalling 0")
1027
1009
  break
1028
1010
  break
1029
- logger.debug("Block check done")
1011
+ SSX_LOGGER.debug("Block check done")
1030
1012
  yield from bps.null()
1031
-
1032
-
1033
- # setup_logging now called in all functions.
1034
- # TODO See logging issue on blueapi
1035
- # https://github.com/DiamondLightSource/blueapi/issues/494