Blueapi doesn't support ophyd-async DeviceVector

Đang mở
#1,555 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

Bắt đầu từ interface devices của BlueapiClient và tái hiện vấn đề bằng cấu hình mock i09 được cung cấp cùng ví dụ DeviceVector từ dodal. Kiểm tra cách devs.test và các device con được đánh chỉ mục được biểu diễn, sau đó xác minh rằng có thể truy cập device con của DeviceVector bằng chỉ mục số thông qua BlueapiClient. Hoàn thành khi ví dụ chấp nhận không còn trả về một ký tự từ tên device và việc truy cập theo chỉ mục trả về device con.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Steps to replicate the issue:

Pin dodal inside blueapi to this branch:

"dls-dodal@git+https://github.com/DiamondLightSource/dodal.git@device_vector_example". It adds a test DeviceVector device to i09.

Then run blueapi with i09 beamline in mock mode. Configuration used was:

api:
  url: http://0.0.0.0:8000
env:
  metadata:
    instrument: adsim
  sources:
    - kind: deviceManager
      module: dodal.beamlines.i09
      mock: True
    - kind: planFunctions
      module: dodal.plans
    - kind: planFunctions
      module: dodal.plan_stubs.wrapped
stomp:
  enabled: true
  url: tcp://localhost:61613/
numtracker:
  url: http://localhost:8406/graphql

Start blueapi server:
uv run blueapi -c /path/to/file.yaml serve

Then in another terminal

>>> from blueapi.client import BlueapiClient
>>> bc = BlueapiClient.from_config_file("/path/to/file.yaml")
>>> bc.instrument_session = "12345"
>>> plans = bc.plans
>>> devs = bc.devices 
>>> devs.test
Device(test)
>>> devs.test[1]
'e'
>>> devs.test[2]
's'

The above treats the client object as a str so an index just gets the index of the name. DeviceVector is used when many child devices are required, e.g 30 channels for a device and are accessed by the associated index. It is a pain to statically type this and is much easier to have it be configured instead. For example in normal python you can do the following:

>>> from ophyd_async.core import soft_signal_rw
>>> from ophyd_async.core import DeviceVector
>>> dv = DeviceVector({1: soft_signal_rw(int), 2: soft_signal_rw(int)})
>>> dv[1]
<ophyd_async.core._signal.SignalRW object at 0x7efe71059590>
>>> dv[2]
<ophyd_async.core._signal.SignalRW object at 0x7efe71059e10>

There are also plans for a DeviceMap to be added to ophyd-async too https://github.com/bluesky/ophyd-async/issues/1252.

DeviceVector and DeviceMap should probably be supported in BlueapiClient.

Acceptance Criteria

  • Can access DeviceVector children from BlueapiClient
Ngôn ngữ chính
Python
Star
13
Fork
14
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DiamondLightSource/blueapi

Tất cả issue của DiamondLightSource/blueapi

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.