mx-bluesky 0.0.2__py3-none-any.whl → 1.1.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 (150) hide show
  1. mx_bluesky/__main__.py +1 -2
  2. mx_bluesky/_version.py +14 -2
  3. mx_bluesky/beamlines/i04/__init__.py +3 -0
  4. mx_bluesky/beamlines/i04/callbacks/murko_callback.py +45 -0
  5. mx_bluesky/beamlines/i04/thawing_plan.py +85 -0
  6. mx_bluesky/beamlines/i24/serial/__init__.py +49 -0
  7. mx_bluesky/beamlines/i24/serial/blueapi_config.yaml +12 -0
  8. mx_bluesky/{I24 → beamlines/i24}/serial/dcid.py +53 -41
  9. mx_bluesky/{I24 → beamlines/i24}/serial/extruder/EX-gui-edm/DetStage.edl +3 -4
  10. mx_bluesky/{I24 → beamlines/i24}/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +28 -32
  11. mx_bluesky/{I24 → beamlines/i24}/serial/extruder/EX-gui-edm/microdrop_alignment.edl +0 -1
  12. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +516 -0
  13. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +3 -4
  14. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/DetStage.edl +3 -4
  15. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +273 -223
  16. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/ME14E-GeneralPurpose.edl +0 -1
  17. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +12 -13
  18. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/PMAC_Command.edl +0 -1
  19. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/Shutter_Control.edl +0 -1
  20. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/microdrop_alignment.edl +0 -1
  21. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/nudgechip.edl +0 -1
  22. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +273 -143
  23. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/short1-laser.png +0 -0
  24. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/short2-laser.png +0 -0
  25. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/ft_utils.py +24 -1
  26. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +808 -0
  27. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +377 -416
  28. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +34 -40
  29. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +328 -0
  30. mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/i24ssx_moveonclick.py +66 -48
  31. mx_bluesky/{I24 → beamlines/i24}/serial/log.py +66 -19
  32. mx_bluesky/beamlines/i24/serial/parameters/__init__.py +15 -0
  33. mx_bluesky/beamlines/i24/serial/parameters/constants.py +47 -0
  34. mx_bluesky/beamlines/i24/serial/parameters/experiment_parameters.py +103 -0
  35. mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +9 -0
  36. mx_bluesky/{I24 → beamlines/i24}/serial/parameters/fixed_target/cs/motor_direction.txt +1 -1
  37. mx_bluesky/{I24 → beamlines/i24}/serial/parameters/fixed_target/pvar_files/minichip-oxford.pvar +1 -1
  38. mx_bluesky/beamlines/i24/serial/parameters/utils.py +42 -0
  39. mx_bluesky/beamlines/i24/serial/run_extruder.sh +19 -0
  40. mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +22 -0
  41. mx_bluesky/beamlines/i24/serial/run_serial.py +36 -0
  42. mx_bluesky/{I24 → beamlines/i24}/serial/set_visit_directory.sh +6 -1
  43. mx_bluesky/{I24 → beamlines/i24}/serial/setup_beamline/pv.py +1 -62
  44. mx_bluesky/{I24 → beamlines/i24}/serial/setup_beamline/pv_abstract.py +6 -7
  45. mx_bluesky/{I24 → beamlines/i24}/serial/setup_beamline/setup_beamline.py +90 -269
  46. mx_bluesky/{I24 → beamlines/i24}/serial/setup_beamline/setup_detector.py +47 -40
  47. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +459 -0
  48. mx_bluesky/beamlines/i24/serial/start_blueapi.sh +28 -0
  49. mx_bluesky/beamlines/i24/serial/write_nexus.py +105 -0
  50. mx_bluesky/example.py +4 -4
  51. mx_bluesky/hyperion/__init__.py +1 -0
  52. mx_bluesky/hyperion/__main__.py +374 -0
  53. mx_bluesky/hyperion/device_setup_plans/__init__.py +0 -0
  54. mx_bluesky/hyperion/device_setup_plans/dcm_pitch_roll_mirror_adjuster.py +134 -0
  55. mx_bluesky/hyperion/device_setup_plans/manipulate_sample.py +110 -0
  56. mx_bluesky/hyperion/device_setup_plans/position_detector.py +16 -0
  57. mx_bluesky/hyperion/device_setup_plans/read_hardware_for_setup.py +60 -0
  58. mx_bluesky/hyperion/device_setup_plans/setup_oav.py +87 -0
  59. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +210 -0
  60. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +214 -0
  61. mx_bluesky/hyperion/device_setup_plans/smargon.py +25 -0
  62. mx_bluesky/hyperion/device_setup_plans/utils.py +44 -0
  63. mx_bluesky/hyperion/device_setup_plans/xbpm_feedback.py +93 -0
  64. mx_bluesky/hyperion/exceptions.py +47 -0
  65. mx_bluesky/hyperion/experiment_plans/__init__.py +30 -0
  66. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +84 -0
  67. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +528 -0
  68. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +209 -0
  69. mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +173 -0
  70. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +81 -0
  71. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +463 -0
  72. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +119 -0
  73. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +164 -0
  74. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +322 -0
  75. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +436 -0
  76. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +68 -0
  77. mx_bluesky/hyperion/external_interaction/__init__.py +9 -0
  78. mx_bluesky/hyperion/external_interaction/callbacks/__init__.py +10 -0
  79. mx_bluesky/hyperion/external_interaction/callbacks/__main__.py +148 -0
  80. mx_bluesky/hyperion/external_interaction/callbacks/aperture_change_callback.py +22 -0
  81. mx_bluesky/hyperion/external_interaction/callbacks/common/__init__.py +0 -0
  82. mx_bluesky/hyperion/external_interaction/callbacks/common/callback_util.py +46 -0
  83. mx_bluesky/hyperion/external_interaction/callbacks/common/ispyb_mapping.py +70 -0
  84. mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +88 -0
  85. mx_bluesky/hyperion/external_interaction/callbacks/ispyb_callback_base.py +203 -0
  86. mx_bluesky/hyperion/external_interaction/callbacks/log_uid_tag_callback.py +20 -0
  87. mx_bluesky/hyperion/external_interaction/callbacks/logging_callback.py +29 -0
  88. mx_bluesky/hyperion/external_interaction/callbacks/plan_reactive_callback.py +101 -0
  89. mx_bluesky/hyperion/external_interaction/callbacks/robot_load/ispyb_callback.py +88 -0
  90. mx_bluesky/hyperion/external_interaction/callbacks/rotation/__init__.py +0 -0
  91. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +174 -0
  92. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_mapping.py +17 -0
  93. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +102 -0
  94. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/__init__.py +0 -0
  95. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +269 -0
  96. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_mapping.py +53 -0
  97. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +95 -0
  98. mx_bluesky/hyperion/external_interaction/callbacks/zocalo_callback.py +92 -0
  99. mx_bluesky/hyperion/external_interaction/config_server.py +35 -0
  100. mx_bluesky/hyperion/external_interaction/exceptions.py +13 -0
  101. mx_bluesky/hyperion/external_interaction/ispyb/__init__.py +0 -0
  102. mx_bluesky/hyperion/external_interaction/ispyb/data_model.py +95 -0
  103. mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +125 -0
  104. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_store.py +276 -0
  105. mx_bluesky/hyperion/external_interaction/ispyb/ispyb_utils.py +29 -0
  106. mx_bluesky/hyperion/external_interaction/nexus/__init__.py +0 -0
  107. mx_bluesky/hyperion/external_interaction/nexus/nexus_utils.py +148 -0
  108. mx_bluesky/hyperion/external_interaction/nexus/write_nexus.py +114 -0
  109. mx_bluesky/hyperion/log.py +99 -0
  110. mx_bluesky/hyperion/parameters/__init__.py +2 -0
  111. mx_bluesky/hyperion/parameters/cli.py +68 -0
  112. mx_bluesky/hyperion/parameters/components.py +253 -0
  113. mx_bluesky/hyperion/parameters/constants.py +158 -0
  114. mx_bluesky/hyperion/parameters/gridscan.py +216 -0
  115. mx_bluesky/hyperion/parameters/rotation.py +160 -0
  116. mx_bluesky/hyperion/resources/panda/panda-gridscan.yaml +964 -0
  117. mx_bluesky/hyperion/tracing.py +28 -0
  118. mx_bluesky/hyperion/utils/context.py +84 -0
  119. mx_bluesky/hyperion/utils/utils.py +25 -0
  120. mx_bluesky/hyperion/utils/validation.py +196 -0
  121. mx_bluesky/jupyter_example.ipynb +3 -2
  122. {mx_bluesky-0.0.2.dist-info → mx_bluesky-1.1.0.dist-info}/METADATA +53 -32
  123. mx_bluesky-1.1.0.dist-info/RECORD +136 -0
  124. {mx_bluesky-0.0.2.dist-info → mx_bluesky-1.1.0.dist-info}/WHEEL +1 -1
  125. mx_bluesky-1.1.0.dist-info/entry_points.txt +8 -0
  126. mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +0 -476
  127. mx_bluesky/I24/serial/fixed_target/FT-gui-edm/ME14E-motors.edl +0 -1874
  128. mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +0 -706
  129. mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +0 -463
  130. mx_bluesky/I24/serial/parameters/__init__.py +0 -5
  131. mx_bluesky/I24/serial/parameters/constants.py +0 -39
  132. mx_bluesky/I24/serial/parameters/fixed_target/cs/cs_maker.json +0 -9
  133. mx_bluesky/I24/serial/parameters/fixed_target/cs/fiducial_1.txt +0 -4
  134. mx_bluesky/I24/serial/parameters/fixed_target/cs/fiducial_2.txt +0 -4
  135. mx_bluesky/I24/serial/parameters/fixed_target/litemaps/currentchip.map +0 -81
  136. mx_bluesky/I24/serial/parameters/fixed_target/parameters.txt +0 -13
  137. mx_bluesky/I24/serial/run_serial.py +0 -52
  138. mx_bluesky/I24/serial/write_nexus.py +0 -113
  139. mx_bluesky-0.0.2.dist-info/RECORD +0 -58
  140. mx_bluesky-0.0.2.dist-info/entry_points.txt +0 -4
  141. /mx_bluesky/{I24 → beamlines}/__init__.py +0 -0
  142. /mx_bluesky/{I24/serial → beamlines/i24}/__init__.py +0 -0
  143. /mx_bluesky/{I24 → beamlines/i24}/serial/extruder/__init__.py +0 -0
  144. /mx_bluesky/{I24 → beamlines/i24}/serial/fixed_target/__init__.py +0 -0
  145. /mx_bluesky/{I24 → beamlines/i24}/serial/parameters/fixed_target/pvar_files/oxford.pvar +0 -0
  146. /mx_bluesky/{I24 → beamlines/i24}/serial/run_ssx.sh +0 -0
  147. /mx_bluesky/{I24 → beamlines/i24}/serial/setup_beamline/__init__.py +0 -0
  148. /mx_bluesky/{I24 → beamlines/i24}/serial/setup_beamline/ca.py +0 -0
  149. {mx_bluesky-0.0.2.dist-info → mx_bluesky-1.1.0.dist-info}/LICENSE +0 -0
  150. {mx_bluesky-0.0.2.dist-info → mx_bluesky-1.1.0.dist-info}/top_level.txt +0 -0
