mx-bluesky 1.4.0__py3-none-any.whl → 1.4.1a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. mx_bluesky/_version.py +2 -2
  2. mx_bluesky/beamlines/i04/thawing_plan.py +1 -1
  3. mx_bluesky/beamlines/i24/serial/dcid.py +19 -21
  4. mx_bluesky/beamlines/i24/serial/extruder/i24ssx_Extruder_Collect_py3v2.py +2 -2
  5. mx_bluesky/beamlines/i24/serial/fixed_target/FT-gui-edm/DiamondChipI24-py3v1.edl +1 -4
  6. mx_bluesky/beamlines/i24/serial/fixed_target/ft_utils.py +0 -1
  7. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py +14 -24
  8. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py +18 -76
  9. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py +0 -199
  10. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_moveonclick.py +4 -6
  11. mx_bluesky/beamlines/i24/serial/log.py +1 -1
  12. mx_bluesky/beamlines/i24/serial/parameters/constants.py +0 -1
  13. mx_bluesky/beamlines/i24/serial/run_fixed_target.sh +4 -3
  14. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_beamline.py +78 -80
  15. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_detector.py +1 -2
  16. mx_bluesky/beamlines/i24/serial/setup_beamline/setup_zebra_plans.py +24 -26
  17. mx_bluesky/beamlines/i24/serial/write_nexus.py +11 -11
  18. mx_bluesky/common/external_interaction/config_server.py +46 -0
  19. mx_bluesky/common/parameters/components.py +52 -15
  20. mx_bluesky/common/parameters/constants.py +6 -1
  21. mx_bluesky/common/parameters/gridscan.py +94 -0
  22. mx_bluesky/{hyperion → common}/parameters/robot_load.py +2 -2
  23. mx_bluesky/common/plans/do_fgs.py +2 -2
  24. mx_bluesky/common/utils/log.py +2 -0
  25. mx_bluesky/hyperion/__main__.py +2 -1
  26. mx_bluesky/hyperion/device_setup_plans/setup_panda.py +4 -4
  27. mx_bluesky/hyperion/device_setup_plans/setup_zebra.py +1 -1
  28. mx_bluesky/hyperion/experiment_plans/__init__.py +4 -0
  29. mx_bluesky/hyperion/experiment_plans/change_aperture_then_move_plan.py +83 -0
  30. mx_bluesky/hyperion/experiment_plans/common/xrc_result.py +47 -0
  31. mx_bluesky/hyperion/experiment_plans/experiment_registry.py +9 -9
  32. mx_bluesky/hyperion/experiment_plans/flyscan_xray_centre_plan.py +131 -89
  33. mx_bluesky/hyperion/experiment_plans/grid_detect_then_xray_centre_plan.py +50 -18
  34. mx_bluesky/hyperion/experiment_plans/load_centre_collect_full_plan.py +52 -10
  35. mx_bluesky/hyperion/experiment_plans/oav_grid_detection_plan.py +2 -2
  36. mx_bluesky/hyperion/experiment_plans/oav_snapshot_plan.py +3 -9
  37. mx_bluesky/hyperion/experiment_plans/optimise_attenuation_plan.py +2 -2
  38. mx_bluesky/hyperion/experiment_plans/pin_centre_then_xray_centre_plan.py +36 -17
  39. mx_bluesky/hyperion/experiment_plans/pin_tip_centring_plan.py +2 -2
  40. mx_bluesky/hyperion/experiment_plans/robot_load_and_change_energy.py +6 -10
  41. mx_bluesky/hyperion/experiment_plans/robot_load_then_centre_plan.py +46 -11
  42. mx_bluesky/hyperion/experiment_plans/rotation_scan_plan.py +18 -3
  43. mx_bluesky/hyperion/experiment_plans/set_energy_plan.py +2 -3
  44. mx_bluesky/hyperion/external_interaction/callbacks/common/abstract_event.py +66 -0
  45. mx_bluesky/hyperion/external_interaction/callbacks/grid_detection_callback.py +15 -15
  46. mx_bluesky/hyperion/external_interaction/callbacks/rotation/ispyb_callback.py +3 -1
  47. mx_bluesky/hyperion/external_interaction/callbacks/rotation/nexus_callback.py +5 -3
  48. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/ispyb_callback.py +5 -2
  49. mx_bluesky/hyperion/external_interaction/callbacks/xray_centre/nexus_callback.py +5 -4
  50. mx_bluesky/hyperion/external_interaction/config_server.py +8 -37
  51. mx_bluesky/hyperion/external_interaction/ispyb/exp_eye_store.py +1 -1
  52. mx_bluesky/hyperion/parameters/components.py +4 -9
  53. mx_bluesky/hyperion/parameters/constants.py +0 -1
  54. mx_bluesky/hyperion/parameters/gridscan.py +33 -76
  55. mx_bluesky/hyperion/parameters/load_centre_collect.py +14 -9
  56. mx_bluesky/hyperion/parameters/rotation.py +15 -6
  57. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/METADATA +35 -34
  58. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/RECORD +62 -58
  59. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/WHEEL +1 -1
  60. mx_bluesky/beamlines/i24/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py +0 -150
  61. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/LICENSE +0 -0
  62. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/entry_points.txt +0 -0
  63. {mx_bluesky-1.4.0.dist-info → mx_bluesky-1.4.1a0.dist-info}/top_level.txt +0 -0
