Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus control upstream #1173

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mxcubeweb/core/models/configmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class UISampleViewVideoControlsModel(UIPropertiesModel):

class UIPropertiesListModel(BaseModel):
sample_view: UIPropertiesModel
sample_view_beam_controls: UISampleViewVideoControlsModel
beamline_setup: UIPropertiesModel
camera_setup: UICameraConfigModel
sample_view_video_controls: UISampleViewVideoControlsModel
Expand Down
44 changes: 43 additions & 1 deletion mxcubeweb/routes/beamline.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# import json
import json
import sys
import logging

Expand Down Expand Up @@ -251,4 +251,46 @@ def prepare_beamline_for_sample():
return Response(status=200)
return Response(status=200)

@bp.route("/beamfocus", methods=["PUT"])
@server.require_control
@server.restrict
def set_beam_focus():
"""
Move the aperture motor.
:request Content-type: application/json, new position {'diameter': 50}.
Note: level specified as integer (not 'Diameter 50')
:statuscode: 200: no error
:statuscode: 409: error
"""
params = request.data
params = json.loads(params)
size_x = params["mot01"]
size_y = params["mot02"]

beam_info = HWR.beamline.beam
beam_info.set_beam_size(size_x, size_y)
return Response(status=200)

@bp.route("/beamfocus", methods=["GET"])
# @server.restrict
def get_beam_focus():
"""
Returns beam focus motors (position and state)
"""

beam_info = HWR.beamline.beam
beam_info_values = app.beamline.get_beam_info()
motors_moving_state = beam_info.get_motors_states()

data = {
"mot01": {"value": beam_info_values["size_x"], "state": motors_moving_state["mot01"]},
"mot02": {"value": beam_info_values["size_y"], "state": motors_moving_state["mot02"]},
}
print(data)
resp = jsonify(data)
resp.status_code = 200

return resp


return bp
10 changes: 10 additions & 0 deletions test/HardwareObjectsMockup.xml/mxcube-web/ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ sample_view:
precision: 3
suffix: mm

sample_view_beam_controls:
id: sample_view_beam_controls
components:
- id: phase
show: true
- id: aperture
show: true
- id: beam_focus
show: false

sample_view_video_controls:
id: sample_view_video_controls
components:
Expand Down
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"react-router": "^6.2.1",
"react-router-bootstrap": "^0.26.1",
"react-router-dom": "^6.19.0",
"react-select": "5.8.0",
meguiraun marked this conversation as resolved.
Show resolved Hide resolved
"react-slick": "^0.29.0",
"react-sticky": "^6.0.3",
"redux": "4.1.2",
Expand Down
Loading
Loading