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,476 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Extruder data collection
|
|
3
|
-
This version in python3 new Feb2021 by RLO
|
|
4
|
-
- March 21 added logging and Eiger functionality
|
|
5
|
-
"""
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
|
|
8
|
-
import argparse
|
|
9
|
-
import logging
|
|
10
|
-
import re
|
|
11
|
-
import sys
|
|
12
|
-
import time
|
|
13
|
-
from datetime import datetime
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
from time import sleep
|
|
16
|
-
|
|
17
|
-
from mx_bluesky.I24.serial import log
|
|
18
|
-
from mx_bluesky.I24.serial.dcid import DCID
|
|
19
|
-
from mx_bluesky.I24.serial.parameters import SSXType
|
|
20
|
-
from mx_bluesky.I24.serial.parameters.constants import PARAM_FILE_PATH
|
|
21
|
-
from mx_bluesky.I24.serial.setup_beamline import Eiger, Pilatus, caget, caput, pv
|
|
22
|
-
from mx_bluesky.I24.serial.setup_beamline import setup_beamline as sup
|
|
23
|
-
from mx_bluesky.I24.serial.setup_beamline.setup_detector import get_detector_type
|
|
24
|
-
from mx_bluesky.I24.serial.write_nexus import call_nexgen
|
|
25
|
-
|
|
26
|
-
usage = "%(prog)s command [options]"
|
|
27
|
-
logger = logging.getLogger("I24ssx.extruder")
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def setup_logging():
|
|
31
|
-
logfile = time.strftime("i24extruder_%d%B%y.log").lower()
|
|
32
|
-
log.config(logfile)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def flush_print(text):
|
|
36
|
-
sys.stdout.write(str(text))
|
|
37
|
-
sys.stdout.flush()
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def _coerce_to_path(path: Path | str) -> Path:
|
|
41
|
-
if not isinstance(path, Path):
|
|
42
|
-
return Path(path)
|
|
43
|
-
return path
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@log.log_on_entry
|
|
47
|
-
def initialise_extruderi24(args=None):
|
|
48
|
-
logger.info("Initialise Parameters for extruder data collection on I24.")
|
|
49
|
-
|
|
50
|
-
visit = caget(pv.ioc12_gp1)
|
|
51
|
-
logger.info("Visit defined %s" % visit)
|
|
52
|
-
|
|
53
|
-
# Define detector in use
|
|
54
|
-
det_type = get_detector_type()
|
|
55
|
-
|
|
56
|
-
caput(pv.ioc12_gp2, "test")
|
|
57
|
-
caput(pv.ioc12_gp3, "testrun")
|
|
58
|
-
caput(pv.ioc12_gp4, "100")
|
|
59
|
-
caput(pv.ioc12_gp5, "0.01")
|
|
60
|
-
caput(pv.ioc12_gp6, 0)
|
|
61
|
-
caput(pv.ioc12_gp8, 0) # status PV do not reuse gp8 for something else
|
|
62
|
-
caput(pv.ioc12_gp9, 0)
|
|
63
|
-
caput(pv.ioc12_gp10, 0)
|
|
64
|
-
caput(pv.ioc12_gp15, det_type.name)
|
|
65
|
-
caput(pv.pilat_cbftemplate, 0)
|
|
66
|
-
logger.info("Initialisation complete.")
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@log.log_on_entry
|
|
70
|
-
def moveto(args):
|
|
71
|
-
place = args.place
|
|
72
|
-
logger.info("Move to: %s" % place)
|
|
73
|
-
|
|
74
|
-
det_type = get_detector_type()
|
|
75
|
-
|
|
76
|
-
if place == "laseron":
|
|
77
|
-
if isinstance(det_type, Pilatus):
|
|
78
|
-
caput(pv.zebra1_out1_ttl, 60.0)
|
|
79
|
-
caput(pv.zebra1_soft_in_b0, 1.0)
|
|
80
|
-
elif isinstance(det_type, Eiger):
|
|
81
|
-
caput(pv.zebra1_out2_ttl, 60.0)
|
|
82
|
-
caput(pv.zebra1_soft_in_b0, 1.0)
|
|
83
|
-
|
|
84
|
-
if place == "laseroff":
|
|
85
|
-
if isinstance(det_type, Pilatus):
|
|
86
|
-
caput(pv.zebra1_soft_in_b0, 0.0)
|
|
87
|
-
caput(pv.zebra1_out1_ttl, 0.0)
|
|
88
|
-
elif isinstance(det_type, Eiger):
|
|
89
|
-
caput(pv.zebra1_soft_in_b0, 0.0)
|
|
90
|
-
caput(pv.zebra1_out2_ttl, 0.0)
|
|
91
|
-
|
|
92
|
-
if place == "enterhutch":
|
|
93
|
-
caput(pv.det_z, 1480)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@log.log_on_entry
|
|
97
|
-
def write_parameter_file(param_path: Path | str = PARAM_FILE_PATH):
|
|
98
|
-
param_path = _coerce_to_path(param_path)
|
|
99
|
-
param_fid = "parameters.txt"
|
|
100
|
-
|
|
101
|
-
logger.info("Writing Parameter File to: %s \n" % (param_path / param_fid))
|
|
102
|
-
|
|
103
|
-
visit = caget(pv.ioc12_gp1)
|
|
104
|
-
directory = caget(pv.ioc12_gp2)
|
|
105
|
-
filename = caget(pv.ioc12_gp3)
|
|
106
|
-
num_imgs = caget(pv.ioc12_gp4)
|
|
107
|
-
exp_time = caget(pv.ioc12_gp5)
|
|
108
|
-
det_dist = caget(pv.ioc12_gp7)
|
|
109
|
-
det_type = get_detector_type()
|
|
110
|
-
if int(caget(pv.ioc12_gp6)) == 1:
|
|
111
|
-
pump_status = "true"
|
|
112
|
-
else:
|
|
113
|
-
pump_status = "false"
|
|
114
|
-
pump_exp = caget(pv.ioc12_gp9)
|
|
115
|
-
pump_delay = caget(pv.ioc12_gp10)
|
|
116
|
-
|
|
117
|
-
# If file name ends in a digit this causes processing/pilatus pain.
|
|
118
|
-
# Append an underscore
|
|
119
|
-
if det_type.name == "pilatus":
|
|
120
|
-
m = re.search(r"\d+$", filename)
|
|
121
|
-
if m is not None:
|
|
122
|
-
# Note for future reference. Appending underscore causes more hassle and
|
|
123
|
-
# high probability of users accidentally overwriting data. Use a dash
|
|
124
|
-
filename = filename + "-"
|
|
125
|
-
logger.info(
|
|
126
|
-
"Requested filename ends in a number. Appended dash: %s" % filename
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
with open(param_path / param_fid, "w") as f:
|
|
130
|
-
f.write("visit \t\t%s\n" % visit)
|
|
131
|
-
f.write("directory \t%s\n" % directory)
|
|
132
|
-
f.write("filename \t%s\n" % filename)
|
|
133
|
-
f.write("num_imgs \t%s\n" % num_imgs)
|
|
134
|
-
f.write("exp_time \t%s\n" % exp_time)
|
|
135
|
-
f.write("det_dist \t%s\n" % det_dist)
|
|
136
|
-
f.write("det_type \t%s\n" % det_type.name)
|
|
137
|
-
f.write("pump_probe \t%s\n" % pump_status)
|
|
138
|
-
f.write("pump_exp \t%s\n" % pump_exp)
|
|
139
|
-
f.write("pump_delay \t%s\n" % pump_delay)
|
|
140
|
-
|
|
141
|
-
logger.info("Parameters \n")
|
|
142
|
-
logger.info("visit %s" % visit)
|
|
143
|
-
logger.info("directory %s" % directory)
|
|
144
|
-
logger.info("filename %s" % filename)
|
|
145
|
-
logger.info("num_imgs %s" % num_imgs)
|
|
146
|
-
logger.info("exp_time %s" % exp_time)
|
|
147
|
-
logger.info("det_dist %s" % det_dist)
|
|
148
|
-
logger.info("det_type %s" % det_type.name)
|
|
149
|
-
logger.info("pump_probe %s" % pump_status)
|
|
150
|
-
logger.info("pump_exp %s" % pump_exp)
|
|
151
|
-
logger.info("pump_delay %s" % pump_delay)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def scrape_parameter_file(param_path: Path | str = PARAM_FILE_PATH):
|
|
155
|
-
param_path = _coerce_to_path(param_path)
|
|
156
|
-
|
|
157
|
-
with open(param_path / "parameters.txt", "r") as filein:
|
|
158
|
-
f = filein.readlines()
|
|
159
|
-
for line in f:
|
|
160
|
-
entry = line.rstrip().split()
|
|
161
|
-
if line.startswith("visit"):
|
|
162
|
-
visit = entry[1]
|
|
163
|
-
elif line.startswith("directory"):
|
|
164
|
-
directory = entry[1]
|
|
165
|
-
elif line.startswith("filename"):
|
|
166
|
-
filename = entry[1]
|
|
167
|
-
elif "num_imgs" in entry[0].lower():
|
|
168
|
-
num_imgs = entry[1]
|
|
169
|
-
elif "exp_time" in entry[0].lower():
|
|
170
|
-
exp_time = entry[1]
|
|
171
|
-
elif "det_dist" in entry[0].lower():
|
|
172
|
-
det_dist = entry[1]
|
|
173
|
-
elif "det_type" in entry[0].lower():
|
|
174
|
-
det_type = entry[1]
|
|
175
|
-
elif "pump_probe" in entry[0].lower():
|
|
176
|
-
pump_status = entry[1]
|
|
177
|
-
elif "pump_exp" in entry[0].lower():
|
|
178
|
-
pump_exp = entry[1]
|
|
179
|
-
elif "pump_delay" in entry[0].lower():
|
|
180
|
-
pump_delay = entry[1]
|
|
181
|
-
return (
|
|
182
|
-
visit,
|
|
183
|
-
directory,
|
|
184
|
-
filename,
|
|
185
|
-
num_imgs,
|
|
186
|
-
exp_time,
|
|
187
|
-
det_dist,
|
|
188
|
-
det_type,
|
|
189
|
-
pump_status,
|
|
190
|
-
pump_exp,
|
|
191
|
-
pump_delay,
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
@log.log_on_entry
|
|
196
|
-
def run_extruderi24(args=None):
|
|
197
|
-
start_time = datetime.now()
|
|
198
|
-
logger.info("Collection start time: %s" % start_time.ctime())
|
|
199
|
-
|
|
200
|
-
write_parameter_file()
|
|
201
|
-
(
|
|
202
|
-
visit,
|
|
203
|
-
directory,
|
|
204
|
-
filename,
|
|
205
|
-
num_imgs,
|
|
206
|
-
exp_time,
|
|
207
|
-
det_dist,
|
|
208
|
-
det_type,
|
|
209
|
-
pump_status,
|
|
210
|
-
pump_exp,
|
|
211
|
-
pump_delay,
|
|
212
|
-
) = scrape_parameter_file()
|
|
213
|
-
|
|
214
|
-
# Setting up the beamline
|
|
215
|
-
caput("BL24I-PS-SHTR-01:CON", "Reset")
|
|
216
|
-
logger.debug("Reset hutch shutter sleep for 1sec")
|
|
217
|
-
sleep(1.0)
|
|
218
|
-
caput("BL24I-PS-SHTR-01:CON", "Open")
|
|
219
|
-
logger.debug("Open hutch shutter sleep for 2sec")
|
|
220
|
-
sleep(2.0)
|
|
221
|
-
|
|
222
|
-
sup.beamline("collect")
|
|
223
|
-
sup.beamline("quickshot", [det_dist])
|
|
224
|
-
|
|
225
|
-
# Set the abort PV to zero
|
|
226
|
-
caput(pv.ioc12_gp8, 0)
|
|
227
|
-
|
|
228
|
-
# For pixel detector
|
|
229
|
-
filepath = visit + directory
|
|
230
|
-
logger.info("Filepath %s" % filepath)
|
|
231
|
-
logger.info("Filename %s" % filename)
|
|
232
|
-
|
|
233
|
-
# For zebra
|
|
234
|
-
# The below will need to be determined emprically. A value of 0.0 may be ok (????)
|
|
235
|
-
probepumpbuffer = 0.01
|
|
236
|
-
|
|
237
|
-
gate_start = 1.0
|
|
238
|
-
# Need to check these for pilatus.
|
|
239
|
-
# Added temprary hack in pilatus pump is false below as gate width wrong
|
|
240
|
-
gate_width = float(pump_exp) + float(pump_delay) + float(exp_time)
|
|
241
|
-
gate_step = float(gate_width) + float(probepumpbuffer)
|
|
242
|
-
logger.info("Calculated gate width %.4f" % gate_width)
|
|
243
|
-
logger.info("Calculated gate step %.4f" % gate_step)
|
|
244
|
-
num_gates = num_imgs
|
|
245
|
-
p1_delay = 0
|
|
246
|
-
p1_width = pump_exp
|
|
247
|
-
p2_delay = pump_delay
|
|
248
|
-
p2_width = exp_time
|
|
249
|
-
|
|
250
|
-
if det_type == "pilatus":
|
|
251
|
-
logger.debug("Using pilatus mini cbf")
|
|
252
|
-
caput(pv.pilat_cbftemplate, 0)
|
|
253
|
-
logger.info("Pilatus quickshot setup: filepath %s" % filepath)
|
|
254
|
-
logger.info("Pilatus quickshot setup: filepath %s" % filename)
|
|
255
|
-
logger.info("Pilatus quickshot setup: number of images %d" % num_imgs)
|
|
256
|
-
logger.info("Pilatus quickshot setup: exposure time %s" % exp_time)
|
|
257
|
-
|
|
258
|
-
if pump_status == "true":
|
|
259
|
-
logger.info("Pump probe extruder data collection")
|
|
260
|
-
logger.info("Pump exposure time %s" % pump_exp)
|
|
261
|
-
logger.info("Pump delay time %s" % pump_delay)
|
|
262
|
-
sup.pilatus("fastchip", [filepath, filename, num_imgs, exp_time])
|
|
263
|
-
sup.zebra1(
|
|
264
|
-
"zebratrigger-pilatus",
|
|
265
|
-
[
|
|
266
|
-
gate_start,
|
|
267
|
-
gate_width,
|
|
268
|
-
num_gates,
|
|
269
|
-
gate_step,
|
|
270
|
-
p1_delay,
|
|
271
|
-
p1_width,
|
|
272
|
-
p2_delay,
|
|
273
|
-
p2_width,
|
|
274
|
-
],
|
|
275
|
-
)
|
|
276
|
-
elif pump_status == "false":
|
|
277
|
-
logger.info("Static experiment: no photoexcitation")
|
|
278
|
-
sup.pilatus("quickshot", [filepath, filename, num_imgs, exp_time])
|
|
279
|
-
gate_start = 1.0
|
|
280
|
-
gate_width = (float(exp_time) * float(num_imgs)) + float(0.5)
|
|
281
|
-
sup.zebra1("quickshot", [gate_start, gate_width])
|
|
282
|
-
|
|
283
|
-
elif det_type == "eiger":
|
|
284
|
-
logger.info("Using Eiger detector")
|
|
285
|
-
|
|
286
|
-
logger.warning(
|
|
287
|
-
"""TEMPORARY HACK!
|
|
288
|
-
Running a Single image pilatus data collection to create directory."""
|
|
289
|
-
) # See https://github.com/DiamondLightSource/mx_bluesky/issues/45
|
|
290
|
-
num_shots = 1
|
|
291
|
-
sup.pilatus("quickshot-internaltrig", [filepath, filename, num_shots, exp_time])
|
|
292
|
-
logger.debug("Sleep 2s waiting for pilatus to arm")
|
|
293
|
-
sleep(2.5)
|
|
294
|
-
caput(pv.pilat_acquire, "0") # Disarm pilatus
|
|
295
|
-
sleep(0.5)
|
|
296
|
-
caput(pv.pilat_acquire, "1") # Arm pilatus
|
|
297
|
-
logger.debug("Pilatus data collection DONE")
|
|
298
|
-
sup.pilatus("return to normal")
|
|
299
|
-
logger.info("Pilatus back to normal. Single image pilatus data collection DONE")
|
|
300
|
-
|
|
301
|
-
caput(pv.eiger_seqID, int(caget(pv.eiger_seqID)) + 1)
|
|
302
|
-
logger.info("Eiger quickshot setup: filepath %s" % filepath)
|
|
303
|
-
logger.info("Eiger quickshot setup: filepath %s" % filename)
|
|
304
|
-
logger.info("Eiger quickshot setup: number of images %s" % num_imgs)
|
|
305
|
-
logger.info("Eiger quickshot setup: exposure time %s" % exp_time)
|
|
306
|
-
|
|
307
|
-
if pump_status == "true":
|
|
308
|
-
logger.info("Pump probe extruder data collection")
|
|
309
|
-
logger.info("Pump exposure time %s" % pump_exp)
|
|
310
|
-
logger.info("Pump delay time %s" % pump_delay)
|
|
311
|
-
sup.eiger("triggered", [filepath, filename, num_imgs, exp_time])
|
|
312
|
-
sup.zebra1(
|
|
313
|
-
"zebratrigger-eiger",
|
|
314
|
-
[
|
|
315
|
-
gate_start,
|
|
316
|
-
gate_width,
|
|
317
|
-
num_gates,
|
|
318
|
-
gate_step,
|
|
319
|
-
p1_delay,
|
|
320
|
-
p1_width,
|
|
321
|
-
p2_delay,
|
|
322
|
-
p2_width,
|
|
323
|
-
],
|
|
324
|
-
)
|
|
325
|
-
elif pump_status == "false":
|
|
326
|
-
logger.info("Static experiment: no photoexcitation")
|
|
327
|
-
gate_start = 1.0
|
|
328
|
-
gate_width = (float(exp_time) * float(num_imgs)) + float(0.5)
|
|
329
|
-
sup.eiger("quickshot", [filepath, filename, num_imgs, exp_time])
|
|
330
|
-
sup.zebra1("quickshot", [gate_start, gate_width])
|
|
331
|
-
else:
|
|
332
|
-
err = "Unknown Detector Type, det_type = %s" % det_type
|
|
333
|
-
logger.error(err)
|
|
334
|
-
raise ValueError(err)
|
|
335
|
-
|
|
336
|
-
# Do DCID creation BEFORE arming the detector
|
|
337
|
-
dcid = DCID(
|
|
338
|
-
emit_errors=False,
|
|
339
|
-
ssx_type=SSXType.EXTRUDER,
|
|
340
|
-
visit=Path(visit).name,
|
|
341
|
-
image_dir=filepath,
|
|
342
|
-
start_time=start_time,
|
|
343
|
-
num_images=num_imgs,
|
|
344
|
-
exposure_time=exp_time,
|
|
345
|
-
)
|
|
346
|
-
|
|
347
|
-
# Collect
|
|
348
|
-
logger.info("Fast shutter opening")
|
|
349
|
-
caput(pv.zebra1_soft_in_b1, 1)
|
|
350
|
-
if det_type == "pilatus":
|
|
351
|
-
logger.info("Pilatus acquire ON")
|
|
352
|
-
caput(pv.pilat_acquire, 1)
|
|
353
|
-
elif det_type == "eiger":
|
|
354
|
-
logger.info("Triggering Eiger NOW")
|
|
355
|
-
caput(pv.eiger_trigger, 1)
|
|
356
|
-
|
|
357
|
-
dcid.notify_start()
|
|
358
|
-
|
|
359
|
-
param_file_tuple = scrape_parameter_file()
|
|
360
|
-
if det_type == "eiger":
|
|
361
|
-
logger.info("Call nexgen server for nexus writing.")
|
|
362
|
-
call_nexgen(None, start_time, param_file_tuple, "extruder")
|
|
363
|
-
|
|
364
|
-
aborted = False
|
|
365
|
-
timeout_time = time.time() + int(num_imgs) * float(exp_time) + 10
|
|
366
|
-
|
|
367
|
-
if int(caget(pv.ioc12_gp8)) == 0: # ioc12_gp8 is the ABORT button
|
|
368
|
-
caput(pv.zebra1_pc_arm, 1)
|
|
369
|
-
sleep(gate_start)
|
|
370
|
-
i = 0
|
|
371
|
-
text_list = ["|", "/", "-", "\\"]
|
|
372
|
-
while True:
|
|
373
|
-
line_of_text = "\r\t\t\t Waiting " + 30 * ("%s" % text_list[i % 4])
|
|
374
|
-
flush_print(line_of_text)
|
|
375
|
-
sleep(0.5)
|
|
376
|
-
i += 1
|
|
377
|
-
if int(caget(pv.ioc12_gp8)) != 0:
|
|
378
|
-
aborted = True
|
|
379
|
-
logger.warning("Data Collection Aborted")
|
|
380
|
-
if det_type == "pilatus":
|
|
381
|
-
caput(pv.pilat_acquire, 0)
|
|
382
|
-
elif det_type == "eiger":
|
|
383
|
-
caput(pv.eiger_acquire, 0)
|
|
384
|
-
sleep(1.0)
|
|
385
|
-
break
|
|
386
|
-
elif int(caget(pv.zebra1_pc_arm_out)) != 1:
|
|
387
|
-
# As soon as the zebra1_pc_arm_out is not 1 anymore, exit.
|
|
388
|
-
# Epics checks the geobrick and updates this PV once the collection is done.
|
|
389
|
-
logger.info("----> Zebra disarmed <----")
|
|
390
|
-
break
|
|
391
|
-
elif time.time() >= timeout_time:
|
|
392
|
-
logger.warning(
|
|
393
|
-
"""
|
|
394
|
-
Something went wrong and data collection timed out. Aborting.
|
|
395
|
-
"""
|
|
396
|
-
)
|
|
397
|
-
if det_type == "pilatus":
|
|
398
|
-
caput(pv.pilat_acquire, 0)
|
|
399
|
-
elif det_type == "eiger":
|
|
400
|
-
caput(pv.eiger_acquire, 0)
|
|
401
|
-
sleep(1.0)
|
|
402
|
-
break
|
|
403
|
-
else:
|
|
404
|
-
aborted = True
|
|
405
|
-
logger.warning("Data Collection ended due to GP 8 not equalling 0")
|
|
406
|
-
|
|
407
|
-
caput(pv.ioc12_gp8, 1)
|
|
408
|
-
logger.info("Fast shutter closing")
|
|
409
|
-
caput(pv.zebra1_soft_in_b1, 0)
|
|
410
|
-
logger.info("\nZebra DISARMED")
|
|
411
|
-
caput(pv.zebra1_pc_disarm, 1)
|
|
412
|
-
|
|
413
|
-
end_time = datetime.now()
|
|
414
|
-
|
|
415
|
-
if det_type == "pilatus":
|
|
416
|
-
logger.info("Pilatus Acquire STOP")
|
|
417
|
-
caput(pv.pilat_acquire, 0)
|
|
418
|
-
elif det_type == "eiger":
|
|
419
|
-
logger.info("Eiger Acquire STOP")
|
|
420
|
-
caput(pv.eiger_acquire, 0)
|
|
421
|
-
caput(pv.eiger_ODcapture, "Done")
|
|
422
|
-
|
|
423
|
-
sleep(0.5)
|
|
424
|
-
|
|
425
|
-
# Clean Up
|
|
426
|
-
logger.info("Setting zebra back to normal")
|
|
427
|
-
sup.zebra1("return-to-normal")
|
|
428
|
-
if det_type == "pilatus":
|
|
429
|
-
sup.pilatus("return-to-normal")
|
|
430
|
-
elif det_type == "eiger":
|
|
431
|
-
sup.eiger("return-to-normal")
|
|
432
|
-
print(filename + "_" + caget(pv.eiger_seqID))
|
|
433
|
-
logger.info("End of Run")
|
|
434
|
-
logger.info("Close hutch shutter")
|
|
435
|
-
caput("BL24I-PS-SHTR-01:CON", "Close")
|
|
436
|
-
|
|
437
|
-
dcid.collection_complete(end_time, aborted=aborted)
|
|
438
|
-
dcid.notify_end()
|
|
439
|
-
logger.info("End Time = %s" % end_time.ctime())
|
|
440
|
-
return 1
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
if __name__ == "__main__":
|
|
444
|
-
setup_logging()
|
|
445
|
-
|
|
446
|
-
parser = argparse.ArgumentParser(usage=usage, description=__doc__)
|
|
447
|
-
subparsers = parser.add_subparsers(
|
|
448
|
-
help="Choose command.",
|
|
449
|
-
required=True,
|
|
450
|
-
dest="sub-command",
|
|
451
|
-
)
|
|
452
|
-
|
|
453
|
-
parser_init = subparsers.add_parser(
|
|
454
|
-
"initialise",
|
|
455
|
-
description="Initialise extruder on beamline I24.",
|
|
456
|
-
)
|
|
457
|
-
parser_init.set_defaults(func=initialise_extruderi24)
|
|
458
|
-
parser_run = subparsers.add_parser(
|
|
459
|
-
"run",
|
|
460
|
-
description="Run extruder on I24.",
|
|
461
|
-
)
|
|
462
|
-
parser_run.set_defaults(func=run_extruderi24)
|
|
463
|
-
parser_mv = subparsers.add_parser(
|
|
464
|
-
"moveto",
|
|
465
|
-
description="Move extruder to requested setting on I24.",
|
|
466
|
-
)
|
|
467
|
-
parser_mv.add_argument(
|
|
468
|
-
"place",
|
|
469
|
-
type=str,
|
|
470
|
-
choices=["laseron", "laseroff", "enterhutch"],
|
|
471
|
-
help="Requested setting.",
|
|
472
|
-
)
|
|
473
|
-
parser_mv.set_defaults(func=moveto)
|
|
474
|
-
|
|
475
|
-
args = parser.parse_args()
|
|
476
|
-
args.func(args)
|