mx-bluesky 0.0.1__py3-none-any.whl → 0.3.1__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.
- mx_bluesky/__main__.py +1 -2
- mx_bluesky/_version.py +14 -2
- mx_bluesky/example.py +4 -4
- mx_bluesky/i04/__init__.py +3 -0
- mx_bluesky/i04/callbacks/murko_callback.py +45 -0
- mx_bluesky/i04/thawing_plan.py +84 -0
- mx_bluesky/i24/serial/__init__.py +49 -0
- mx_bluesky/i24/serial/blueapi_config.yaml +12 -0
- mx_bluesky/{I24 → i24}/serial/dcid.py +53 -41
- mx_bluesky/{I24 → i24}/serial/extruder/EX-gui-edm/DetStage.edl +1 -2
- mx_bluesky/{I24 → i24}/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +28 -32
- mx_bluesky/{I24 → i24}/serial/extruder/EX-gui-edm/microdrop_alignment.edl +0 -1
- mx_bluesky/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +513 -0
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +1 -2
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/DetStage.edl +1 -2
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +46 -41
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/ME14E-GeneralPurpose.edl +0 -1
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +10 -11
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/PMAC_Command.edl +0 -1
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/Shutter_Control.edl +0 -1
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/microdrop_alignment.edl +0 -1
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/nudgechip.edl +0 -1
- mx_bluesky/{I24 → i24}/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +300 -119
- mx_bluesky/i24/serial/fixed_target/FT-gui-edm/short1-laser.png +0 -0
- mx_bluesky/i24/serial/fixed_target/FT-gui-edm/short2-laser.png +0 -0
- mx_bluesky/{I24 → i24}/serial/fixed_target/ft_utils.py +24 -1
- mx_bluesky/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +798 -0
- mx_bluesky/{I24 → i24}/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +374 -408
- mx_bluesky/{I24 → i24}/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +34 -40
- mx_bluesky/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +325 -0
- mx_bluesky/{I24 → i24}/serial/fixed_target/i24ssx_moveonclick.py +40 -45
- mx_bluesky/i24/serial/log.py +156 -0
- mx_bluesky/i24/serial/parameters/__init__.py +15 -0
- mx_bluesky/i24/serial/parameters/constants.py +47 -0
- mx_bluesky/i24/serial/parameters/experiment_parameters.py +124 -0
- mx_bluesky/i24/serial/parameters/fixed_target/cs/cs_maker.json +9 -0
- mx_bluesky/{I24 → i24}/serial/parameters/fixed_target/cs/motor_direction.txt +1 -1
- mx_bluesky/{I24 → i24}/serial/parameters/fixed_target/pvar_files/minichip-oxford.pvar +1 -1
- mx_bluesky/i24/serial/parameters/utils.py +40 -0
- mx_bluesky/i24/serial/run_extruder.sh +19 -0
- mx_bluesky/i24/serial/run_fixed_target.sh +22 -0
- mx_bluesky/i24/serial/run_serial.py +36 -0
- mx_bluesky/{I24 → i24}/serial/set_visit_directory.sh +6 -1
- mx_bluesky/{I24 → i24}/serial/setup_beamline/pv.py +1 -62
- mx_bluesky/{I24 → i24}/serial/setup_beamline/pv_abstract.py +6 -7
- mx_bluesky/{I24 → i24}/serial/setup_beamline/setup_beamline.py +90 -269
- mx_bluesky/{I24 → i24}/serial/setup_beamline/setup_detector.py +47 -40
- mx_bluesky/i24/serial/setup_beamline/setup_zebra_plans.py +459 -0
- mx_bluesky/i24/serial/start_blueapi.sh +28 -0
- mx_bluesky/i24/serial/write_nexus.py +102 -0
- mx_bluesky/parameters/__init__.py +31 -0
- mx_bluesky/parameters/components.py +200 -0
- {mx_bluesky-0.0.1.dist-info → mx_bluesky-0.3.1.dist-info}/METADATA +37 -26
- mx_bluesky-0.3.1.dist-info/RECORD +67 -0
- {mx_bluesky-0.0.1.dist-info → mx_bluesky-0.3.1.dist-info}/WHEEL +1 -1
- mx_bluesky-0.3.1.dist-info/entry_points.txt +4 -0
- mx_bluesky/I24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +0 -476
- mx_bluesky/I24/serial/fixed_target/FT-gui-edm/ME14E-motors.edl +0 -1874
- mx_bluesky/I24/serial/fixed_target/__init__.py +0 -0
- mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +0 -695
- mx_bluesky/I24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +0 -463
- mx_bluesky/I24/serial/log.py +0 -101
- mx_bluesky/I24/serial/parameters/__init__.py +0 -5
- mx_bluesky/I24/serial/parameters/constants.py +0 -39
- mx_bluesky/I24/serial/parameters/fixed_target/cs/cs_maker.json +0 -9
- mx_bluesky/I24/serial/parameters/fixed_target/cs/fiducial_1.txt +0 -4
- mx_bluesky/I24/serial/parameters/fixed_target/cs/fiducial_2.txt +0 -4
- mx_bluesky/I24/serial/parameters/fixed_target/litemaps/currentchip.map +0 -81
- mx_bluesky/I24/serial/parameters/fixed_target/parameters.txt +0 -13
- mx_bluesky/I24/serial/run_serial.py +0 -52
- mx_bluesky/I24/serial/write_nexus.py +0 -113
- mx_bluesky-0.0.1.dist-info/RECORD +0 -58
- mx_bluesky-0.0.1.dist-info/entry_points.txt +0 -4
- /mx_bluesky/{I24 → i24}/__init__.py +0 -0
- /mx_bluesky/{I24/serial → i24/serial/extruder}/__init__.py +0 -0
- /mx_bluesky/{I24/serial/extruder → i24/serial/fixed_target}/__init__.py +0 -0
- /mx_bluesky/{I24 → i24}/serial/parameters/fixed_target/pvar_files/oxford.pvar +0 -0
- /mx_bluesky/{I24 → i24}/serial/run_ssx.sh +0 -0
- /mx_bluesky/{I24 → i24}/serial/setup_beamline/__init__.py +0 -0
- /mx_bluesky/{I24 → i24}/serial/setup_beamline/ca.py +0 -0
- {mx_bluesky-0.0.1.dist-info → mx_bluesky-0.3.1.dist-info}/LICENSE +0 -0
- {mx_bluesky-0.0.1.dist-info → mx_bluesky-0.3.1.dist-info}/top_level.txt +0 -0
|
@@ -1,12 +1,50 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from time import sleep
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from
|
|
4
|
+
import bluesky.plan_stubs as bps
|
|
5
|
+
from dodal.devices.i24.aperture import Aperture, AperturePositions
|
|
6
|
+
from dodal.devices.i24.beamstop import Beamstop, BeamstopPositions
|
|
7
|
+
from dodal.devices.i24.dual_backlight import BacklightPositions, DualBacklight
|
|
8
|
+
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
9
|
+
|
|
10
|
+
from mx_bluesky.i24.serial.setup_beamline import pv
|
|
11
|
+
from mx_bluesky.i24.serial.setup_beamline.ca import caget, caput
|
|
6
12
|
|
|
7
13
|
logger = logging.getLogger("I24ssx.sup")
|
|
8
14
|
|
|
9
15
|
|
|
16
|
+
def setup_beamline_for_collection_plan(
|
|
17
|
+
aperture: Aperture,
|
|
18
|
+
backlight: DualBacklight,
|
|
19
|
+
beamstop: Beamstop,
|
|
20
|
+
group: str = "setup_beamline_collect",
|
|
21
|
+
wait: bool = True,
|
|
22
|
+
):
|
|
23
|
+
logger.debug("Setup beamline: collect.")
|
|
24
|
+
yield from bps.abs_set(aperture.position, AperturePositions.IN, group=group)
|
|
25
|
+
yield from bps.abs_set(backlight, BacklightPositions.OUT, group=group)
|
|
26
|
+
yield from bps.sleep(3) # Not sure needed - to test
|
|
27
|
+
yield from bps.abs_set(
|
|
28
|
+
beamstop.pos_select, BeamstopPositions.DATA_COLLECTION, group=group
|
|
29
|
+
)
|
|
30
|
+
yield from bps.abs_set(beamstop.y_rotation, 0, group=group)
|
|
31
|
+
yield from bps.sleep(4) # Not sure needed - to test
|
|
32
|
+
|
|
33
|
+
if wait:
|
|
34
|
+
yield from bps.wait(group=group)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def move_detector_stage_to_position_plan(
|
|
38
|
+
detector_stage: DetectorMotion,
|
|
39
|
+
detector_distance: float,
|
|
40
|
+
):
|
|
41
|
+
logger.debug("Setup beamline: moving detector stage.")
|
|
42
|
+
logger.debug(
|
|
43
|
+
f"Waiting for detector move. Detector distance: {detector_distance} mm."
|
|
44
|
+
)
|
|
45
|
+
yield from bps.mv(detector_stage.z, detector_distance)
|
|
46
|
+
|
|
47
|
+
|
|
10
48
|
def modechange(action):
|
|
11
49
|
"""Mode Change"""
|
|
12
50
|
# Pin Hand Mount
|
|
@@ -88,7 +126,7 @@ def modechange(action):
|
|
|
88
126
|
sleep(1)
|
|
89
127
|
caput(pv.aptr1_mp_select, "Manual Mounting")
|
|
90
128
|
caput(pv.bs_mp_select, "Tray Mount")
|
|
91
|
-
while caget(pv.ttab_x + ".RBV") > 3:
|
|
129
|
+
while float(caget(pv.ttab_x + ".RBV")) > 3:
|
|
92
130
|
sleep(1)
|
|
93
131
|
logger.debug("Tray Hand Mount Done")
|
|
94
132
|
|
|
@@ -153,8 +191,8 @@ def modechange(action):
|
|
|
153
191
|
caput(pv.vgon_pinxs, 0)
|
|
154
192
|
caput(pv.vgon_pinyh, 0)
|
|
155
193
|
caput(pv.vgon_pinzs, 0)
|
|
156
|
-
while caget(pv.ttab_x + ".RBV") > 1:
|
|
157
|
-
logger.debug("moving ttab_x
|
|
194
|
+
while float(caget(pv.ttab_x + ".RBV")) > 1:
|
|
195
|
+
logger.debug(f"moving ttab_x {caget(pv.ttab_x)}")
|
|
158
196
|
sleep(0.1)
|
|
159
197
|
while caget(pv.fluo_out_limit) == "OFF":
|
|
160
198
|
logger.debug("waiting on fluorescence detector")
|
|
@@ -164,7 +202,7 @@ def modechange(action):
|
|
|
164
202
|
sleep(0.1)
|
|
165
203
|
caput(pv.bs_mp_select, "Robot")
|
|
166
204
|
caput(pv.bs_roty, 0)
|
|
167
|
-
while caget(pv.ptab_y + ".RBV") > -89.0:
|
|
205
|
+
while float(caget(pv.ptab_y + ".RBV")) > -89.0:
|
|
168
206
|
sleep(1)
|
|
169
207
|
logger.debug("Switch To Tray Done")
|
|
170
208
|
|
|
@@ -174,75 +212,24 @@ def modechange(action):
|
|
|
174
212
|
# Supposed to absorb pin laser
|
|
175
213
|
caput(pv.hgon_trayys, 0.0)
|
|
176
214
|
caput(pv.hgon_trayzs, 0.0)
|
|
177
|
-
while caget(pv.ttab_x + ".RBV") > 1.0:
|
|
215
|
+
while float(caget(pv.ttab_x + ".RBV")) > 1.0:
|
|
178
216
|
sleep(1)
|
|
179
217
|
caput(pv.ptab_y, 0)
|
|
180
|
-
while caget(pv.ptab_y + ".RBV") < -1.0:
|
|
218
|
+
while float(caget(pv.ptab_y + ".RBV")) < -1.0:
|
|
181
219
|
sleep(1)
|
|
182
220
|
modechange("Pin_data_collection")
|
|
183
221
|
logger.debug("Switch To Pin Done")
|
|
184
222
|
else:
|
|
185
|
-
logger.debug("Unknown action:
|
|
223
|
+
logger.debug(f"Unknown action: {action}")
|
|
186
224
|
return 1
|
|
187
225
|
|
|
188
226
|
|
|
189
|
-
def
|
|
190
|
-
logger.debug("***** Entering Beamline")
|
|
191
|
-
logger.info("beamline - %s" % action)
|
|
192
|
-
if args_list:
|
|
193
|
-
for arg in args_list:
|
|
194
|
-
logger.debug("Argument: %s" % arg)
|
|
195
|
-
|
|
196
|
-
if action == "collect":
|
|
197
|
-
caput(pv.aptr1_mp_select, "In")
|
|
198
|
-
caput(pv.bl_mp_select, "Out")
|
|
199
|
-
sleep(3)
|
|
200
|
-
caput(pv.bs_mp_select, "Data Collection")
|
|
201
|
-
caput(pv.bs_roty, 0)
|
|
202
|
-
sleep(4)
|
|
203
|
-
|
|
204
|
-
elif action == "quickshot":
|
|
205
|
-
det_dist = args_list[0]
|
|
206
|
-
caput(pv.det_z, det_dist)
|
|
207
|
-
logger.info("Waiting on detector")
|
|
208
|
-
logger.debug("Detector distance: %s" % det_dist)
|
|
209
|
-
logger.debug("det_z: %s" % caget(pv.det_z + ".RBV"))
|
|
210
|
-
while str(int(float(caget(pv.det_z + ".RBV")))) != str(int(float(det_dist))):
|
|
211
|
-
caput(pv.det_z, det_dist)
|
|
212
|
-
sleep(0.2)
|
|
213
|
-
|
|
214
|
-
elif action == "zlayer":
|
|
215
|
-
det_dist = args_list[0]
|
|
216
|
-
caput(pv.det_z, det_dist)
|
|
217
|
-
caput(pv.fluo_trans, "IN")
|
|
218
|
-
caput(pv.bl_mp_select, "Out")
|
|
219
|
-
caput(pv.aptr1_mp_select, "In")
|
|
220
|
-
caput(pv.bs_mp_select, "Data Collection")
|
|
221
|
-
logger.info("Moving backlight out before rotating beamstop in")
|
|
222
|
-
sleep(3)
|
|
223
|
-
caput(pv.bs_roty, 0)
|
|
224
|
-
logger.info("Waiting on detector")
|
|
225
|
-
while str(int(caget(pv.det_z + ".RBV"))) != str(int(float(det_dist))):
|
|
226
|
-
caput(pv.det_z, det_dist)
|
|
227
|
-
sleep(0.2)
|
|
228
|
-
logger.info("Waiting for Fluorescence Detector")
|
|
229
|
-
while caget(pv.fluo_in_limit) != "OFF":
|
|
230
|
-
print(".", end=" ")
|
|
231
|
-
sleep(0.25)
|
|
232
|
-
|
|
233
|
-
else:
|
|
234
|
-
logger.warning("Unknown action for beamline method", action)
|
|
235
|
-
sleep(0.1)
|
|
236
|
-
logger.debug("***** leaving beamline\n")
|
|
237
|
-
return 1
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
def pilatus(action, args_list=None):
|
|
227
|
+
def pilatus(action, args_list):
|
|
241
228
|
logger.debug("***** Entering Pilatus")
|
|
242
|
-
logger.info("pilatus -
|
|
229
|
+
logger.info(f"Setup pilatus - {action}")
|
|
243
230
|
if args_list:
|
|
244
231
|
for arg in args_list:
|
|
245
|
-
logger.debug("Argument:
|
|
232
|
+
logger.debug(f"Argument: {arg}")
|
|
246
233
|
|
|
247
234
|
# caput(pv.pilat_wavelength, caget(pv.dcm_lambda))
|
|
248
235
|
caput(pv.pilat_detdist, caget(pv.det_z))
|
|
@@ -253,36 +240,17 @@ def pilatus(action, args_list=None):
|
|
|
253
240
|
caput(pv.pilat_beamy, 1307)
|
|
254
241
|
sleep(0.1)
|
|
255
242
|
|
|
256
|
-
if action == "zlayer":
|
|
257
|
-
[filepath, filename, total_numb_imgs, exptime] = args_list
|
|
258
|
-
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
259
|
-
acqtime = exptime - 0.001
|
|
260
|
-
logger.info("Filepath was set as %s" % filepath)
|
|
261
|
-
logger.info("Rampath set as %s" % rampath)
|
|
262
|
-
logger.info("Filename set as %s" % filename)
|
|
263
|
-
logger.info("total_numb_imgs %s" % total_numb_imgs)
|
|
264
|
-
logger.info("Exposure time set as %s s" % exptime)
|
|
265
|
-
logger.info("Acquire time set as %s s" % acqtime)
|
|
266
|
-
caput(pv.pilat_filepath, rampath + filename + "/")
|
|
267
|
-
caput(pv.pilat_filename, filename)
|
|
268
|
-
caput(pv.pilat_numimages, str(total_numb_imgs))
|
|
269
|
-
caput(pv.pilat_acquiretime, str(acqtime))
|
|
270
|
-
caput(pv.pilat_acquireperiod, str(exptime))
|
|
271
|
-
caput(pv.pilat_imagemode, "Continuous")
|
|
272
|
-
caput(pv.pilat_triggermode, "Mult. Trigger")
|
|
273
|
-
caput(pv.pilat_delaytime, 0)
|
|
274
|
-
|
|
275
243
|
# Fixed Target stage (very fast start and stop w/ triggering from GeoBrick
|
|
276
|
-
|
|
244
|
+
if action == "fastchip":
|
|
277
245
|
[filepath, filename, total_numb_imgs, exptime] = args_list
|
|
278
246
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
279
247
|
acqtime = float(exptime) - 0.001
|
|
280
|
-
logger.
|
|
281
|
-
logger.
|
|
282
|
-
logger.
|
|
283
|
-
logger.
|
|
284
|
-
logger.
|
|
285
|
-
logger.
|
|
248
|
+
logger.debug(f"Filepath was set as {filepath}")
|
|
249
|
+
logger.debug(f"Rampath set as {rampath}")
|
|
250
|
+
logger.debug(f"Filename set as {filename}")
|
|
251
|
+
logger.debug(f"total_numb_imgs {total_numb_imgs}")
|
|
252
|
+
logger.debug(f"Exposure time set as {exptime} s")
|
|
253
|
+
logger.debug(f"Acquire time set as {acqtime} s")
|
|
286
254
|
caput(pv.pilat_startangle, 0.0)
|
|
287
255
|
caput(pv.pilat_angleincr, 0.0)
|
|
288
256
|
caput(pv.pilat_omegaincr, 0.0)
|
|
@@ -297,7 +265,7 @@ def pilatus(action, args_list=None):
|
|
|
297
265
|
|
|
298
266
|
# Quick set of images no coordinated motion
|
|
299
267
|
elif action == "quickshot":
|
|
300
|
-
|
|
268
|
+
logger.debug("quickshot")
|
|
301
269
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
302
270
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
303
271
|
caput(pv.pilat_filepath, rampath)
|
|
@@ -307,13 +275,13 @@ def pilatus(action, args_list=None):
|
|
|
307
275
|
acqtime = float(exptime) - 0.001
|
|
308
276
|
caput(pv.pilat_acquiretime, str(acqtime))
|
|
309
277
|
caput(pv.pilat_acquireperiod, str(exptime))
|
|
310
|
-
logger.
|
|
311
|
-
logger.
|
|
312
|
-
logger.
|
|
313
|
-
logger.
|
|
314
|
-
logger.
|
|
315
|
-
logger.
|
|
316
|
-
logger.
|
|
278
|
+
logger.debug(f"Filepath was set as {filepath}")
|
|
279
|
+
logger.debug(f"Rampath set as {rampath}")
|
|
280
|
+
logger.debug(f"Filename set as {filename}")
|
|
281
|
+
logger.debug(f"num_imgs {num_imgs}")
|
|
282
|
+
logger.debug(f"Exposure time set as {exptime} s")
|
|
283
|
+
logger.debug(f"Acquire time set as {acqtime} s")
|
|
284
|
+
logger.debug("Pilatus takes time apprx 2sec")
|
|
317
285
|
sleep(2)
|
|
318
286
|
caput(pv.pilat_delaytime, 0.00)
|
|
319
287
|
caput(pv.pilat_numimages, str(num_imgs))
|
|
@@ -322,7 +290,7 @@ def pilatus(action, args_list=None):
|
|
|
322
290
|
sleep(0.2)
|
|
323
291
|
|
|
324
292
|
elif action == "quickshot-internaltrig":
|
|
325
|
-
|
|
293
|
+
logger.debug("quickshot-internaltrig")
|
|
326
294
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
327
295
|
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
328
296
|
caput(pv.pilat_filepath, rampath)
|
|
@@ -332,13 +300,13 @@ def pilatus(action, args_list=None):
|
|
|
332
300
|
acqtime = float(exptime) - 0.001
|
|
333
301
|
caput(pv.pilat_acquiretime, str(acqtime))
|
|
334
302
|
caput(pv.pilat_acquireperiod, str(exptime))
|
|
335
|
-
logger.
|
|
336
|
-
logger.
|
|
337
|
-
logger.
|
|
338
|
-
logger.
|
|
339
|
-
logger.
|
|
340
|
-
logger.
|
|
341
|
-
logger.
|
|
303
|
+
logger.debug(f"Filepath was set as {filepath}")
|
|
304
|
+
logger.debug(f"Rampath set as {rampath}")
|
|
305
|
+
logger.debug(f"Filename set as {filename}")
|
|
306
|
+
logger.debug(f"num_imgs {num_imgs}")
|
|
307
|
+
logger.debug(f"Exposure time set as {exptime} s")
|
|
308
|
+
logger.debug(f"Acquire time set as {acqtime} s")
|
|
309
|
+
logger.debug("Pilatus takes time apprx 2sec")
|
|
342
310
|
sleep(2)
|
|
343
311
|
caput(pv.pilat_delaytime, 0.00)
|
|
344
312
|
caput(pv.pilat_numimages, str(num_imgs))
|
|
@@ -356,12 +324,12 @@ def pilatus(action, args_list=None):
|
|
|
356
324
|
return 0
|
|
357
325
|
|
|
358
326
|
|
|
359
|
-
def eiger(action, args_list
|
|
327
|
+
def eiger(action, args_list):
|
|
360
328
|
logger.debug("***** Entering Eiger")
|
|
361
|
-
logger.info("eiger -
|
|
329
|
+
logger.info(f"Setup eiger - {action}")
|
|
362
330
|
if args_list:
|
|
363
331
|
for arg in args_list:
|
|
364
|
-
logger.debug("Argument:
|
|
332
|
+
logger.debug(f"Argument: {arg}")
|
|
365
333
|
# caput(pv.eiger_wavelength, caget(pv.dcm_lambda))
|
|
366
334
|
caput(pv.eiger_detdist, str(float(caget(pv.det_z)) / 1000))
|
|
367
335
|
logger.warning("WARNING: Have you set header info?")
|
|
@@ -386,7 +354,7 @@ def eiger(action, args_list=None):
|
|
|
386
354
|
# Quick set of images no coordinated motion
|
|
387
355
|
if action == "quickshot":
|
|
388
356
|
# Sends a single trigger to start data collection
|
|
389
|
-
logger.
|
|
357
|
+
logger.debug("Eiger quickshot")
|
|
390
358
|
[filepath, filename, num_imgs, exptime] = args_list
|
|
391
359
|
filename = filename + "_" + str(caget(pv.eiger_seqID))
|
|
392
360
|
caput(pv.eiger_ODfilepath, filepath)
|
|
@@ -395,11 +363,11 @@ def eiger(action, args_list=None):
|
|
|
395
363
|
sleep(0.1)
|
|
396
364
|
acqtime = float(exptime) - 0.0000001
|
|
397
365
|
caput(pv.eiger_acquiretime, str(acqtime))
|
|
398
|
-
logger.
|
|
399
|
-
logger.
|
|
400
|
-
logger.
|
|
401
|
-
logger.
|
|
402
|
-
logger.
|
|
366
|
+
logger.debug(f"Filepath was set as {filepath}")
|
|
367
|
+
logger.debug(f"Filename set as {filename}")
|
|
368
|
+
logger.debug(f"num_imgs {num_imgs}")
|
|
369
|
+
logger.debug(f"Exposure time set as {exptime} s")
|
|
370
|
+
logger.debug(f"Acquire time set as {acqtime} s")
|
|
403
371
|
caput(pv.eiger_acquireperiod, str(exptime))
|
|
404
372
|
caput(pv.eiger_numimages, str(num_imgs))
|
|
405
373
|
caput(pv.eiger_imagemode, "Continuous")
|
|
@@ -437,11 +405,11 @@ def eiger(action, args_list=None):
|
|
|
437
405
|
sleep(0.1)
|
|
438
406
|
acqtime = float(exptime) - 0.0000001
|
|
439
407
|
caput(pv.eiger_acquiretime, str(acqtime))
|
|
440
|
-
logger.
|
|
441
|
-
logger.
|
|
442
|
-
logger.
|
|
443
|
-
logger.
|
|
444
|
-
logger.
|
|
408
|
+
logger.debug(f"Filepath was set as {filepath}")
|
|
409
|
+
logger.debug(f"Filename set as {filename}")
|
|
410
|
+
logger.debug(f"num_imgs {num_imgs}")
|
|
411
|
+
logger.debug(f"Exposure time set as {exptime} s")
|
|
412
|
+
logger.debug(f"Acquire time set as {acqtime} s")
|
|
445
413
|
caput(pv.eiger_acquireperiod, str(exptime))
|
|
446
414
|
caput(pv.eiger_numimages, 1)
|
|
447
415
|
caput(pv.eiger_imagemode, "Continuous")
|
|
@@ -477,12 +445,12 @@ def eiger(action, args_list=None):
|
|
|
477
445
|
return 0
|
|
478
446
|
|
|
479
447
|
|
|
480
|
-
def xspress3(action, args_list
|
|
448
|
+
def xspress3(action, args_list):
|
|
481
449
|
logger.debug("***** Entering xspress3")
|
|
482
|
-
logger.info("xspress3 -
|
|
450
|
+
logger.info(f"xspress3 - {action}")
|
|
483
451
|
if args_list:
|
|
484
452
|
for arg in args_list:
|
|
485
|
-
logger.debug("Argument:
|
|
453
|
+
logger.debug(f"Argument: {arg}")
|
|
486
454
|
|
|
487
455
|
if action == "stop-and-start":
|
|
488
456
|
[exp_time, lo, hi] = args_list
|
|
@@ -509,12 +477,6 @@ def xspress3(action, args_list=None):
|
|
|
509
477
|
sleep(0.2)
|
|
510
478
|
caput(pv.xsp3_erase, 0)
|
|
511
479
|
|
|
512
|
-
elif action == "zlayer":
|
|
513
|
-
[filepath, filename, total_numb_images] = args_list
|
|
514
|
-
caput(pv.xsp3_hdf5_filepath, filepath)
|
|
515
|
-
caput(pv.xsp3_hdf5_filename, filename)
|
|
516
|
-
caput(pv.xsp3_numimages, total_numb_images)
|
|
517
|
-
|
|
518
480
|
elif action == "return-to-normal":
|
|
519
481
|
caput(pv.xsp3_triggermode, "TTL Veto Only")
|
|
520
482
|
caput(pv.xsp3_numimages, 1)
|
|
@@ -529,144 +491,3 @@ def xspress3(action, args_list=None):
|
|
|
529
491
|
sleep(0.1)
|
|
530
492
|
logger.debug("***** leaving xspress3")
|
|
531
493
|
return 1
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
def zebra1(action, args_list=None):
|
|
535
|
-
logger.debug("***** Entering zebra1")
|
|
536
|
-
logger.info("zebra1 - %s" % action)
|
|
537
|
-
if args_list:
|
|
538
|
-
for arg in args_list:
|
|
539
|
-
logger.debug("Argument: %s" % arg)
|
|
540
|
-
|
|
541
|
-
if action == "zlayer":
|
|
542
|
-
caput(pv.zebra1_soft_in_b2, "0")
|
|
543
|
-
caput(pv.zebra1_soft_in_b3, "0")
|
|
544
|
-
caput(pv.zebra1_pc_gate_sel, "External")
|
|
545
|
-
caput(pv.zebra1_pc_gate_inp, "62")
|
|
546
|
-
caput(pv.zebra1_pc_pulse_sel, "External")
|
|
547
|
-
caput(pv.zebra1_pc_pulse_inp, "1")
|
|
548
|
-
caput(pv.zebra1_and3_inp1, "29")
|
|
549
|
-
caput(pv.zebra1_and3_inp2, "1")
|
|
550
|
-
caput(pv.zebra1_out2_ttl, "34")
|
|
551
|
-
caput(pv.zebra1_out3_ttl, "52")
|
|
552
|
-
caput(pv.zebra1_out4_ttl, "35")
|
|
553
|
-
|
|
554
|
-
elif action == "quickshot":
|
|
555
|
-
[gate_start, gate_width] = args_list
|
|
556
|
-
# Trig Source is soft SOFT_IN2
|
|
557
|
-
caput(pv.zebra1_pc_arm_sel, "Soft")
|
|
558
|
-
caput(pv.zebra1_pc_gate_sel, "Time")
|
|
559
|
-
caput(pv.zebra1_pc_pulse_sel, "External")
|
|
560
|
-
caput(pv.zebra1_pc_gate_start, gate_start)
|
|
561
|
-
caput(pv.zebra1_pc_gate_width, gate_width)
|
|
562
|
-
caput(pv.zebra1_pc_gate_inp, "61")
|
|
563
|
-
sleep(0.1)
|
|
564
|
-
caput(pv.zebra1_pc_gate_inp, "61")
|
|
565
|
-
sleep(0.1)
|
|
566
|
-
|
|
567
|
-
elif action == "fastchip-pilatus":
|
|
568
|
-
[num_gates, n_exposures, exptime] = args_list
|
|
569
|
-
caput(pv.zebra1_soft_in_b0, "0")
|
|
570
|
-
caput(pv.zebra1_pc_gate_sel, "External")
|
|
571
|
-
caput(pv.zebra1_pc_pulse_sel, "Time")
|
|
572
|
-
caput(pv.zebra1_and3_inp1, "61")
|
|
573
|
-
caput(pv.zebra1_and3_inp2, "31")
|
|
574
|
-
caput(pv.zebra1_out2_ttl, "34")
|
|
575
|
-
caput(pv.zebra1_pc_gate_inp, "7")
|
|
576
|
-
caput(pv.zebra1_pc_gate_ngate, num_gates)
|
|
577
|
-
caput(pv.zebra1_pc_pulse_start, "0")
|
|
578
|
-
exptimestep = float(exptime) + 0.0001 # Miss some triggers if no 100us buffer
|
|
579
|
-
caput(pv.zebra1_pc_pulse_step, exptimestep)
|
|
580
|
-
pulse_width = float(exptime) / 2 # sawtooth. nb won't work for Eiger
|
|
581
|
-
caput(pv.zebra1_pc_pulse_width, pulse_width)
|
|
582
|
-
caput(pv.zebra1_pc_pulse_max, n_exposures)
|
|
583
|
-
|
|
584
|
-
elif action == "fastchip-eiger":
|
|
585
|
-
[num_gates, n_exposures, exptime] = args_list
|
|
586
|
-
caput(pv.zebra1_soft_in_b0, "0")
|
|
587
|
-
caput(pv.zebra1_pc_gate_sel, "External")
|
|
588
|
-
caput(pv.zebra1_pc_pulse_sel, "Time")
|
|
589
|
-
caput(pv.zebra1_and3_inp1, "61")
|
|
590
|
-
caput(pv.zebra1_and3_inp2, "31")
|
|
591
|
-
caput(pv.zebra1_out1_ttl, "34")
|
|
592
|
-
caput(pv.zebra1_pc_gate_inp, "7")
|
|
593
|
-
caput(pv.zebra1_pc_gate_ngate, num_gates)
|
|
594
|
-
caput(pv.zebra1_pc_pulse_start, "0")
|
|
595
|
-
exptimestep = float(exptime) + 0.0001 # Miss some triggers if no 100us buffer
|
|
596
|
-
caput(pv.zebra1_pc_pulse_step, exptimestep)
|
|
597
|
-
pulse_width = float(exptime) - 0.0001 # sawtooth with small drop for eiger
|
|
598
|
-
caput(pv.zebra1_pc_pulse_width, pulse_width)
|
|
599
|
-
caput(pv.zebra1_pc_pulse_max, n_exposures)
|
|
600
|
-
|
|
601
|
-
elif action == "return-to-normal":
|
|
602
|
-
caput(pv.zebra1_pc_disarm, 1)
|
|
603
|
-
sleep(0.1)
|
|
604
|
-
caput(pv.zebra1_reset_proc, 1)
|
|
605
|
-
sleep(0.5)
|
|
606
|
-
caput(pv.zebra1_pc_disarm, 1)
|
|
607
|
-
caput(pv.zebra1_pc_gate_sel, "Position")
|
|
608
|
-
caput(pv.zebra1_pc_pulse_sel, "Position")
|
|
609
|
-
caput(pv.zebra1_pc_gate_inp, "62")
|
|
610
|
-
caput(pv.zebra1_pc_gate_ngate, "1")
|
|
611
|
-
caput(pv.zebra1_pc_pulse_inp, "0")
|
|
612
|
-
caput(pv.zebra1_and3_inp1, "29")
|
|
613
|
-
caput(pv.zebra1_and3_inp2, "1")
|
|
614
|
-
caput(pv.zebra1_out2_ttl, "30")
|
|
615
|
-
caput(pv.zebra1_out3_ttl, "0")
|
|
616
|
-
caput(pv.zebra1_out4_ttl, "36") # 61
|
|
617
|
-
caput(pv.zebra1_pc_enc, "Enc2")
|
|
618
|
-
caput(pv.zebra1_pc_dir, "Positive")
|
|
619
|
-
caput(pv.zebra1_pc_gate_start, "0.0")
|
|
620
|
-
caput(pv.zebra1_pc_pulse_width, "0.0")
|
|
621
|
-
caput(pv.zebra1_pc_pulse_step, "0.0")
|
|
622
|
-
# caput(pv.zebra1_out3_ttl, '30')
|
|
623
|
-
caput(pv.zebra1_pulse1_inp, "0")
|
|
624
|
-
caput(pv.zebra1_pulse2_inp, "0")
|
|
625
|
-
|
|
626
|
-
else:
|
|
627
|
-
logger.error("Unknown action for zebra1 method", action)
|
|
628
|
-
sleep(0.1)
|
|
629
|
-
logger.debug("***** leaving zebra1")
|
|
630
|
-
return 1
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
def geobrick(action, args_list=None):
|
|
634
|
-
logger.debug("***** Entering Geobrick 10")
|
|
635
|
-
logger.info("geobrick - %s" % action)
|
|
636
|
-
if args_list:
|
|
637
|
-
for arg in args_list:
|
|
638
|
-
logger.debug("Argument: %s" % arg)
|
|
639
|
-
|
|
640
|
-
if action == "zlayer":
|
|
641
|
-
caput(pv.step10_pmac_str, "I5450 = 1")
|
|
642
|
-
# disable motors in normal coordinate system
|
|
643
|
-
caput(pv.step10_pmac_str, "&2#1-> 0") # PINZ
|
|
644
|
-
caput(pv.step10_pmac_str, "&2#3-> 0") # PINX
|
|
645
|
-
caput(pv.step10_pmac_str, "&2#2-> 0") # omega
|
|
646
|
-
# disable killing of axes
|
|
647
|
-
caput(pv.step10_pmac_str, "P701 = 0") # PINZ
|
|
648
|
-
caput(pv.step10_pmac_str, "P703 = 0") # PINX
|
|
649
|
-
caput(pv.step10_pmac_str, "P709 = 0") # PINY
|
|
650
|
-
caput(pv.step10_pmac_str, "#1J/") # PINZ
|
|
651
|
-
caput(pv.step10_pmac_str, "#3J/") # PINX
|
|
652
|
-
caput(pv.step10_pmac_str, "#9J/") # PINY
|
|
653
|
-
# disable kinematic calculation
|
|
654
|
-
caput(pv.step10_pmac_str, "I5450 = 0")
|
|
655
|
-
|
|
656
|
-
elif action == "return-to-normal":
|
|
657
|
-
# disable fast grid scan motors
|
|
658
|
-
caput(pv.step10_pmac_str, "&4#1-> 0") # PINZ
|
|
659
|
-
caput(pv.step10_pmac_str, "&4#3-> 0") # PINX
|
|
660
|
-
caput(pv.step10_pmac_str, "&4#9-> 0") # PINY
|
|
661
|
-
# enable normal coordinate system motors
|
|
662
|
-
caput(pv.step10_pmac_str, "&2#1-> I") # PINZ
|
|
663
|
-
caput(pv.step10_pmac_str, "&2#3-> I") # PINX
|
|
664
|
-
caput(pv.step10_pmac_str, "&2#2-> I") # omega
|
|
665
|
-
# re-enable killing of axes
|
|
666
|
-
caput(pv.step10_pmac_str, "P701 = 2000") # PINZ
|
|
667
|
-
caput(pv.step10_pmac_str, "P703 = 2000") # PINX
|
|
668
|
-
caput(pv.step10_pmac_str, "P709 = 2000") # PINY
|
|
669
|
-
# re-enable kinematic calculation
|
|
670
|
-
caput(pv.step10_pmac_str, "I5450 = 1")
|
|
671
|
-
logger.debug("***** leaving geobrick")
|
|
672
|
-
return 1
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Utilities for defining the detector in use, and moving the stage.
|
|
3
3
|
"""
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import logging
|
|
6
6
|
import time
|
|
7
|
+
from collections.abc import Generator
|
|
7
8
|
from enum import IntEnum
|
|
8
9
|
|
|
9
10
|
import bluesky.plan_stubs as bps
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from dodal.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from mx_bluesky.
|
|
16
|
-
from mx_bluesky.
|
|
17
|
-
from mx_bluesky.
|
|
18
|
-
from mx_bluesky.
|
|
11
|
+
from blueapi.core import MsgGenerator
|
|
12
|
+
from bluesky.utils import Msg
|
|
13
|
+
from dodal.common import inject
|
|
14
|
+
from dodal.devices.i24.i24_detector_motion import DetectorMotion
|
|
15
|
+
|
|
16
|
+
from mx_bluesky.i24.serial import log
|
|
17
|
+
from mx_bluesky.i24.serial.parameters import SSXType
|
|
18
|
+
from mx_bluesky.i24.serial.setup_beamline import pv
|
|
19
|
+
from mx_bluesky.i24.serial.setup_beamline.ca import caget
|
|
20
|
+
from mx_bluesky.i24.serial.setup_beamline.pv_abstract import (
|
|
19
21
|
Detector,
|
|
20
22
|
Eiger,
|
|
21
23
|
Pilatus,
|
|
@@ -33,6 +35,9 @@ class DetRequest(IntEnum):
|
|
|
33
35
|
eiger = 0
|
|
34
36
|
pilatus = 1
|
|
35
37
|
|
|
38
|
+
def __str__(self) -> str:
|
|
39
|
+
return self.name
|
|
40
|
+
|
|
36
41
|
|
|
37
42
|
def setup_logging():
|
|
38
43
|
logfile = time.strftime("SSXdetectorOps_%d%B%y.log").lower()
|
|
@@ -43,8 +48,8 @@ class UnknownDetectorType(Exception):
|
|
|
43
48
|
pass
|
|
44
49
|
|
|
45
50
|
|
|
46
|
-
def get_detector_type() -> Detector:
|
|
47
|
-
det_y =
|
|
51
|
+
def get_detector_type(detector_stage: DetectorMotion) -> Generator[Msg, None, Detector]:
|
|
52
|
+
det_y = yield from bps.rd(detector_stage.y)
|
|
48
53
|
# DetectorMotion should also be used for this.
|
|
49
54
|
# This should be part of https://github.com/DiamondLightSource/mx_bluesky/issues/51
|
|
50
55
|
if float(det_y) < Eiger.det_y_threshold:
|
|
@@ -58,43 +63,45 @@ def get_detector_type() -> Detector:
|
|
|
58
63
|
raise UnknownDetectorType("Detector not found.")
|
|
59
64
|
|
|
60
65
|
|
|
61
|
-
def _move_detector_stage(detector_stage: DetectorMotion, target: float):
|
|
66
|
+
def _move_detector_stage(detector_stage: DetectorMotion, target: float) -> MsgGenerator:
|
|
62
67
|
logger.info(f"Moving detector stage to target position: {target}.")
|
|
63
|
-
yield from bps.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
yield from bps.mv(detector_stage.y, target)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# Workaround in case the PV value has been set to the detector name
|
|
72
|
+
def _get_requested_detector(det_type_pv: str) -> str:
|
|
73
|
+
"""Get the requested detector name from the PV value.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
det_type_pv (str): PV associated to the detector request. This is usually a \
|
|
77
|
+
general purpose PV set up for the serial collection which could contain \
|
|
78
|
+
a string or and int.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
str: The detector name as a string, currently "eiger" or "pilatus".
|
|
82
|
+
"""
|
|
83
|
+
det_type = caget(det_type_pv)
|
|
84
|
+
if det_type in ["pilatus", "eiger"]:
|
|
85
|
+
return det_type
|
|
86
|
+
else:
|
|
87
|
+
try:
|
|
88
|
+
det_type = int(det_type)
|
|
89
|
+
return str(DetRequest(det_type))
|
|
90
|
+
except ValueError:
|
|
91
|
+
raise
|
|
68
92
|
|
|
69
93
|
|
|
70
|
-
def setup_detector_stage(
|
|
94
|
+
def setup_detector_stage(
|
|
95
|
+
expt_type: SSXType, detector_stage: DetectorMotion = inject("detector_motion")
|
|
96
|
+
) -> MsgGenerator:
|
|
97
|
+
setup_logging()
|
|
71
98
|
# Grab the correct PV depending on experiment
|
|
72
99
|
# Its value is set with MUX on edm screen
|
|
73
100
|
det_type_pv = EXPT_TYPE_DETECTOR_PVS[expt_type]
|
|
74
|
-
|
|
75
|
-
requested_detector = (
|
|
76
|
-
Eiger.name if int(det_type) == DetRequest.eiger else Pilatus.name
|
|
77
|
-
)
|
|
101
|
+
requested_detector = _get_requested_detector(det_type_pv)
|
|
78
102
|
logger.info(f"Requested detector: {requested_detector}.")
|
|
79
103
|
det_y_target = (
|
|
80
104
|
Eiger.det_y_target if requested_detector == "eiger" else Pilatus.det_y_target
|
|
81
105
|
)
|
|
82
106
|
yield from _move_detector_stage(detector_stage, det_y_target)
|
|
83
107
|
logger.info("Detector setup done.")
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if __name__ == "__main__":
|
|
87
|
-
setup_logging()
|
|
88
|
-
parser = argparse.ArgumentParser()
|
|
89
|
-
parser.add_argument(
|
|
90
|
-
"expt",
|
|
91
|
-
type=str,
|
|
92
|
-
choices=[expt.value for expt in SSXType],
|
|
93
|
-
help="Type of serial experiment being run.",
|
|
94
|
-
)
|
|
95
|
-
args = parser.parse_args()
|
|
96
|
-
expt_type = SSXType(args.expt)
|
|
97
|
-
RE = RunEngine()
|
|
98
|
-
# Use dodal device for move
|
|
99
|
-
detector_stage = i24.detector_motion()
|
|
100
|
-
RE(setup_detector_stage(detector_stage, expt_type))
|