mx-bluesky 1.5.4__py3-none-any.whl → 1.5.5__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/_version.py +2 -2
- mx_bluesky/beamlines/i04/__init__.py +6 -1
- mx_bluesky/beamlines/i04/redis_to_murko_forwarder.py +2 -3
- mx_bluesky/beamlines/i04/thawing_plan.py +173 -59
- mx_bluesky/beamlines/i24/serial/blueapi_config.yaml +1 -1
- mx_bluesky/beamlines/i24/serial/dcid.py +4 -25
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DetStage.edl +4 -7
- mx_bluesky/beamlines/i24/serial/extruder/EX-gui-edm/DiamondExtruder-I24-py3v1.edl +5 -5
- mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +18 -107
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/CustomChip_py3v1.edl +1 -1
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DetStage.edl +1 -4
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +13 -13
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/MappingLite-oxford_py3v1.edl +8 -8
- mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/pumpprobe-py3v1.edl +7 -7
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +8 -92
- mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +2 -18
- mx_bluesky/beamlines/i24/serial/parameters/constants.py +0 -2
- mx_bluesky/beamlines/i24/serial/parameters/experiment_parameters.py +1 -6
- mx_bluesky/beamlines/i24/serial/parameters/fixed_target/cs/cs_maker.json +3 -3
- mx_bluesky/beamlines/i24/serial/run_extruder.sh +15 -0
- mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +17 -0
- mx_bluesky/beamlines/i24/serial/set_visit_directory.sh +1 -1
- mx_bluesky/beamlines/i24/serial/setup_beamline/__init__.py +1 -2
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv.py +0 -25
- mx_bluesky/beamlines/i24/serial/setup_beamline/pv_abstract.py +1 -30
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +0 -94
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +4 -10
- mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +12 -20
- mx_bluesky/beamlines/i24/serial/web_gui_plans/general_plans.py +4 -13
- mx_bluesky/beamlines/i24/serial/write_nexus.py +34 -9
- mx_bluesky/common/external_interaction/callbacks/common/ispyb_callback_base.py +1 -1
- mx_bluesky/common/external_interaction/callbacks/common/plan_reactive_callback.py +2 -2
- mx_bluesky/common/external_interaction/callbacks/xray_centre/ispyb_callback.py +2 -2
- mx_bluesky/common/external_interaction/callbacks/xray_centre/nexus_callback.py +2 -2
- mx_bluesky/hyperion/baton_handler.py +41 -4
- mx_bluesky/hyperion/external_interaction/alerting/constants.py +2 -7
- mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +2 -2
- {mx_bluesky-1.5.4.dist-info → mx_bluesky-1.5.5.dist-info}/METADATA +2 -2
- {mx_bluesky-1.5.4.dist-info → mx_bluesky-1.5.5.dist-info}/RECORD +43 -43
- {mx_bluesky-1.5.4.dist-info → mx_bluesky-1.5.5.dist-info}/WHEEL +0 -0
- {mx_bluesky-1.5.4.dist-info → mx_bluesky-1.5.5.dist-info}/entry_points.txt +0 -0
- {mx_bluesky-1.5.4.dist-info → mx_bluesky-1.5.5.dist-info}/licenses/LICENSE +0 -0
- {mx_bluesky-1.5.4.dist-info → mx_bluesky-1.5.5.dist-info}/top_level.txt +0 -0
|
@@ -18,14 +18,12 @@ from dodal.devices.i24.beamstop import Beamstop
|
|
|
18
18
|
from dodal.devices.i24.dcm import DCM
|
|
19
19
|
from dodal.devices.i24.dual_backlight import DualBacklight
|
|
20
20
|
from dodal.devices.i24.focus_mirrors import FocusMirrorsMode
|
|
21
|
-
from dodal.devices.i24.pilatus_metadata import PilatusMetadata
|
|
22
21
|
from dodal.devices.i24.pmac import PMAC
|
|
23
22
|
from dodal.devices.motors import YZStage
|
|
24
23
|
from dodal.devices.zebra.zebra import Zebra
|
|
25
24
|
|
|
26
25
|
from mx_bluesky.beamlines.i24.serial.dcid import (
|
|
27
26
|
DCID,
|
|
28
|
-
get_pilatus_filename_template_from_device,
|
|
29
27
|
read_beam_info_from_hardware,
|
|
30
28
|
)
|
|
31
29
|
from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import (
|
|
@@ -41,7 +39,6 @@ from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER, log_on_entry
|
|
|
41
39
|
from mx_bluesky.beamlines.i24.serial.parameters import FixedTargetParameters
|
|
42
40
|
from mx_bluesky.beamlines.i24.serial.parameters.constants import (
|
|
43
41
|
BEAM_CENTER_LUT_FILES,
|
|
44
|
-
DetectorName,
|
|
45
42
|
)
|
|
46
43
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import caget, cagetstring, caput, pv
|
|
47
44
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import setup_beamline as sup
|
|
@@ -276,7 +273,6 @@ def start_i24(
|
|
|
276
273
|
mirrors: FocusMirrorsMode,
|
|
277
274
|
beam_center_device: DetectorBeamCenter,
|
|
278
275
|
dcid: DCID,
|
|
279
|
-
pilatus_metadata: PilatusMetadata,
|
|
280
276
|
):
|
|
281
277
|
"""Set up for I24 fixed target data collection, trigger the detector and open \
|
|
282
278
|
the hutch shutter.
|
|
@@ -312,67 +308,7 @@ def start_i24(
|
|
|
312
308
|
SSX_LOGGER.info(f"Number of exposures: {parameters.num_exposures}")
|
|
313
309
|
SSX_LOGGER.info(f"Number of gates (=Total images/N exposures): {num_gates:.4f}")
|
|
314
310
|
|
|
315
|
-
if parameters.detector_name == "
|
|
316
|
-
SSX_LOGGER.info("Using Pilatus detector")
|
|
317
|
-
SSX_LOGGER.info(f"Fastchip Pilatus setup: filepath {filepath}")
|
|
318
|
-
SSX_LOGGER.info(f"Fastchip Pilatus setup: filename {filename}")
|
|
319
|
-
SSX_LOGGER.info(
|
|
320
|
-
f"Fastchip Pilatus setup: number of images {parameters.total_num_images}"
|
|
321
|
-
)
|
|
322
|
-
SSX_LOGGER.info(
|
|
323
|
-
f"Fastchip Pilatus setup: exposure time {parameters.exposure_time_s}"
|
|
324
|
-
)
|
|
325
|
-
|
|
326
|
-
yield from sup.pilatus(
|
|
327
|
-
"fastchip",
|
|
328
|
-
[
|
|
329
|
-
filepath,
|
|
330
|
-
filename,
|
|
331
|
-
parameters.total_num_images,
|
|
332
|
-
parameters.exposure_time_s,
|
|
333
|
-
],
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
# DCID process depends on detector PVs being set up already
|
|
337
|
-
SSX_LOGGER.debug("Start DCID process")
|
|
338
|
-
filetemplate = yield from get_pilatus_filename_template_from_device(
|
|
339
|
-
pilatus_metadata
|
|
340
|
-
)
|
|
341
|
-
dcid.generate_dcid(
|
|
342
|
-
beam_settings=beam_settings,
|
|
343
|
-
image_dir=filepath,
|
|
344
|
-
file_template=filetemplate,
|
|
345
|
-
num_images=parameters.total_num_images,
|
|
346
|
-
shots_per_position=parameters.num_exposures,
|
|
347
|
-
start_time=start_time,
|
|
348
|
-
pump_probe=bool(parameters.pump_repeat),
|
|
349
|
-
)
|
|
350
|
-
|
|
351
|
-
SSX_LOGGER.debug("Arm Pilatus. Arm Zebra.")
|
|
352
|
-
shutter_time_offset = (
|
|
353
|
-
SHUTTER_OPEN_TIME
|
|
354
|
-
if parameters.pump_repeat is PumpProbeSetting.Medium1
|
|
355
|
-
else 0.0
|
|
356
|
-
)
|
|
357
|
-
yield from setup_zebra_for_fastchip_plan(
|
|
358
|
-
zebra,
|
|
359
|
-
parameters.detector_name,
|
|
360
|
-
num_gates,
|
|
361
|
-
parameters.num_exposures,
|
|
362
|
-
parameters.exposure_time_s,
|
|
363
|
-
shutter_time_offset,
|
|
364
|
-
wait=True,
|
|
365
|
-
)
|
|
366
|
-
if parameters.pump_repeat == PumpProbeSetting.Medium1:
|
|
367
|
-
yield from open_fast_shutter_at_each_position_plan(
|
|
368
|
-
zebra, parameters.num_exposures, parameters.exposure_time_s
|
|
369
|
-
)
|
|
370
|
-
caput(pv.pilat_acquire, "1") # Arm pilatus
|
|
371
|
-
yield from arm_zebra(zebra)
|
|
372
|
-
caput(pv.pilat_filename, filename)
|
|
373
|
-
yield from bps.sleep(1.5)
|
|
374
|
-
|
|
375
|
-
elif parameters.detector_name == "eiger":
|
|
311
|
+
if parameters.detector_name == "eiger":
|
|
376
312
|
SSX_LOGGER.info("Using Eiger detector")
|
|
377
313
|
|
|
378
314
|
SSX_LOGGER.debug(f"Creating the directory for the collection in {filepath}.")
|
|
@@ -458,22 +394,16 @@ def finish_i24(
|
|
|
458
394
|
)
|
|
459
395
|
|
|
460
396
|
complete_filename: str
|
|
461
|
-
transmission = float(caget(pv.
|
|
397
|
+
transmission = float(caget(pv.requested_transmission))
|
|
462
398
|
wavelength = yield from bps.rd(dcm.wavelength_in_a)
|
|
463
399
|
|
|
464
|
-
if parameters.detector_name == "
|
|
465
|
-
SSX_LOGGER.debug("Finish I24 Pilatus")
|
|
466
|
-
complete_filename = f"{parameters.filename}_{caget(pv.pilat_filenum)}"
|
|
467
|
-
yield from reset_zebra_when_collection_done_plan(zebra)
|
|
468
|
-
yield from sup.pilatus("return-to-normal", None)
|
|
469
|
-
yield from bps.sleep(0.2)
|
|
470
|
-
elif parameters.detector_name == "eiger":
|
|
400
|
+
if parameters.detector_name == "eiger":
|
|
471
401
|
SSX_LOGGER.debug("Finish I24 Eiger")
|
|
472
402
|
yield from reset_zebra_when_collection_done_plan(zebra)
|
|
473
403
|
yield from sup.eiger("return-to-normal", None, dcm)
|
|
474
404
|
complete_filename = cagetstring(pv.eiger_ODfilenameRBV) # type: ignore
|
|
475
405
|
else:
|
|
476
|
-
raise ValueError(f"{parameters.detector_name
|
|
406
|
+
raise ValueError(f"{parameters.detector_name} unrecognised")
|
|
477
407
|
|
|
478
408
|
# Detector independent moves
|
|
479
409
|
SSX_LOGGER.info("Move chip back to home position by setting PMAC_STRING pv.")
|
|
@@ -513,7 +443,6 @@ def main_fixed_target_plan(
|
|
|
513
443
|
beam_center_device: DetectorBeamCenter,
|
|
514
444
|
parameters: FixedTargetParameters,
|
|
515
445
|
dcid: DCID,
|
|
516
|
-
pilatus_metadata: PilatusMetadata,
|
|
517
446
|
) -> MsgGenerator:
|
|
518
447
|
SSX_LOGGER.info("Running a chip collection on I24")
|
|
519
448
|
|
|
@@ -558,7 +487,6 @@ def main_fixed_target_plan(
|
|
|
558
487
|
mirrors,
|
|
559
488
|
beam_center_device,
|
|
560
489
|
dcid,
|
|
561
|
-
pilatus_metadata,
|
|
562
490
|
)
|
|
563
491
|
|
|
564
492
|
SSX_LOGGER.info("Moving to Start")
|
|
@@ -578,7 +506,7 @@ def main_fixed_target_plan(
|
|
|
578
506
|
beam_x = yield from bps.rd(beam_center_device.beam_x)
|
|
579
507
|
beam_y = yield from bps.rd(beam_center_device.beam_y)
|
|
580
508
|
SSX_LOGGER.debug("Start nexus writing service.")
|
|
581
|
-
call_nexgen(
|
|
509
|
+
yield from call_nexgen(
|
|
582
510
|
chip_prog_dict, parameters, wavelength, (beam_x, beam_y), start_time
|
|
583
511
|
)
|
|
584
512
|
|
|
@@ -631,14 +559,11 @@ def tidy_up_after_collection_plan(
|
|
|
631
559
|
yield from bps.sleep(2.0)
|
|
632
560
|
|
|
633
561
|
# This probably should go in main then
|
|
634
|
-
if parameters.detector_name == "
|
|
635
|
-
SSX_LOGGER.debug("Pilatus Acquire STOP")
|
|
636
|
-
caput(pv.pilat_acquire, 0)
|
|
637
|
-
elif parameters.detector_name == "eiger":
|
|
562
|
+
if parameters.detector_name == "eiger":
|
|
638
563
|
SSX_LOGGER.debug("Eiger Acquire STOP")
|
|
639
564
|
caput(pv.eiger_acquire, 0)
|
|
640
565
|
caput(pv.eiger_ODcapture, "Done")
|
|
641
|
-
|
|
566
|
+
yield from bps.sleep(0.5)
|
|
642
567
|
|
|
643
568
|
yield from finish_i24(zebra, pmac, shutter, dcm, parameters)
|
|
644
569
|
|
|
@@ -663,8 +588,6 @@ def run_fixed_target_plan(
|
|
|
663
588
|
mirrors: FocusMirrorsMode = inject("focus_mirrors"),
|
|
664
589
|
attenuator: ReadOnlyAttenuator = inject("attenuator"),
|
|
665
590
|
beam_center_eiger: DetectorBeamCenter = inject("eiger_bc"),
|
|
666
|
-
beam_center_pilatus: DetectorBeamCenter = inject("pilatus_bc"),
|
|
667
|
-
pilatus_metadata: PilatusMetadata = inject("pilatus_meta"),
|
|
668
591
|
) -> MsgGenerator:
|
|
669
592
|
# Read the parameters
|
|
670
593
|
parameters: FixedTargetParameters = yield from read_parameters(
|
|
@@ -677,11 +600,7 @@ def run_fixed_target_plan(
|
|
|
677
600
|
if parameters.chip_map:
|
|
678
601
|
yield from upload_chip_map_to_geobrick(pmac, parameters.chip_map)
|
|
679
602
|
|
|
680
|
-
beam_center_device =
|
|
681
|
-
beam_center_eiger
|
|
682
|
-
if parameters.detector_name is DetectorName.EIGER
|
|
683
|
-
else beam_center_pilatus
|
|
684
|
-
)
|
|
603
|
+
beam_center_device = beam_center_eiger
|
|
685
604
|
|
|
686
605
|
# DCID instance - do not create yet
|
|
687
606
|
dcid = DCID(emit_errors=False, expt_params=parameters)
|
|
@@ -699,7 +618,6 @@ def run_fixed_target_plan(
|
|
|
699
618
|
beam_center_device,
|
|
700
619
|
parameters,
|
|
701
620
|
dcid,
|
|
702
|
-
pilatus_metadata,
|
|
703
621
|
)
|
|
704
622
|
|
|
705
623
|
|
|
@@ -716,7 +634,6 @@ def run_plan_in_wrapper(
|
|
|
716
634
|
beam_center_device: DetectorBeamCenter,
|
|
717
635
|
parameters: FixedTargetParameters,
|
|
718
636
|
dcid: DCID,
|
|
719
|
-
pilatus_metadata: PilatusMetadata,
|
|
720
637
|
) -> MsgGenerator:
|
|
721
638
|
yield from bpp.contingency_wrapper(
|
|
722
639
|
main_fixed_target_plan(
|
|
@@ -732,7 +649,6 @@ def run_plan_in_wrapper(
|
|
|
732
649
|
beam_center_device,
|
|
733
650
|
parameters,
|
|
734
651
|
dcid,
|
|
735
|
-
pilatus_metadata,
|
|
736
652
|
),
|
|
737
653
|
except_plan=lambda e: (yield from run_aborted_plan(pmac, dcid, e)),
|
|
738
654
|
final_plan=lambda: (
|
|
@@ -4,7 +4,6 @@ This version changed to python3 March2020 by RLO
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import json
|
|
7
|
-
import re
|
|
8
7
|
import sys
|
|
9
8
|
from pathlib import Path
|
|
10
9
|
from pprint import pformat
|
|
@@ -40,7 +39,7 @@ from mx_bluesky.beamlines.i24.serial.parameters.constants import (
|
|
|
40
39
|
PARAM_FILE_PATH_FT,
|
|
41
40
|
PVAR_FILE_PATH,
|
|
42
41
|
)
|
|
43
|
-
from mx_bluesky.beamlines.i24.serial.setup_beamline import
|
|
42
|
+
from mx_bluesky.beamlines.i24.serial.setup_beamline import caget, caput, pv
|
|
44
43
|
from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_detector import (
|
|
45
44
|
get_detector_type,
|
|
46
45
|
)
|
|
@@ -96,8 +95,6 @@ def initialise_stages(
|
|
|
96
95
|
yield from bps.abs_set(pmac.enc_reset, EncReset.ENC7, group=group)
|
|
97
96
|
yield from bps.abs_set(pmac.enc_reset, EncReset.ENC8, group=group)
|
|
98
97
|
|
|
99
|
-
caput(pv.pilat_cbftemplate, 0)
|
|
100
|
-
|
|
101
98
|
yield from bps.sleep(0.1)
|
|
102
99
|
SSX_LOGGER.info("Clearing General Purpose PVs 1-120")
|
|
103
100
|
for i in range(4, 120):
|
|
@@ -151,19 +148,6 @@ def read_parameters(
|
|
|
151
148
|
chip_map = []
|
|
152
149
|
pump_repeat = int(caget(PUMP_REPEAT_PV))
|
|
153
150
|
|
|
154
|
-
# If file name ends in a digit this causes processing/pilatus pain.
|
|
155
|
-
# Append an underscore
|
|
156
|
-
if isinstance(det_type, Pilatus):
|
|
157
|
-
caput(pv.pilat_cbftemplate, 0)
|
|
158
|
-
m = re.search(r"\d+$", filename)
|
|
159
|
-
if m is not None:
|
|
160
|
-
# Note for future reference. Appending underscore causes more hassle and
|
|
161
|
-
# high probability of users accidentally overwriting data. Use a dash
|
|
162
|
-
filename = filename + "-"
|
|
163
|
-
SSX_LOGGER.debug(
|
|
164
|
-
f"Requested filename ends in a number. Appended dash: {filename}"
|
|
165
|
-
)
|
|
166
|
-
|
|
167
151
|
transmission = yield from bps.rd(attenuator.actual_transmission)
|
|
168
152
|
|
|
169
153
|
params_dict = {
|
|
@@ -892,7 +876,7 @@ def pumpprobe_calc() -> MsgGenerator:
|
|
|
892
876
|
SSX_LOGGER.info("Calculate and show exposure and dwell time for each option.")
|
|
893
877
|
exptime = float(caget(pv.me14e_exptime))
|
|
894
878
|
pumpexptime = float(caget(pv.me14e_gp103))
|
|
895
|
-
movetime = 0.
|
|
879
|
+
movetime = 0.014
|
|
896
880
|
SSX_LOGGER.info(f"X-ray exposure time {exptime}")
|
|
897
881
|
SSX_LOGGER.info(f"Laser dwell time {pumpexptime}")
|
|
898
882
|
repeat1 = 2 * 20 * (movetime + (pumpexptime + exptime) / 2)
|
|
@@ -12,7 +12,6 @@ class SSXType(StrEnum):
|
|
|
12
12
|
|
|
13
13
|
class DetectorName(StrEnum):
|
|
14
14
|
EIGER = "eiger"
|
|
15
|
-
PILATUS = "pilatus"
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
# TODO figue sth out for tests
|
|
@@ -20,7 +19,6 @@ LUT_FILES_PATH = Path("/dls_sw/i24/software/daq_configuration/lookup")
|
|
|
20
19
|
|
|
21
20
|
BEAM_CENTER_LUT_FILES = {
|
|
22
21
|
DetectorName.EIGER: LUT_FILES_PATH / "DetDistToBeamXYConverterE9M.txt",
|
|
23
|
-
DetectorName.PILATUS: LUT_FILES_PATH / "DetDistToBeamXYConverterP6M.txt",
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
|
|
@@ -5,7 +5,6 @@ from pathlib import Path
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
from dodal.devices.detector.det_dim_constants import (
|
|
7
7
|
EIGER2_X_9M_SIZE,
|
|
8
|
-
PILATUS_6M_SIZE,
|
|
9
8
|
DetectorSizeConstants,
|
|
10
9
|
)
|
|
11
10
|
from pydantic import BaseModel, ConfigDict, computed_field, field_validator
|
|
@@ -46,11 +45,7 @@ class SerialExperiment(BaseModel):
|
|
|
46
45
|
|
|
47
46
|
@property
|
|
48
47
|
def detector_size_constants(self) -> DetectorSizeConstants:
|
|
49
|
-
return
|
|
50
|
-
EIGER2_X_9M_SIZE
|
|
51
|
-
if self.detector_name is DetectorName.EIGER
|
|
52
|
-
else PILATUS_6M_SIZE
|
|
53
|
-
)
|
|
48
|
+
return EIGER2_X_9M_SIZE
|
|
54
49
|
|
|
55
50
|
|
|
56
51
|
class LaserExperiment(BaseModel):
|
|
@@ -9,6 +9,21 @@ case "$2" in
|
|
|
9
9
|
;;
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
|
+
# Get visit from PV and set the instrument session thet will be read by the edms
|
|
13
|
+
# Hack to make the blueapi CLI happy as the client now requires an instrument session
|
|
14
|
+
# on every POST request. For the command line, that means a -i $INSTRUMENT_SESSION
|
|
15
|
+
visit_pv=BL24I-MO-IOC-13:GP1
|
|
16
|
+
visit=$(echo "$(caget -S $visit_pv)" | awk '{print $NF}')
|
|
17
|
+
session=${visit##$visit_pv}
|
|
18
|
+
echo $session
|
|
19
|
+
|
|
20
|
+
if [[ -z "$session" ]]; then
|
|
21
|
+
# if PV is empty print error message and exit
|
|
22
|
+
echo "The visit PV has not been set, please contact beamline staff"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
export INSTRUMENT_SESSION=$session
|
|
12
27
|
|
|
13
28
|
# Get edm path from input
|
|
14
29
|
edm_path=$1
|
|
@@ -9,6 +9,23 @@ case "$2" in
|
|
|
9
9
|
;;
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
|
+
# Get visit from PV and set the instrument session thet will be read by the edms
|
|
13
|
+
# Hack to make the blueapi CLI happy as the client now requires an instrument session
|
|
14
|
+
# on every POST request. For the command line, that means a -i $INSTRUMENT_SESSION
|
|
15
|
+
visit_pv=BL24I-MO-IOC-13:GP100
|
|
16
|
+
# visit=$(caget -S $ft_pv)
|
|
17
|
+
visit=$(echo "$(caget -S $visit_pv)" | awk '{print $NF}')
|
|
18
|
+
session=${visit##$visit_pv}
|
|
19
|
+
echo $session
|
|
20
|
+
|
|
21
|
+
if [[ -z "$session" ]]; then
|
|
22
|
+
# if PV is empty print error message and exit
|
|
23
|
+
echo "The visit PV has not been set, please contact beamline staff"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
export INSTRUMENT_SESSION=$session
|
|
28
|
+
|
|
12
29
|
# Get edm path from input
|
|
13
30
|
edm_path=$1
|
|
14
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from . import pv, setup_beamline
|
|
2
2
|
from .ca import caget, cagetstring, caput
|
|
3
|
-
from .pv_abstract import Detector, Eiger
|
|
3
|
+
from .pv_abstract import Detector, Eiger
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
6
|
"caget",
|
|
@@ -8,7 +8,6 @@ __all__ = [
|
|
|
8
8
|
"caput",
|
|
9
9
|
"Detector",
|
|
10
10
|
"Eiger",
|
|
11
|
-
"Pilatus",
|
|
12
11
|
"pv",
|
|
13
12
|
"setup_beamline",
|
|
14
13
|
]
|
|
@@ -25,31 +25,6 @@ def __which__():
|
|
|
25
25
|
|
|
26
26
|
requested_transmission = "BL24I-OP-ATTN-01:T2A:SETVAL1"
|
|
27
27
|
|
|
28
|
-
# PILATUS
|
|
29
|
-
pilat_filepath = "BL24I-EA-PILAT-01:cam1:FilePath"
|
|
30
|
-
pilat_filename = "BL24I-EA-PILAT-01:cam1:FileName"
|
|
31
|
-
pilat_filetemplate = "BL24I-EA-PILAT-01:cam1:FileTemplate"
|
|
32
|
-
pilat_numimages = "BL24I-EA-PILAT-01:cam1:NumImages"
|
|
33
|
-
pilat_numexpimage = "BL24I-EA-PILAT-01:cam1:NumExposures"
|
|
34
|
-
pilat_filenumber = "BL24I-EA-PILAT-01:cam1:FileNumber"
|
|
35
|
-
pilat_acquire = "BL24I-EA-PILAT-01:cam1:Acquire"
|
|
36
|
-
pilat_acquiretime = "BL24I-EA-PILAT-01:cam1:AcquireTime"
|
|
37
|
-
pilat_acquireperiod = "BL24I-EA-PILAT-01:cam1:AcquirePeriod"
|
|
38
|
-
pilat_imagemode = "BL24I-EA-PILAT-01:cam1:ImageMode"
|
|
39
|
-
pilat_triggermode = "BL24I-EA-PILAT-01:cam1:TriggerMode"
|
|
40
|
-
pilat_delaytime = "BL24I-EA-PILAT-01:cam1:DelayTime"
|
|
41
|
-
pilat_wavelength = "BL24I-EA-PILAT-01:cam1:Wavelength"
|
|
42
|
-
pilat_detdist = "BL24I-EA-PILAT-01:cam1:DetDist"
|
|
43
|
-
pilat_filtertrasm = "BL24I-EA-PILAT-01:cam1:FilterTransm"
|
|
44
|
-
pilat_filetemplate = "BL24I-EA-PILAT-01:cam1:FileTemplate"
|
|
45
|
-
pilat_beamx = "BL24I-EA-PILAT-01:cam1:BeamX"
|
|
46
|
-
pilat_beamy = "BL24I-EA-PILAT-01:cam1:BeamY"
|
|
47
|
-
pilat_startangle = "BL24I-EA-PILAT-01:cam1:StartAngle"
|
|
48
|
-
pilat_angleincr = "BL24I-EA-PILAT-01:cam1:AngleIncr"
|
|
49
|
-
pilat_omegaincr = "BL24I-EA-PILAT-01:cam1:OmegaIncr"
|
|
50
|
-
pilat_cbftemplate = "BL24I-EA-PILAT-01:cam1:CbfTemplateFile"
|
|
51
|
-
pilat_filenum = "BL24I-EA-PILAT-01:cam1:FileNumber_RBV"
|
|
52
|
-
|
|
53
28
|
|
|
54
29
|
# Eiger
|
|
55
30
|
eiger_filepath = "BL24I-EA-EIGER-01:CAM:FilePath"
|
|
@@ -8,35 +8,6 @@ abstract wrapper around them.
|
|
|
8
8
|
from mx_bluesky.beamlines.i24.serial.setup_beamline import pv
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class Pilatus:
|
|
12
|
-
id = 58
|
|
13
|
-
name = "pilatus"
|
|
14
|
-
|
|
15
|
-
# fast, slow / width, height
|
|
16
|
-
image_size_pixels = (2463, 2527)
|
|
17
|
-
pixel_size_mm = (0.172, 0.172)
|
|
18
|
-
image_size_mm = tuple(
|
|
19
|
-
round(a * b, 3) for a, b in zip(image_size_pixels, pixel_size_mm, strict=False)
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
det_y_threshold = 640.0
|
|
23
|
-
det_y_target = 647.0
|
|
24
|
-
|
|
25
|
-
class pv:
|
|
26
|
-
detector_distance = pv.pilat_detdist
|
|
27
|
-
wavelength = pv.pilat_wavelength
|
|
28
|
-
transmission = pv.pilat_filtertrasm
|
|
29
|
-
file_name = pv.pilat_filename
|
|
30
|
-
file_path = pv.pilat_filepath
|
|
31
|
-
file_template = pv.pilat_filetemplate
|
|
32
|
-
file_number = pv.pilat_filenumber
|
|
33
|
-
beamx = pv.pilat_beamx
|
|
34
|
-
beamy = pv.pilat_beamy
|
|
35
|
-
|
|
36
|
-
def __str__(self) -> str:
|
|
37
|
-
return self.name
|
|
38
|
-
|
|
39
|
-
|
|
40
11
|
class Eiger:
|
|
41
12
|
id = 94
|
|
42
13
|
name = "eiger"
|
|
@@ -68,4 +39,4 @@ class Eiger:
|
|
|
68
39
|
return self.name
|
|
69
40
|
|
|
70
41
|
|
|
71
|
-
Detector =
|
|
42
|
+
Detector = Eiger
|
|
@@ -275,100 +275,6 @@ def modechange(action):
|
|
|
275
275
|
return 1
|
|
276
276
|
|
|
277
277
|
|
|
278
|
-
def pilatus(action, args_list):
|
|
279
|
-
SSX_LOGGER.debug("***** Entering Pilatus")
|
|
280
|
-
SSX_LOGGER.info(f"Setup pilatus - {action}")
|
|
281
|
-
if args_list:
|
|
282
|
-
for arg in args_list:
|
|
283
|
-
SSX_LOGGER.debug(f"Argument: {arg}")
|
|
284
|
-
|
|
285
|
-
caput(pv.pilat_detdist, caget(pv.det_z))
|
|
286
|
-
caput(pv.pilat_filtertrasm, caget(pv.attn_match))
|
|
287
|
-
|
|
288
|
-
# Fixed Target stage (very fast start and stop w/ triggering from GeoBrick
|
|
289
|
-
if action == "fastchip":
|
|
290
|
-
[filepath, filename, total_numb_imgs, exptime] = args_list
|
|
291
|
-
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
292
|
-
acqtime = float(exptime) - 0.001
|
|
293
|
-
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
294
|
-
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
295
|
-
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
296
|
-
SSX_LOGGER.debug(f"total_numb_imgs {total_numb_imgs}")
|
|
297
|
-
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
298
|
-
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
299
|
-
caput(pv.pilat_startangle, 0.0)
|
|
300
|
-
caput(pv.pilat_angleincr, 0.0)
|
|
301
|
-
caput(pv.pilat_omegaincr, 0.0)
|
|
302
|
-
caput(pv.pilat_filepath, rampath + "/")
|
|
303
|
-
caput(pv.pilat_filename, filename)
|
|
304
|
-
caput(pv.pilat_numimages, str(total_numb_imgs))
|
|
305
|
-
caput(pv.pilat_acquiretime, str(acqtime))
|
|
306
|
-
caput(pv.pilat_acquireperiod, str(exptime))
|
|
307
|
-
caput(pv.pilat_imagemode, "Single")
|
|
308
|
-
caput(pv.pilat_triggermode, "Mult. Trigger")
|
|
309
|
-
caput(pv.pilat_delaytime, 0)
|
|
310
|
-
|
|
311
|
-
# Quick set of images no coordinated motion
|
|
312
|
-
elif action == "quickshot":
|
|
313
|
-
SSX_LOGGER.debug("quickshot")
|
|
314
|
-
[filepath, filename, num_imgs, exptime] = args_list
|
|
315
|
-
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
316
|
-
caput(pv.pilat_filepath, rampath)
|
|
317
|
-
yield from bps.sleep(0.1)
|
|
318
|
-
caput(pv.pilat_filename, filename)
|
|
319
|
-
yield from bps.sleep(0.1)
|
|
320
|
-
acqtime = float(exptime) - 0.001
|
|
321
|
-
caput(pv.pilat_acquiretime, str(acqtime))
|
|
322
|
-
caput(pv.pilat_acquireperiod, str(exptime))
|
|
323
|
-
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
324
|
-
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
325
|
-
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
326
|
-
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
327
|
-
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
328
|
-
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
329
|
-
SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
|
|
330
|
-
yield from bps.sleep(2)
|
|
331
|
-
caput(pv.pilat_delaytime, 0.00)
|
|
332
|
-
caput(pv.pilat_numimages, str(num_imgs))
|
|
333
|
-
caput(pv.pilat_imagemode, "Continuous")
|
|
334
|
-
caput(pv.pilat_triggermode, "Ext. Trigger")
|
|
335
|
-
yield from bps.sleep(0.2)
|
|
336
|
-
|
|
337
|
-
elif action == "quickshot-internaltrig":
|
|
338
|
-
SSX_LOGGER.debug("quickshot-internaltrig")
|
|
339
|
-
[filepath, filename, num_imgs, exptime] = args_list
|
|
340
|
-
rampath = filepath.replace("dls/i24/data", "ramdisk")
|
|
341
|
-
caput(pv.pilat_filepath, rampath)
|
|
342
|
-
yield from bps.sleep(0.1)
|
|
343
|
-
caput(pv.pilat_filename, filename)
|
|
344
|
-
yield from bps.sleep(0.1)
|
|
345
|
-
acqtime = float(exptime) - 0.001
|
|
346
|
-
caput(pv.pilat_acquiretime, str(acqtime))
|
|
347
|
-
caput(pv.pilat_acquireperiod, str(exptime))
|
|
348
|
-
SSX_LOGGER.debug(f"Filepath was set as {filepath}")
|
|
349
|
-
SSX_LOGGER.debug(f"Rampath set as {rampath}")
|
|
350
|
-
SSX_LOGGER.debug(f"Filename set as {filename}")
|
|
351
|
-
SSX_LOGGER.debug(f"num_imgs {num_imgs}")
|
|
352
|
-
SSX_LOGGER.debug(f"Exposure time set as {exptime} s")
|
|
353
|
-
SSX_LOGGER.debug(f"Acquire time set as {acqtime} s")
|
|
354
|
-
SSX_LOGGER.debug("Pilatus takes time apprx 2sec")
|
|
355
|
-
yield from bps.sleep(2)
|
|
356
|
-
caput(pv.pilat_delaytime, 0.00)
|
|
357
|
-
caput(pv.pilat_numimages, str(num_imgs))
|
|
358
|
-
caput(pv.pilat_imagemode, "Continuous")
|
|
359
|
-
caput(pv.pilat_triggermode, "Internal")
|
|
360
|
-
yield from bps.sleep(0.2)
|
|
361
|
-
|
|
362
|
-
# Put it all back to GDA acceptable defaults
|
|
363
|
-
elif action == "return to normal":
|
|
364
|
-
caput(pv.pilat_imagemode, "Continuous")
|
|
365
|
-
caput(pv.pilat_triggermode, "Ext. Trigger")
|
|
366
|
-
caput(pv.pilat_numexpimage, 1)
|
|
367
|
-
SSX_LOGGER.debug("***** leaving pilatus")
|
|
368
|
-
yield from bps.sleep(0.1)
|
|
369
|
-
return 0
|
|
370
|
-
|
|
371
|
-
|
|
372
278
|
def eiger(action, args_list, dcm: DCM):
|
|
373
279
|
SSX_LOGGER.debug("***** Entering Eiger")
|
|
374
280
|
SSX_LOGGER.info(f"Setup eiger - {action}")
|
|
@@ -17,7 +17,6 @@ from mx_bluesky.beamlines.i24.serial.setup_beamline.ca import caget, caput
|
|
|
17
17
|
from mx_bluesky.beamlines.i24.serial.setup_beamline.pv_abstract import (
|
|
18
18
|
Detector,
|
|
19
19
|
Eiger,
|
|
20
|
-
Pilatus,
|
|
21
20
|
)
|
|
22
21
|
|
|
23
22
|
EXPT_TYPE_DETECTOR_PVS = {
|
|
@@ -28,7 +27,6 @@ EXPT_TYPE_DETECTOR_PVS = {
|
|
|
28
27
|
|
|
29
28
|
class DetRequest(IntEnum):
|
|
30
29
|
eiger = 0
|
|
31
|
-
pilatus = 1
|
|
32
30
|
|
|
33
31
|
def __str__(self) -> str:
|
|
34
32
|
return self.name
|
|
@@ -45,9 +43,6 @@ def get_detector_type(detector_stage: YZStage) -> Generator[Msg, None, Detector]
|
|
|
45
43
|
if float(det_y) < Eiger.det_y_threshold:
|
|
46
44
|
SSX_LOGGER.info("Eiger detector in use.")
|
|
47
45
|
return Eiger()
|
|
48
|
-
elif float(det_y) > Pilatus.det_y_threshold:
|
|
49
|
-
SSX_LOGGER.info("Pilatus detector in use.")
|
|
50
|
-
return Pilatus()
|
|
51
46
|
else:
|
|
52
47
|
SSX_LOGGER.error("Detector not found.")
|
|
53
48
|
raise UnknownDetectorType("Detector not found.")
|
|
@@ -68,10 +63,10 @@ def _get_requested_detector(det_type_pv: str) -> str:
|
|
|
68
63
|
a string or and int.
|
|
69
64
|
|
|
70
65
|
Returns:
|
|
71
|
-
str: The detector name as a string, currently "eiger"
|
|
66
|
+
str: The detector name as a string, currently "eiger".
|
|
72
67
|
"""
|
|
73
68
|
det_type = caget(det_type_pv)
|
|
74
|
-
if det_type in ["
|
|
69
|
+
if det_type in ["eiger"]:
|
|
75
70
|
return det_type
|
|
76
71
|
else:
|
|
77
72
|
try:
|
|
@@ -89,9 +84,8 @@ def setup_detector_stage(
|
|
|
89
84
|
det_type_pv = EXPT_TYPE_DETECTOR_PVS[expt_type]
|
|
90
85
|
requested_detector = _get_requested_detector(det_type_pv)
|
|
91
86
|
SSX_LOGGER.info(f"Requested detector: {requested_detector}.")
|
|
92
|
-
det_y_target =
|
|
93
|
-
|
|
94
|
-
)
|
|
87
|
+
det_y_target = Eiger.det_y_target
|
|
88
|
+
|
|
95
89
|
yield from _move_detector_stage(detector_stage, det_y_target)
|
|
96
90
|
caput(det_type_pv, requested_detector)
|
|
97
91
|
SSX_LOGGER.info("Detector setup done.")
|