@@ -1,150 +0,0 @@
1
- """
2
- Chip mapping utilities for fixed target
3
-
4
- This version changed to python3 March2020 by RLO
5
- """
6
-
7
- import numpy as np
8
-
9
- from mx_bluesky.beamlines.i24.serial.fixed_target.ft_utils import ChipType
10
- from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_Chip_StartUp_py3v1 import (
11
- check_files,
12
- get_shot_order,
13
- get_xy,
14
- read_parameter_file,
15
- write_file,
16
- )
17
- from mx_bluesky.beamlines.i24.serial.log import SSX_LOGGER, log_on_entry
18
- from mx_bluesky.beamlines.i24.serial.parameters import get_chip_format
19
- from mx_bluesky.beamlines.i24.serial.parameters.constants import PARAM_FILE_PATH_FT
20
-
21
-
22
- @log_on_entry
23
- def read_file_make_dict(fid, chip_type, switch=False):
24
- a_dict = {}
25
- b_dict = {}
26
- with open(fid) as f:
27
- for line in f.readlines():
28
- if line.startswith("#"):
29
- continue
30
- else:
31
- entry = line.rstrip().split()
32
- addr = entry[0][-5:]
33
- pres = entry[4]
34
- x, y = get_xy(addr, chip_type)
35
- a_dict[x, y] = pres
36
- b_dict[addr] = pres
37
- if switch is True:
38
- return b_dict
39
- else:
40
- return a_dict
41
-
42
-
43
- @log_on_entry
44
- def plot_file(plt, fid, chip_type):
45
- chip_dict = read_file_make_dict(fid, chip_type)
46
- x_list, y_list, z_list = [], [], []
47
- for k in sorted(chip_dict.keys()):
48
- x, y = k[0], k[1]
49
- pres = chip_dict[k]
50
- x_list.append(float(x))
51
- y_list.append(float(y))
52
- z_list.append(float(pres))
53
-
54
- X = np.array(x_list)
55
- Y = np.array(y_list)
56
- Z = np.array(z_list)
57
- xr = X.ravel()
58
- yr = Y.ravel()
59
- zr = Z.ravel()
60
-
61
- fig = plt.figure(num=None, figsize=(12, 12), facecolor="0.6", edgecolor="k")
62
- fig.subplots_adjust(
63
- left=0.03, bottom=0.03, right=0.97, top=0.97, wspace=0, hspace=0
64
- )
65
- ax1 = fig.add_subplot(111, aspect="equal", axisbg="0.3")
66
- ax1.scatter(xr, yr, c=zr, s=8, alpha=1, marker="s", linewidth=0.1, cmap="winter")
67
- ax1.set_xlim(-1, 26)
68
- ax1.set_ylim(-1, 26)
69
- ax1.invert_yaxis()
70
- check_files("i24", [f"{chip_type}.png"])
71
- plt.savefig(f"{fid[:-5]}.png", dpi=200, bbox_inches="tight", pad_inches=0.05)
72
- return 1
73
-
74
-
75
- @log_on_entry
76
- def convert_chip_to_hex(fid, chip_type):
77
- chip_dict = read_file_make_dict(fid, chip_type, True)
78
- chip_format = get_chip_format(ChipType(chip_type))
79
- check_files("i24", [f"{chip_type}.full"])
80
- with open(f"{fid[:-5]}.full", "w") as g:
81
- # Normal
82
- if chip_type in [ChipType.Oxford, ChipType.OxfordInner]:
83
- shot_order_list = get_shot_order(chip_type)
84
- SSX_LOGGER.info("Shot Order List: \n")
85
- SSX_LOGGER.info(f"{shot_order_list[:14]}")
86
- SSX_LOGGER.info(f"{shot_order_list[-14:]}")
87
- for i, k in enumerate(shot_order_list):
88
- if i % 20 == 0:
89
- SSX_LOGGER.info("\n")
90
- else:
91
- SSX_LOGGER.info(f"{k}")
92
- sorted_pres_list = []
93
- for addr in shot_order_list:
94
- sorted_pres_list.append(chip_dict[addr])
95
-
96
- windows_per_block = chip_format.x_num_steps
97
- number_of_lines = int(len(sorted_pres_list) / windows_per_block)
98
- hex_length = windows_per_block / 4
99
- pad = int(7 - hex_length)
100
- for i in range(number_of_lines):
101
- sublist = sorted_pres_list[
102
- i * windows_per_block : (i * windows_per_block) + windows_per_block
103
- ]
104
- if i % 2 == 0:
105
- right_list = sublist
106
- else:
107
- right_list = sublist[::-1]
108
- hex_string = (f"{{0:0>{hex_length}X}}").format(
109
- int("".join(str(x) for x in right_list), 2)
110
- )
111
- hex_string = hex_string + (pad * "0")
112
- pvar = 5001 + i
113
- line = f"P{pvar}=${hex_string}"
114
- g.write(line + "\n")
115
- SSX_LOGGER.info("hex string: %s" % (hex_string + 4 * "0"))
116
- SSX_LOGGER.info(f"line number= {i}")
117
- SSX_LOGGER.info(
118
- "right_list: \n{}\n".format("".join(str(x) for x in right_list))
119
- )
120
- SSX_LOGGER.info(f"PVAR: {line}")
121
- if (i + 1) % windows_per_block == 0:
122
- SSX_LOGGER.info(
123
- "\n %s" % (40 * (" %i" % ((i / windows_per_block) + 2)))
124
- )
125
- SSX_LOGGER.info(f"hex_length: {hex_length}")
126
- else:
127
- SSX_LOGGER.warning("Chip type unknown, no conversion done.")
128
- return 0
129
-
130
-
131
- def main(plt):
132
- params = read_parameter_file()
133
-
134
- check_files("i24", [".spec"])
135
- write_file(suffix=".spec", order="shot")
136
-
137
- SSX_LOGGER.info(f"PARAMETER PATH = {PARAM_FILE_PATH_FT}")
138
- fid = PARAM_FILE_PATH_FT / f"{params.filename}.spec"
139
- SSX_LOGGER.info(f"FID = {fid}")
140
-
141
- plot_file(plt, fid, params.chip.chip_type.value)
142
- convert_chip_to_hex(fid, params.chip.chip_type.value)
143
-
144
-
145
- if __name__ == "__main__":
146
- from matplotlib import pyplot as plt
147
-
148
- main(plt)
149
- plt.show()
150
- plt.close()