Skip to content

Commit

Permalink
Add a starting plan to get parameters from gui
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Dec 18, 2024
1 parent 14c22ad commit fb109c2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mx_bluesky/beamlines/i24/serial/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from mx_bluesky.beamlines.i24.serial.plans_for_web_gui import (
from mx_bluesky.beamlines.i24.serial.web_gui_plans.general_plans import (
gui_gonio_move_on_click,
gui_move_detector,
gui_set_parameters,
gui_sleep,
gui_stage_move_on_click,
)
Expand Down Expand Up @@ -55,4 +56,5 @@
"gui_gonio_move_on_click",
"gui_sleep",
"gui_move_detector",
"gui_set_parameters",
]
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
from mx_bluesky.beamlines.i24.serial.fixed_target.i24ssx_moveonclick import (
_move_on_mouse_click_plan,
)
from mx_bluesky.beamlines.i24.serial.log import _read_visit_directory_from_file
from mx_bluesky.beamlines.i24.serial.setup_beamline.pv_abstract import Eiger, Pilatus
from mx_bluesky.beamlines.i24.serial.setup_beamline.setup_detector import (
_move_detector_stage,
get_detector_type,
)


Expand Down Expand Up @@ -47,3 +49,34 @@ def gui_move_detector(det: Literal["eiger", "pilatus"]) -> MsgGenerator:
detector_stage = i24.detector_motion()
det_y_target = Eiger.det_y_target if det == "eiger" else Pilatus.det_y_target
yield from _move_detector_stage(detector_stage, det_y_target)


@bpp.run_decorator()
def gui_set_parameters(
sub_dir: str,
chip_name: str,
exp_time: float,
det_dist: float,
transmission: float,
n_shots: int,
):
detector_stage = i24.detector_motion()
det_type = yield from get_detector_type(detector_stage)
params = {
"visit": _read_visit_directory_from_file().as_posix(), # noqa
"directory": sub_dir,
"filename": chip_name,
"exposure_time_s": exp_time,
"detector_distance_mm": det_dist,
"detector_name": str(det_type),
"num_exposures": n_shots,
"transmission": transmission,
}
# At some point it will use FixedTargetParameters to create the parameters model
# For now not doing that because:
# a- not all data in
# b - detectorParams will create a directory and we do not want that unless testing
# on beamline
# FixedTargetParameters(**params)
print(params)
yield from bps.sleep(0.5)

0 comments on commit fb109c2

Please sign in to comment.