mx-bluesky 1.4.0__py3-none-any.whl → 1.4.1a0__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 (63) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/i04/thawing_plan.py +1 -1
  3. mx_bluesky/beamlines/i24/serial/dcid.py +19 -21
  4. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +2 -2
  5. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +1 -4
  6. mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
  7. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +14 -24
  8. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +18 -76
  9. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +0 -199
  10. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +4 -6
  11. mx_bluesky/beamlines/i24/serial/log.py +1 -1
  12. mx_bluesky/beamlines/i24/serial/parameters/constants.py +0 -1
  13. mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +4 -3
  14. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +78 -80
  15. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +1 -2
  16. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +24 -26
  17. mx_bluesky/beamlines/i24/serial/write_nexus.py +11 -11
  18. mx_bluesky/common/external_interaction/config_server.py +46 -0
  19. mx_bluesky/common/parameters/components.py +52 -15
  20. mx_bluesky/common/parameters/constants.py +6 -1
  21. mx_bluesky/common/parameters/gridscan.py +94 -0
  22. mx_bluesky/{hyperion → common}/parameters/robot_load.py +2 -2
  23. mx_bluesky/common/plans/do_fgs.py +2 -2
  24. mx_bluesky/common/utils/log.py +2 -0
  25. mx_bluesky/hyperion/__main__.py +2 -1
  26. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +4 -4
  27. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +1 -1
  28. mx_bluesky/hyperion/experiment_plans/__init__.py +4 -0
  29. mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +83 -0
  30. mx_bluesky/hyperion/experiment_plans/common/xrc_result.py +47 -0
  31. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +9 -9
  32. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +131 -89
  33. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +50 -18
  34. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +52 -10
  35. mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +2 -2
  36. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +3 -9
  37. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +2 -2
  38. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +36 -17
  39. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +2 -2
  40. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +6 -10
  41. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +46 -11
  42. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +18 -3
  43. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +2 -3
  44. mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -0
  45. mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +15 -15
  46. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +3 -1
  47. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +5 -3
  48. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +5 -2
  49. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +5 -4
  50. mx_bluesky/hyperion/external_interaction/config_server.py +8 -37
  51. mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +1 -1
  52. mx_bluesky/hyperion/parameters/components.py +4 -9
  53. mx_bluesky/hyperion/parameters/constants.py +0 -1
  54. mx_bluesky/hyperion/parameters/gridscan.py +33 -76
  55. mx_bluesky/hyperion/parameters/load_centre_collect.py +14 -9
  56. mx_bluesky/hyperion/parameters/rotation.py +15 -6
  57. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/METADATA +35 -34
  58. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/RECORD +62 -58
  59. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/WHEEL +1 -1
  60. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +0 -150
  61. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/LICENSE +0 -0
  62. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/entry_points.txt +0 -0
  63. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/top_level.txt +0 -0
mx_bluesky/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.4.0'
16
- __version_tuple__ = version_tuple = (1, 4, 0)
15
+ __version__ = version = '1.4.1a0'
16
+ __version_tuple__ = version_tuple = (1, 4, 1)
@@ -3,7 +3,7 @@ from collections.abc import Callable
3
3
  import bluesky.plan_stubs as bps
4
4
  import bluesky.preprocessors as bpp
5
5
  from bluesky.preprocessors import run_decorator, subs_decorator
6
- from dls_bluesky_core.core import MsgGenerator
6
+ from bluesky.utils import MsgGenerator
7
7
  from dodal.beamlines.i04 import MURKO_REDIS_DB, REDIS_HOST, REDIS_PASSWORD
8
8
  from dodal.common import inject
9
9
  from dodal.devices.oav.oav_detector import OAV
@@ -1,6 +1,5 @@
1
1
  import datetime
2
2
  import json
3
- import logging
4
3
  import math
5
4
  import os
6
5
  import re
@@ -10,6 +9,7 @@ from functools import lru_cache
10
9
 
11
10
  import requests
12
11
 
12
+ from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER
13
13
  from mx_bluesky.beamlines.i24.serial.parameters import SSXType