@@ -1,463 +0,0 @@
1
- """
2
- Startup utilities for chip
3
-
4
- This version changed to python3 March2020 by RLO
5
- """
6
- from __future__ import annotations
7
-
8
- import logging
9
- import os
10
- import string
11
- import time
12
- from pathlib import Path
13
- from typing import Dict, List
14
-
15
- import numpy as np
16
-
17
- from mx_bluesky.I24.serial import log
18
- from mx_bluesky.I24.serial.fixed_target.ft_utils import ChipType
19
- from mx_bluesky.I24.serial.parameters.constants import (
20
- HEADER_FILES_PATH,
21
- PARAM_FILE_PATH_FT,
22
- )
23
-
24
- logger = logging.getLogger("I24ssx.chip_startup")
25
-
26
-
27
- def setup_logging():
28
- # Log should now change name daily.
29
- logfile = time.strftime("i24fixedtarget_%d%B%y.log").lower()
30
- log.config(logfile)
31
-
32
-
33
- def scrape_parameter_file(param_path: Path | str = PARAM_FILE_PATH_FT):
34
- if not isinstance(param_path, Path):
35
- param_path = Path(param_path)
36
-
37
- with open(param_path / "parameters.txt", "r") as filein:
38
- f = filein.readlines()
39
- for line in f:
40
- entry = line.rstrip().split()
41
- if "chip_name" in entry[0].lower():
42
- chip_name = entry[1]
43
- elif line.startswith("visit"):
44
- visit = entry[1]
45
- elif line.startswith("sub_dir"):
46
- sub_dir = entry[1]
47
- elif line.startswith("protein_name"):
48
- sub_dir = entry[1]
49
- elif "n_exposures" in entry[0].lower():
50
- n_exposures = int(entry[1])
51
- elif "chip_type" in entry[0].lower():
52
- chip_type = int(entry[1])
53
- elif "map_type" in entry[0].lower():
54
- map_type = int(entry[1])
55
- elif "pump_repeat" in entry[0].lower():
56
- pump_repeat = int(entry[1])
57
-
58
- for line in f:
59
- entry = line.rstrip().split()
60
- if "pumpexptime" == entry[0].lower().strip():
61
- pumpexptime = float(entry[1])
62
- if "exptime" in entry[0].lower():
63
- exptime = float(entry[1])
64
- if "dcdetdist" in entry[0].lower():
65
- dcdetdist = float(entry[1])
66
- if "prepumpexptime" in entry[0].lower():
67
- prepumpexptime = float(entry[1])
68
- if "pumpdelay" in entry[0].lower():
69
- pumpdelay = float(entry[1])
70
- if "det_type" in entry[0].lower():
71
- det_type = entry[1]
72
- return (
73
- chip_name,
74
- visit,
75
- sub_dir,
76
- n_exposures,
77
- chip_type,
78
- map_type,
79
- pump_repeat,
80
- pumpexptime,
81
- pumpdelay,
82
- exptime,
83
- dcdetdist,
84
- prepumpexptime,
85
- det_type,
86
- )
87
-
88
-
89
- def read_parameters(
90
- param_path: Path | str = PARAM_FILE_PATH_FT, filename: str | None = None
91
- ) -> Dict[str, str]:
92
- """
93
- Read the parameter file into a lookup dictionary.
94
-
95
- Does the same thing as scrape_parameter_file except doesn't rely on you
96
- getting the order of arguments right every time (or having to load every one
97
- if you don't need them all).
98
-
99
- Args:
100
- filename: The file to read. If None, will load from default location.
101
-
102
- Returns:
103
- A dictionary with a string entry for every key in the file.
104
- """
105
- if not isinstance(param_path, Path):
106
- param_path = Path(param_path)
107
- if filename is None:
108
- filename = "parameters.txt"
109
- datafile = param_path / filename
110
- data = datafile.read_text()
111
- args = {}
112
- for line in data.splitlines():
113
- key, value = line.split(maxsplit=1)
114
- args[key.lower()] = value
115
- return args
116
-
117
-
118
- @log.log_on_entry
119
- def fiducials(chip_type: int):
120
- if chip_type in [ChipType.Oxford, ChipType.OxfordInner, ChipType.Minichip]:
121
- fiducial_list: list = []
122
- # No fiducial for custom
123
- elif chip_type == ChipType.Custom:
124
- logger.warning("No fiducials for custom chip")
125
- else:
126
- logger.warning("Unknown chip_type, %s, in fiducials" % chip_type)
127
- return fiducial_list
128
-
129
-
130
- @log.log_on_entry
131
- def get_format(chip_type: int):
132
- if chip_type == ChipType.Oxford:
133
- w2w = 0.125
134
- b2b_horz = 0.800
135
- b2b_vert = 0.800
136
- chip_format = [8, 8, 20, 20]
137
- elif chip_type == ChipType.OxfordInner:
138
- w2w = 0.600
139
- b2b_horz = 0.0
140
- b2b_vert = 0.0
141
- chip_format = [1, 1, 25, 25]
142
- elif chip_type == ChipType.Minichip:
143
- w2w = 0.125
144
- b2b_horz = 0
145
- b2b_vert = 0
146
- chip_format = [1, 1, 20, 20]
147
- else:
148
- msg = "Unknown chip_type, %s" % chip_type
149
- logger.error(msg)
150
- raise ValueError(msg)
151
- cell_format = chip_format + [w2w, b2b_horz, b2b_vert]
152
- logger.info("Cell format for chip type %s: %s" % (chip_type, cell_format))
153
- return cell_format
154
-
155
-
156
- def get_xy(addr: str, chip_type: int):
157
- entry = addr.split("_")[-2:]
158
- R, C = entry[0][0], entry[0][1]
159
- r2, c2 = entry[1][0], entry[1][1]
160
- blockR = string.ascii_uppercase.index(R)
161
- blockC = int(C) - 1
162
- lowercase_list = list(string.ascii_lowercase + string.ascii_uppercase + "0")
163
- windowR = lowercase_list.index(r2)
164
- windowC = lowercase_list.index(c2)
165
-
166
- (
167
- x_block_num,
168
- y_block_num,
169
- x_window_num,
170
- y_window_num,
171
- w2w,
172
- b2b_horz,
173
- b2b_vert,
174
- ) = get_format(chip_type)
175
-
176
- x = (blockC * b2b_horz) + (blockC * (x_window_num - 1) * w2w) + (windowC * w2w)
177
- y = (blockR * b2b_vert) + (blockR * (y_window_num - 1) * w2w) + (windowR * w2w)
178
- return x, y
179
-
180
-
181
- def pathli(l_in=[], way="typewriter", reverse=False):
182
- if reverse is True:
183
- li = list(reversed(l_in))
184
- else:
185
- li = list(l_in)
186
- long_list = []
187
- if li:
188
- if way == "typewriter":
189
- for i in range(len(li) ** 2):
190
- long_list.append(li[i % len(li)])
191
- elif way == "snake":
192
- lr = list(reversed(li))
193
- for rep in range(len(li)):
194
- if rep % 2 == 0:
195
- long_list += li
196
- else:
197
- long_list += lr
198
- elif way == "snake53":
199
- lr = list(reversed(li))
200
- for rep in range(53):
201
- if rep % 2 == 0:
202
- long_list += li
203
- else:
204
- long_list += lr
205
- elif way == "expand":
206
- for entry in li:
207
- for rep in range(len(li)):
208
- long_list.append(entry)
209
- elif way == "expand28":
210
- for entry in li:
211
- for rep in range(28):
212
- long_list.append(entry)
213
- elif way == "expand25":
214
- for entry in li:
215
- for rep in range(25):
216
- long_list.append(entry)
217
- else:
218
- logger.warning("No known path, way = %s" % way)
219
- else:
220
- logger.warning("No list written")
221
- return long_list
222
-
223
-
224
- def zippum(list_1_args, list_2_args):
225
- list_1, type_1, reverse_1 = list_1_args
226
- list_2, type_2, reverse_2 = list_2_args
227
- A_path = pathli(list_1, type_1, reverse_1)
228
- B_path = pathli(list_2, type_2, reverse_2)
229
- zipped_list = []
230
- for a, b in zip(A_path, B_path):
231
- zipped_list.append(a + b)
232
- return zipped_list
233
-
234
-
235
- def get_alphanumeric(chip_type):
236
- cell_format = get_format(chip_type)
237
- blk_num = cell_format[0]
238
- wnd_num = cell_format[2]
239
- uppercase_list = list(string.ascii_uppercase)[:blk_num]
240
- lowercase_list = list(string.ascii_lowercase + string.ascii_uppercase + "0")[
241
- :wnd_num
242
- ]
243
- number_list = [str(x) for x in range(1, blk_num + 1)]
244
-
245
- block_list = zippum([uppercase_list, "expand", 0], [number_list, "typewriter", 0])
246
- window_list = zippum(
247
- [lowercase_list, "expand", 0], [lowercase_list, "typewriter", 0]
248
- )
249
-
250
- alphanumeric_list = []
251
- for block in block_list:
252
- for window in window_list:
253
- alphanumeric_list.append(block + "_" + window)
254
- logger.info("Length of alphanumeric list = %s" % len(alphanumeric_list))
255
- return alphanumeric_list
256
-
257
-
258
- @log.log_on_entry
259
- def get_shot_order(chip_type):
260
- cell_format = get_format(chip_type)
261
- blk_num = cell_format[0]
262
- wnd_num = cell_format[2]
263
- uppercase_list = list(string.ascii_uppercase)[:blk_num]
264
- number_list = [str(x) for x in range(1, blk_num + 1)]
265
- lowercase_list = list(string.ascii_lowercase + string.ascii_uppercase + "0")[
266
- :wnd_num
267
- ]
268
-
269
- block_list = zippum([uppercase_list, "snake", 0], [number_list, "expand", 0])
270
- window_dn = zippum([lowercase_list, "expand", 0], [lowercase_list, "snake", 0])
271
- window_up = zippum([lowercase_list, "expand", 1], [lowercase_list, "snake", 0])
272
-
273
- switch = 0
274
- count = 0
275
- collect_list = []
276
- for block in block_list:
277
- if switch == 0:
278
- for window in window_dn:
279
- collect_list.append(block + "_" + window)
280
- count += 1
281
- if count == blk_num:
282
- count = 0
283
- switch = 1
284
- else:
285
- for window in window_up:
286
- collect_list.append(block + "_" + window)
287
- count += 1
288
- if count == blk_num:
289
- count = 0
290
- switch = 0
291
-
292
- logger.info("Length of collect list = %s" % len(collect_list))
293
- return collect_list
294
-
295
-
296
- @log.log_on_entry
297
- def write_file(
298
- location: str = "i24",
299
- suffix: str = ".addr",
300
- order: str = "alphanumeric",
301
- param_file_path: Path = PARAM_FILE_PATH_FT,
302
- save_path: Path = HEADER_FILES_PATH,
303
- ):
304
- if location == "i24":
305
- (
306
- chip_name,
307
- visit,
308
- sub_dir,
309
- n_exposures,
310
- chip_type,
311
- map_type,
312
- pump_repeat,
313
- pumpexptime,
314
- exptime,
315
- dcdetdist,
316
- prepumpexptime,
317
- ) = scrape_parameter_file(param_file_path)
318
- else:
319
- msg = "Unknown location, %s" % location
320
- logger.error(msg)
321
- raise ValueError(msg)
322
- chip_file_path = save_path / f"chips/{sub_dir}/{chip_name}{suffix}"
323
-
324
- fiducial_list = fiducials(chip_type)
325
- if order == "alphanumeric":
326
- addr_list = get_alphanumeric(chip_type)
327
-
328
- elif order == "shot":
329
- addr_list = get_shot_order(chip_type)
330
-
331
- with open(chip_file_path, "a") as g:
332
- for addr in addr_list:
333
- xtal_name = "_".join([chip_name, addr])
334
- (x, y) = get_xy(xtal_name, chip_type)
335
- if addr in fiducial_list:
336
- pres = "0"
337
- else:
338
- if "rand" in suffix:
339
- pres = str(np.random.randint(2))
340
- else:
341
- pres = "-1"
342
- line = "\t".join([xtal_name, str(x), str(y), "0.0", pres]) + "\n"
343
- g.write(line)
344
-
345
- logger.info("Write %s completed" % chip_file_path)
346
-
347
-
348
- @log.log_on_entry
349
- def check_files(
350
- location: str,
351
- suffix_list: List[str],
352
- param_file_path: Path | str = PARAM_FILE_PATH_FT,
353
- save_path: Path = HEADER_FILES_PATH,
354
- ):
355
- if location == "i24":
356
- (
357
- chip_name,
358
- visit,
359
- sub_dir,
360
- n_exposures,
361
- chip_type,
362
- map_type,
363
- exptime,
364
- pump_repeat,
365
- pumpdelay,
366
- pumpexptime,
367
- dcdetdist,
368
- prepumpexptime,
369
- det_type,
370
- ) = scrape_parameter_file(param_path=param_file_path)
371
- else:
372
- msg = "Unknown location, %s" % location
373
- logger.error(msg)
374
- raise ValueError(msg)
375
- chip_file_path = save_path / f"chips/{sub_dir}/{chip_name}"
376
-
377
- try:
378
- os.stat(chip_file_path)
379
- except Exception:
380
- os.makedirs(chip_file_path)
381
- for suffix in suffix_list:
382
- full_fid = chip_file_path.with_suffix(suffix)
383
- if full_fid.is_file():
384
- time_str = time.strftime("%Y%m%d_%H%M%S_")
385
- timestamp_fid = ( # noqa: F841
386
- full_fid.parent / f"{time_str}_{chip_name}{full_fid.suffix}"
387
- )
388
- # FIXME hack / fix. Actually move the file
389
- logger.info("File %s Already Exists" % full_fid)
390
- logger.debug("Check files done")
391
- return 1
392
-
393
-
394
- @log.log_on_entry
395
- def write_headers(
396
- location: str,
397
- suffix_list: List[str],
398
- param_file_path: Path = PARAM_FILE_PATH_FT,
399
- save_path: Path = HEADER_FILES_PATH,
400
- ):
401
- if location == "i24":
402
- (
403
- chip_name,
404
- visit,
405
- sub_dir,
406
- n_exposures,
407
- chip_type,
408
- map_type,
409
- pump_repeat,
410
- pumpexptime,
411
- pumpdelay,
412
- exptime,
413
- dcdetdist,
414
- prepumpexptime,
415
- det_type,
416
- ) = scrape_parameter_file(param_path=PARAM_FILE_PATH_FT)
417
- chip_file_path = save_path / f"chips/{sub_dir}/{chip_name}"
418
-
419
- for suffix in suffix_list:
420
- full_fid = chip_file_path.with_suffix(suffix)
421
- with open(full_fid, "w") as g:
422
- g.write(
423
- "#23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n#\n"
424
- )
425
- g.write("#&i24\tchip_name = %s\n" % chip_name)
426
- g.write("#&i24\tvisit = %s\n" % visit)
427
- g.write("#&i24\tsub_dir = %s\n" % sub_dir)
428
- g.write("#&i24\tn_exposures = %s\n" % n_exposures)
429
- g.write("#&i24\tchip_type = %s\n" % chip_type)
430
- g.write("#&i24\tmap_type = %s\n" % map_type)
431
- g.write("#&i24\tpump_repeat = %s\n" % pump_repeat)
432
- g.write("#&i24\tpumpexptime = %s\n" % pumpexptime)
433
- g.write("#&i24\texptime = %s\n" % exptime)
434
- g.write("#&i24\tdcdetdist = %s\n" % dcdetdist)
435
- g.write("#&i24\tprepumpexptime = %s\n" % prepumpexptime)
436
- g.write("#&i24\tdet_Type = %s\n" % det_type)
437
- g.write("#\n")
438
- g.write(
439
- "#XtalAddr XCoord YCoord ZCoord Present Shot Spare04 Spare03 Spare02 Spare01\n"
440
- )
441
- else:
442
- msg = "Unknown location, %s" % location
443
- logger.error(msg)
444
- raise ValueError(msg)
445
- logger.debug("Write headers done")
446
-
447
-
448
- def run():
449
- logger.debug("Run Startup")
450
- check_files("i24", [".addr", ".shot"])
451
- logger.info("Checked Files")
452
- write_headers("i24", [".addr", ".shot"])
453
- logger.info("Written Headers")
454
- logger.info("Writing to Files has been disabled. Headers Only")
455
- # Makes a file with random crystal positions
456
- check_files("i24", ["rando.spec"])
457
- write_headers("i24", ["rando.spec"])
458
- logger.debug("StartUp Done")
459
-
460
-
461
- if __name__ == "__main__":
462
- setup_logging()
463
- run()
@@ -1,5 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from mx_bluesky.I24.serial.parameters.constants import SSXType
4
-
5
- __all__ = ["SSXType"]
@@ -1,39 +0,0 @@
1
- from enum import Enum
2
- from pathlib import Path
3
-
4
-
5
- class SSXType(Enum):
6
- FIXED = "Serial Fixed"
7
- EXTRUDER = "Serial Jet"
8
-
9
-
10
- OAV_CONFIG_FILES = {
11
- "zoom_params_file": "/dls_sw/i24/software/gda/config/xml/jCameraManZoomLevels.xml",
12
- "oav_config_json": "/dls_sw/i24/software/daq_configuration/json/OAVCentring.json",
13
- "display_config": "/dls_sw/i24/software/gda_versions/var/display.configuration",
14
- }
15
- OAV1_CAM = "http://bl24i-di-serv-01.diamond.ac.uk:8080/OAV1.mjpg.mjpg"
16
-
17
- PARAM_FILE_PATH = Path("src/mx_bluesky/I24/serial/parameters").expanduser().resolve()
18
- PARAM_FILE_PATH_FT = (
19
- Path("src/mx_bluesky/I24/serial/parameters/fixed_target").expanduser().resolve()
20
- )
21
- LITEMAP_PATH = (
22
- Path("src/mx_bluesky/I24/serial/parameters/fixed_target/litemaps")
23
- .expanduser()
24
- .resolve()
25
- )
26
- FULLMAP_PATH = (
27
- Path("src/mx_bluesky/I24/serial/parameters/fixed_target/fullmaps")
28
- .expanduser()
29
- .resolve()
30
- )
31
- PVAR_FILE_PATH = (
32
- Path("src/mx_bluesky/I24/serial/parameters/fixed_target/pvar_files")
33
- .expanduser()
34
- .resolve()
35
- )
36
- HEADER_FILES_PATH = Path("/dls_sw/i24/scripts/fastchips/").expanduser().resolve()
37
- CS_FILES_PATH = (
38
- Path("src/mx_bluesky/I24/serial/parameters/fixed_target/cs").expanduser().resolve()
39
- )
@@ -1,9 +0,0 @@
1
- {
2
- "scalex": 10002.4,
3
- "scaley": 9997.5,
4
- "scalez": 10000.0,
5
- "skew": -0.163,
6
- "Sx_dir": -1,
7
- "Sy_dir": 1,
8
- "Sz_dir": -1
9
- }
@@ -1,4 +0,0 @@
1
- MTR RBV RAW Corr f_value
2
- MTR1 25.3964 254025 1 25.3964
3
- MTR2 -0.5533 -5532 1 -0.5533
4
- MTR3 0.0000 0 -1 0.0000
@@ -1,4 +0,0 @@
1
- MTR RBV RAW Corr f_value
2
- MTR1 0.4709 4710 1 0.4709
3
- MTR2 25.4079 254014 1 25.4079
4
- MTR3 0.0000 0 -1 0.0000
@@ -1,81 +0,0 @@
1
- 01status P3011 1
2
- 02status P3021 0
3
- 03status P3031 0
4
- 04status P3041 0
5
- 05status P3051 0
6
- 06status P3061 0
7
- 07status P3071 0
8
- 08status P3081 0
9
- 09status P3091 0
10
- 10status P3101 0
11
- 11status P3111 0
12
- 12status P3121 0
13
- 13status P3131 0
14
- 14status P3141 0
15
- 15status P3151 0
16
- 16status P3161 0
17
- 17status P3171 0
18
- 18status P3181 0
19
- 19status P3191 0
20
- 20status P3201 0
21
- 21status P3211 0
22
- 22status P3221 0
23
- 23status P3231 0
24
- 24status P3241 0
25
- 25status P3251 0
26
- 26status P3261 0
27
- 27status P3271 0
28
- 28status P3281 0
29
- 29status P3291 0
30
- 30status P3301 0
31
- 31status P3311 0
32
- 32status P3321 0
33
- 33status P3331 0
34
- 34status P3341 0
35
- 35status P3351 0
36
- 36status P3361 0
37
- 37status P3371 0
38
- 38status P3381 0
39
- 39status P3391 0
40
- 40status P3401 0
41
- 41status P3411 0
42
- 42status P3421 0
43
- 43status P3431 0
44
- 44status P3441 0
45
- 45status P3451 0
46
- 46status P3461 0
47
- 47status P3471 0
48
- 48status P3481 0
49
- 49status P3491 0
50
- 50status P3501 0
51
- 51status P3511 0
52
- 52status P3521 0
53
- 53status P3531 0
54
- 54status P3541 0
55
- 55status P3551 0
56
- 56status P3561 0
57
- 57status P3571 0
58
- 58status P3581 0
59
- 59status P3591 0
60
- 60status P3601 0
61
- 61status P3611 0
62
- 62status P3621 0
63
- 63status P3631 0
64
- 64status P3641 0
65
- 65status P3651 0
66
- 66status P3661 0
67
- 67status P3671 0
68
- 68status P3681 0
69
- 69status P3691 0
70
- 70status P3701 0
71
- 71status P3711 0
72
- 72status P3721 0
73
- 73status P3731 0
74
- 74status P3741 0
75
- 75status P3751 0
76
- 76status P3761 0
77
- 77status P3771 0
78
- 78status P3781 0
79
- 79status P3791 0
80
- 80status P3801 0
81
- 81status P3811 0
@@ -1,13 +0,0 @@
1
- visit /dls/i24/data/2023/cm33852-5/
2
- chip_name gamma
3
- protein_name test_20231128/test2
4
- n_exposures 2
5
- chip_type 0
6
- map_type 1
7
- pump_repeat 0
8
- pumpexptime 0.025
9
- pumpdelay 0.00
10
- prepumpexptime 0
11
- exptime 0.025
12
- dcdetdist 1450
13
- det_type pilatus
@@ -1,52 +0,0 @@
1
- import logging
2
- import subprocess
3
- from os import environ
4
- from pathlib import Path
5
-
6
- from mx_bluesky.I24.serial import log
7
-
8
-
9
- def setup_logging():
10
- logger = logging.getLogger("I24ssx")
11
- log.config("edm_screen.log")
12
- return logger
13
-
14
-
15
- def get_location(default: str = "dev") -> str:
16
- return environ.get("BEAMLINE") or default
17
-
18
-
19
- def get_edm_path() -> Path:
20
- return Path(__file__).parents[4] / "edm_serial"
21
-
22
-
23
- def run_extruder():
24
- logger = setup_logging()
25
- loc = get_location()
26
- logger.info(f"Running on {loc}.")
27
- edm_path = get_edm_path()
28
- logger.info("Starting extruder edm screen...")
29
- subprocess.run(
30
- [
31
- "edm",
32
- "-x",
33
- edm_path / "EX-gui/DiamondExtruder-I24-py3v1.edl",
34
- ]
35
- )
36
- logger.info("Edm screen closed.")
37
-
38
-
39
- def run_fixed_target():
40
- logger = setup_logging()
41
- loc = get_location()
42
- logger.info(f"Running on {loc}.")
43
- edm_path = get_edm_path()
44
- logger.info("Starting fixed target edm screen...")
45
- subprocess.run(
46
- [
47
- "edm",
48
- "-x",
49
- edm_path / "FT-gui/DiamondChipI24-py3v1.edl",
50
- ]
51
- )
52
- logger.info("Edm screen closed.")