14
14
  from mx_bluesky.beamlines.i24.serial.setup_beamline import (
15
15
  Detector,
@@ -25,8 +25,6 @@ try:
25
25
  except ImportError:
26
26
  pass
27
27
 
28
- logger = logging.getLogger("I24ssx.DCID")
29
-
30
28
 
31
29
  # Collection start/end script to kick off analysis
32
30
  COLLECTION_START_SCRIPT = "/dls_sw/i24/scripts/RunAtStartOfCollect-i24-ssx.sh"
@@ -41,7 +39,7 @@ CREDENTIALS_LOCATION = "/scratch/ssx_dcserver.key"
41
39
  def get_auth_header() -> dict:
42
40
  """Read the credentials file and build the Authorisation header"""
43
41
  if not os.path.isfile(CREDENTIALS_LOCATION):
44
- logger.warning(
42
+ SSX_LOGGER.warning(
45
43
  "Could not read %s; attempting to proceed without credentials",
46
44
  CREDENTIALS_LOCATION,
47
45
  )
@@ -205,12 +203,12 @@ class DCID:
205
203
 
206
204
  # Log what we are doing here
207
205
  try:
208
- logger.info(
206
+ SSX_LOGGER.info(
209
207
  "BRIDGE: POST /dc --data %s",
210
208
  repr(json.dumps(data)),
211
209
  )
212
210
  except Exception:
213
- logger.info(
211
+ SSX_LOGGER.info(
214
212
  "Caught exception converting data to JSON. Data:\n%s\nVERBOSE:\n%s",
215
213
  str({k: type(v) for k, v in data.items()}),
216
214
  )
@@ -224,20 +222,20 @@ class DCID:
224
222
  )
225
223
  resp.raise_for_status()
226
224
  self.dcid = resp.json()["dataCollectionId"]
227
- logger.info("Generated DCID %s", self.dcid)
225
+ SSX_LOGGER.info("Generated DCID %s", self.dcid)
228
226
  except requests.HTTPError as e:
229
227
  self.error = True
230
- logger.error(
228
+ SSX_LOGGER.error(
231
229
  "DCID generation Failed; Reason from server: %s", e.response.text
232
230
  )
233
231
  if self.emit_errors:
234
232
  raise
235
- logger.exception("Error generating DCID: %s", e)
233
+ SSX_LOGGER.exception("Error generating DCID: %s", e)
236
234
  except Exception as e:
237
235
  self.error = True
238
236
  if self.emit_errors:
239
237
  raise
240
- logger.exception("Error generating DCID: %s", e)
238
+ SSX_LOGGER.exception("Error generating DCID: %s", e)
241
239
 
242
240
  def __int__(self):
243
241
  return self.dcid
@@ -248,13 +246,13 @@ class DCID:
248
246
  return None
249
247
  try:
250
248
  command = [COLLECTION_START_SCRIPT, str(self.dcid)]
251
- logger.info("Running %s", " ".join(command))
249
+ SSX_LOGGER.info("Running %s", " ".join(command))
252
250
  subprocess.Popen(command)
253
251
  except Exception as e:
254
252
  self.error = True
255
253
  if self.emit_errors:
256
254
  raise
257
- logger.warning("Error starting start of collect script: %s", e)
255
+ SSX_LOGGER.warning("Error starting start of collect script: %s", e)
258
256
 
259
257
  def notify_end(self):
260
258
  """Send notifications that the collection has now ended"""
@@ -262,13 +260,13 @@ class DCID:
262
260
  return
263
261
  try:
264
262
  command = [COLLECTION_END_SCRIPT, str(self.dcid)]
265
- logger.info("Running %s", " ".join(command))
263
+ SSX_LOGGER.info("Running %s", " ".join(command))
266
264
  subprocess.Popen(command)
267
265
  except Exception as e:
268
266
  self.error = True
269
267
  if self.emit_errors:
270
268
  raise
271
- logger.warning("Error running end of collect notification: %s", e)
269
+ SSX_LOGGER.warning("Error running end of collect notification: %s", e)
272
270
 
273
271
  def collection_complete(
274
272
  self, end_time: str | datetime.datetime | None = None, aborted: bool = False
@@ -285,7 +283,7 @@ class DCID:
285
283
  # end_time might be a string from time.ctime
286
284
  if isinstance(end_time, str):
287
285
  end_time = datetime.datetime.strptime(end_time, "%a %b %d %H:%M:%S %Y")
288
- logger.debug("Parsed end time: %s", end_time)
286
+ SSX_LOGGER.debug("Parsed end time: %s", end_time)
289
287
 
290
288
  if not end_time:
291
289
  end_time = datetime.datetime.now().astimezone()
@@ -302,13 +300,13 @@ class DCID:
302
300
  if self.dcid is None:
303
301
  # Print what we would have sent. This means that if something is failing,
304
302
  # we still have the data to upload in the log files.
305
- logger.info(
303
+ SSX_LOGGER.info(
306
304
  'BRIDGE: No DCID but Would PATCH "/dc/XXXX" --data=%s',
307
305
  repr(json.dumps(data)),
308
306
  )
309
307
  return
310
308
 
311
- logger.info(
309
+ SSX_LOGGER.info(
312
310
  'BRIDGE: PATCH "/dc/%s" --data=%s', self.dcid, repr(json.dumps(data))
313
311
  )
314
312
  response = requests.patch(
@@ -318,7 +316,7 @@ class DCID:
318
316
  headers=get_auth_header(),
319
317
  )
320
318
  response.raise_for_status()
321
- logger.info("Successfully updated end time for DCID %d", self.dcid)
319
+ SSX_LOGGER.info("Successfully updated end time for DCID %d", self.dcid)
322
320
  except Exception as e:
323
321
  resp_obj = getattr(e, "response", None)
324
322
  try:
@@ -333,7 +331,7 @@ class DCID:
333
331
  self.error = True
334
332
  if self.emit_errors:
335
333
  raise
336
- logger.warning("Error completing DCID: %s (%s)", e, resp_str)
334
+ SSX_LOGGER.warning("Error completing DCID: %s (%s)", e, resp_str)
337
335
 
338
336
 
339
337
  def get_pilatus_filename_template_from_pvs() -> str:
@@ -385,9 +383,9 @@ def get_beamsize() -> tuple[float | None, float | None]:
385
383
  h_mode = caget("BL24I-OP-MFM-01:G1:TARGETAPPLY")
386
384
  # Validate these and note an error otherwise
387
385
  if not v_mode.startswith("VMFM") or v_mode[4:] not in focus_modes:
388
- logger.error("Unrecognised vertical beam mode %s", v_mode)
386
+ SSX_LOGGER.error("Unrecognised vertical beam mode %s", v_mode)
389
387
  if not h_mode.startswith("HMFM") or h_mode[4:] not in focus_modes:
390
- logger.error("Unrecognised horizontal beam mode %s", h_mode)
388
+ SSX_LOGGER.error("Unrecognised horizontal beam mode %s", h_mode)
391
389
  _, h, _ = focus_modes.get(h_mode[4:], (None, None, None))
392
390
  _, _, v = focus_modes.get(v_mode[4:], (None, None, None))
393
391
 
@@ -16,7 +16,7 @@ from time import sleep
16
16
 
17
17
  import bluesky.plan_stubs as bps
18
18
  import bluesky.preprocessors as bpp
19
- from blueapi.core import MsgGenerator
19
+ from bluesky.utils import MsgGenerator
20
20
  from dodal.common import inject
21
21
  from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
22
22
  from dodal.devices.i24.aperture import Aperture
@@ -262,7 +262,7 @@ def main_extruder_plan(
262
262
  SSX_LOGGER.info("Using Eiger detector")
263
263
 
264
264
  SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
265
- Path(filepath).mkdir(parents=True)
265
+ Path(filepath).mkdir(parents=True, exist_ok=True)
266
266
 
267
267
  caput(pv.eiger_seqID, int(caget(pv.eiger_seqID)) + 1)
268
268
  SSX_LOGGER.info(f"Eiger quickshot setup: filepath {filepath}")
@@ -1270,21 +1270,18 @@ topShadowColor index 1
1270
1270
  botShadowColor index 8
1271
1271
  controlPv "ME14E-MO-IOC-01:GP2"
1272
1272
  font "arial-medium-r-18.0"
1273
- numItems 3
1273
+ numItems 2
1274
1274
  symbolTag {
1275
1275
  0 "None"
1276
1276
  1 "Mapping Lite"
1277
- 2 "Full Mapping"
1278
1277
  }
1279
1278
  symbol0 {
1280
1279
  0 "NN"
1281
1280
  1 "ML"
1282
- 2 "FM"
1283
1281
  }
1284
1282
  value0 {
1285
1283
  0 "none"
1286
1284
  1 "mappinglite"
1287
- 2 "fullmapping"
1288
1285
  }
1289
1286
  endObjectProperties
1290
1287
 
@@ -12,7 +12,6 @@ from enum import Enum, IntEnum
12
12
  class MappingType(IntEnum):
13
13
  NoMap = 0
14
14
  Lite = 1
15
- Full = 2
16
15
 
17
16
  def __str__(self) -> str:
18
17
  """Returns the mapping."""
@@ -10,7 +10,7 @@ from time import sleep
10
10
  import bluesky.plan_stubs as bps
11
11
  import bluesky.preprocessors as bpp
12
12
  import numpy as np
13
- from blueapi.core import MsgGenerator
13
+ from bluesky.utils import MsgGenerator
14
14
  from dodal.common import inject
15
15
  from dodal.devices.hutch_shutter import HutchShutter, ShutterDemand
16
16
  from dodal.devices.i24.aperture import Aperture
@@ -77,7 +77,7 @@ def calculate_collection_timeout(parameters: FixedTargetParameters) -> float:
77
77
  Returns:
78
78
  The estimated collection time, in s.
79
79
  """
80
- buffer = PMAC_MOVE_TIME * parameters.total_num_images + 2
80
+ buffer = PMAC_MOVE_TIME * parameters.total_num_images + 600
81
81
  pump_setting = parameters.pump_repeat
82
82
  collection_time = parameters.total_num_images * parameters.exposure_time_s
83
83
  if pump_setting in [
@@ -97,7 +97,7 @@ def calculate_collection_timeout(parameters: FixedTargetParameters) -> float:
97
97
  )
98
98
  if pump_setting == PumpProbeSetting.Medium1:
99
99
  # Long delay between pump and probe, with fast shutter opening and closing.
100
- timeout = timeout + SHUTTER_OPEN_TIME
100
+ timeout = timeout + SHUTTER_OPEN_TIME * parameters.total_num_images
101
101
  return timeout
102
102
 
103
103
 
@@ -234,8 +234,6 @@ def load_motion_program_data(
234
234
  SSX_LOGGER.info(f"Map type is None, setting program prefix to {prefix}")
235
235
  elif map_type == MappingType.Lite:
236
236
  prefix = 12
237
- elif map_type == MappingType.Full:
238
- prefix = 13
239
237
  else:
240
238
  SSX_LOGGER.warning(f"Unknown Map Type, map_type = {map_type}")
241
239
  return
@@ -301,14 +299,6 @@ def get_prog_num(
301
299
  SSX_LOGGER.info(f"Map type: {str(map_type)}")
302
300
  SSX_LOGGER.info("Program number: 12")
303
301
  return 12
304
- if map_type == MappingType.Full:
305
- # TODO See https://github.com/DiamondLightSource/mx-bluesky/issues/515
306
- SSX_LOGGER.info(f"Map type: {str(map_type)}")
307
- SSX_LOGGER.info("Program number: 13")
308
- # TODO once reinstated return 13
309
- msg = "Full mapping is broken and currently disabled."
310
- SSX_LOGGER.error(msg)
311
- raise ValueError(msg)
312
302
 
313
303
 
314
304
  @log_on_entry
@@ -352,14 +342,6 @@ def datasetsizei24(
352
342
  total_numb_imgs = int(np.prod(chip_format) * block_count * n_exposures)
353
343
  SSX_LOGGER.info(f"Calculated number of images: {total_numb_imgs}")
354
344
 
355
- elif map_type == MappingType.Full:
356
- SSX_LOGGER.error("Not Set Up For Full Mapping")
357
- raise ValueError("The beamline is currently not set for Full Mapping.")
358
-
359
- else:
360
- SSX_LOGGER.warning(f"Unknown Map Type, map_type = {str(map_type)}")
361
- raise ValueError("Unknown map type")
362
-
363
345
  SSX_LOGGER.info("Set PV to calculated number of images.")
364
346
  caput(pv.me14e_gp10, int(total_numb_imgs))
365
347
 
@@ -444,7 +426,11 @@ def start_i24(
444
426
  )
445
427
 
446
428
  SSX_LOGGER.debug("Arm Pilatus. Arm Zebra.")
447
- shutter_time_offset = SHUTTER_OPEN_TIME if PumpProbeSetting.Medium1 else 0.0
429
+ shutter_time_offset = (
430
+ SHUTTER_OPEN_TIME
431
+ if parameters.pump_repeat is PumpProbeSetting.Medium1
432
+ else 0.0
433
+ )
448
434
  yield from setup_zebra_for_fastchip_plan(
449
435
  zebra,
450
436
  parameters.detector_name,
@@ -467,7 +453,7 @@ def start_i24(
467
453
  SSX_LOGGER.info("Using Eiger detector")
468
454
 
469
455
  SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
470
- Path(filepath).mkdir(parents=True)
456
+ Path(filepath).mkdir(parents=True, exist_ok=True)
471
457
 
472
458
  SSX_LOGGER.info(f"Triggered Eiger setup: filepath {filepath}")
473
459
  SSX_LOGGER.info(f"Triggered Eiger setup: filename {filename}")
@@ -503,7 +489,11 @@ def start_i24(
503
489
  )
504
490
 
505
491
  SSX_LOGGER.debug("Arm Zebra.")
506
- shutter_time_offset = SHUTTER_OPEN_TIME if PumpProbeSetting.Medium1 else 0.0
492
+ shutter_time_offset = (
493
+ SHUTTER_OPEN_TIME
494
+ if parameters.pump_repeat is PumpProbeSetting.Medium1
495
+ else 0.0
496
+ )
507
497
  yield from setup_zebra_for_fastchip_plan(
508
498
  zebra,
509
499
  parameters.detector_name,
@@ -5,7 +5,6 @@ This version changed to python3 March2020 by RLO
5
5
 
6
6
  import json
7
7
  import re
8
- import shutil
9
8
  import sys
10
9
  import time
11
10
  from pathlib import Path
@@ -14,25 +13,14 @@ from time import sleep
14
13
 
15
14
  import bluesky.plan_stubs as bps
16
15
  import numpy as np
17
- from blueapi.core import MsgGenerator
18
- from dodal.beamlines import i24
16
+ from bluesky.utils import MsgGenerator
19
17
  from dodal.common import inject
20
18
  from dodal.devices.i24.beamstop import Beamstop, BeamstopPositions
21
19
  from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
22
20
  from dodal.devices.i24.i24_detector_motion import DetectorMotion
23
21
  from dodal.devices.i24.pmac import PMAC, EncReset, LaserSettings
24
22
 
25
- from mx_bluesky.beamlines.i24.serial.fixed_target import (
26
- i24ssx_Chip_Mapping_py3v1 as mapping,
27
- )
28
- from mx_bluesky.beamlines.i24.serial.fixed_target import (
29
- i24ssx_Chip_StartUp_py3v1 as startup,
30
- )
31
- from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
32
- ChipType,
33
- Fiducials,
34
- MappingType,
35
- )
23
+ from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType, Fiducials
36
24
  from mx_bluesky.beamlines.i24.serial.log import (
37
25
  SSX_LOGGER,
38
26
  _read_visit_directory_from_file,
@@ -41,7 +29,6 @@ from mx_bluesky.beamlines.i24.serial.log import (
41
29
  from mx_bluesky.beamlines.i24.serial.parameters import get_chip_format
42
30
  from mx_bluesky.beamlines.i24.serial.parameters.constants import (
43
31
  CS_FILES_PATH,
44
- FULLMAP_PATH,
45
32
  LITEMAP_PATH,
46
33
  PARAM_FILE_NAME,
47
34
  PARAM_FILE_PATH_FT,
@@ -106,6 +93,9 @@ def initialise_stages(
106
93
  sleep(0.1)
107
94
  SSX_LOGGER.info("Clearing General Purpose PVs 1-120")
108
95
  for i in range(4, 120):
96
+ if i == 100:
97
+ # Do not clear visit PV
98
+ continue
109
99
  pvar = "ME14E-MO-IOC-01:GP" + str(i)
110
100
  caput(pvar, 0)
111
101
  sys.stdout.write(".")
@@ -171,11 +161,6 @@ def write_parameter_file(
171
161
  SSX_LOGGER.info("Information written to file \n")
172
162
  SSX_LOGGER.info(pformat(params_dict))
173
163
 
174
- if map_type == MappingType.Full:
175
- # This step creates some header files (.addr, .spec), containing the parameters,
176
- # that are only needed when full mapping is in use.
177
- SSX_LOGGER.info("Full mapping in use. Running start up now.")
178
- startup.run()
179
164
  yield from bps.null()
180
165
 
181
166
 
@@ -239,11 +224,11 @@ def save_screen_map() -> MsgGenerator:
239
224
  with open(litemap_path / "currentchip.map", "w") as f:
240
225
  SSX_LOGGER.debug("Printing only blocks with block_val == 1")
241
226
  for x in range(1, 82):
242
- block_str = "ME14E-MO-IOC-01:GP%i" % (x + 10)
227
+ block_str = f"ME14E-MO-IOC-01:GP{x + 10:d}"
243
228
  block_val = int(caget(block_str))
244
229
  if block_val == 1:
245
- SSX_LOGGER.info("%s %d" % (block_str, block_val))
246
- line = "%02dstatus P3%02d1 \t%s\n" % (x, x, block_val)
230
+ SSX_LOGGER.info(f"{block_str} {block_val:d}")
231
+ line = f"{x:02d}status P3{x:02d}1 \t{block_val}\n"
247
232
  f.write(line)
248
233
  yield from bps.null()
249
234
 
@@ -286,29 +271,6 @@ def upload_parameters(pmac: PMAC = inject("pmac")) -> MsgGenerator:
286
271
  yield from bps.null()
287
272
 
288
273
 
289
- @log_on_entry
290
- def upload_full(pmac: PMAC | None = None) -> MsgGenerator:
291
- if not pmac:
292
- pmac = i24.pmac()
293
-
294
- map_file: Path = FULLMAP_PATH / "currentchip.full"
295
- if not map_file.exists():
296
- raise FileNotFoundError(f"The file {map_file} has not yet been created")
297
- with open(map_file) as fh:
298
- f = fh.readlines()
299
-
300
- for _i in range(len(f) // 2):
301
- pmac_list = []
302
- for _j in range(2):
303
- pmac_list.append(f.pop(0).rstrip("\n"))
304
- writeline = " ".join(pmac_list)
305
- SSX_LOGGER.info(f"{writeline}")
306
- yield from bps.abs_set(pmac.pmac_string, writeline, wait=True)
307
- yield from bps.sleep(0.02)
308
- SSX_LOGGER.debug("Upload fullmap done")
309
- yield from bps.null()
310
-
311
-
312
274
  @log_on_entry
313
275
  def load_stock_map(map_choice: str = "clear") -> MsgGenerator:
314
276
  # TODO See https://github.com/DiamondLightSource/mx_bluesky/issues/122
@@ -553,7 +515,7 @@ def load_lite_map() -> MsgGenerator:
553
515
  break
554
516
  button_name = str(row) + str(column)
555
517
  lab_num = x * 8 + z
556
- label = "%02.d" % (lab_num + 1)
518
+ label = f"{lab_num + 1:02d}"
557
519
  btn_names[button_name] = label
558
520
  block_dict = btn_names
559
521
  else:
@@ -576,26 +538,6 @@ def load_lite_map() -> MsgGenerator:
576
538
  yield from bps.null()
577
539
 
578
540
 
579
- @log_on_entry
580
- def load_full_map() -> MsgGenerator:
581
- from matplotlib import pyplot as plt
582
-
583
- params = startup.read_parameter_file()
584
-
585
- fullmap_fid = FULLMAP_PATH / f"{caget(MAP_FILEPATH_PV)}.spec"
586
- SSX_LOGGER.info(f"Opening {fullmap_fid}")
587
- mapping.plot_file(plt, fullmap_fid, params.chip.chip_type.value)
588
- mapping.convert_chip_to_hex(fullmap_fid, params.chip.chip_type.value)
589
- shutil.copy2(fullmap_fid.with_suffix(".full"), FULLMAP_PATH / "currentchip.full")
590
- SSX_LOGGER.info(
591
- "Copying {} to {}".format(
592
- fullmap_fid.with_suffix(".full"), FULLMAP_PATH / "currentchip.full"
593
- )
594
- )
595
- SSX_LOGGER.debug("Load full map done")
596
- yield from bps.null()
597
-
598
-
599
541
  @log_on_entry
600
542
  def moveto(place: str = "origin", pmac: PMAC = inject("pmac")) -> MsgGenerator:
601
543
  SSX_LOGGER.info(f"Move to: {place}")
@@ -731,15 +673,15 @@ def fiducial(point: int = 1, pmac: PMAC = inject("pmac")) -> MsgGenerator:
731
673
  output_param_path.mkdir(parents=True, exist_ok=True)
732
674
  SSX_LOGGER.info(f"Writing Fiducial File {output_param_path}/fiducial_{point}.txt")
733
675
  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))
676
+ SSX_LOGGER.info(f"MTR1\t{rbv_1:1.4f}\t{mtr1_dir:d}")
677
+ SSX_LOGGER.info(f"MTR2\t{rbv_2:1.4f}\t{mtr2_dir:d}")
678
+ SSX_LOGGER.info(f"MTR3\t{rbv_3:1.4f}\t{mtr3_dir:d}")
737
679
 
738
680
  with open(output_param_path / f"fiducial_{point}.txt", "w") as f:
739
681
  f.write("MTR\tRBV\tCorr\n")
740
- f.write("MTR1\t%1.4f\t%i\n" % (rbv_1, mtr1_dir))
741
- f.write("MTR2\t%1.4f\t%i\n" % (rbv_2, mtr2_dir))
742
- f.write("MTR3\t%1.4f\t%i" % (rbv_3, mtr3_dir))
682
+ f.write(f"MTR1\t{rbv_1:1.4f}\t{mtr1_dir:d}\n")
683
+ f.write(f"MTR2\t{rbv_2:1.4f}\t{mtr2_dir:d}\n")
684
+ f.write(f"MTR3\t{rbv_3:1.4f}\t{mtr3_dir:d}")
743
685
  SSX_LOGGER.info(f"Fiducial {point} set.")
744
686
  yield from bps.null()
745
687
 
@@ -901,13 +843,13 @@ def cs_maker(pmac: PMAC = inject("pmac")) -> MsgGenerator:
901
843
  sleep(2.5)
902
844
  yield from set_pmac_strings_for_cs(pmac, {"cs1": cs1, "cs2": cs2, "cs3": cs3})
903
845
  yield from bps.trigger(pmac.to_xyz_zero)
904
- sleep(0.1)
846
+ sleep(2.5)
905
847
  yield from bps.trigger(pmac.home, wait=True)
906
- sleep(0.1)
848
+ sleep(2.5)
907
849
  SSX_LOGGER.debug(f"Chip_type is {chip_type}")
908
850
  if chip_type == 0:
909
851
  yield from bps.abs_set(pmac.pmac_string, "!x0.4y0.4", wait=True)
910
- sleep(0.1)
852
+ sleep(2.5)
911
853
  yield from bps.trigger(pmac.home, wait=True)
912
854
  else:
913
855
  yield from bps.trigger(pmac.home, wait=True)