DiamondLightSource / DiamondLightSource/sm-bluesky

Unified Instrument API Refactor

Open
#274 0 comments 0 reactions 1 assignee Claimed by @Relm-Arrowny View on GitHub
Dominant language
Python
Stars
0
Forks
0
Avg merge
2d 3m
Merged PRs (30d)
8

Description

Currently, pulse_generator_sever.py (Shilei) and HF2Sever.py (Zurich Instruments) use divergent coding styles, naming conventions, and connection logic. This makes it difficult to swap hardware in experiments without rewriting the high-level control logic.
We need to implement a unified interface (Abstract Base Class) that standardizes how we connect to, configure, and control these pulse generators, login amplier etc.
### Goals
Acceptance criteria : What journeys should the user be able to complete to consider your feature done
Be as specific as you can, check them off once they work. Add more if you find more requirements during development. Issue should only be considered done after all of them are checked
- [x] Define a Base Interface: Create BaseServer in a new base.py file to enforce method consistency.
- [x] Standardize common operations (e.g., set_frequency, start_output, stop_output).
- [x] Encapsulate Hardware Logic: Move device-specific SCPI commands (Shilei) and API nodes (ZHInst) into their respective class implementations.
- [x] Improve Error Handling: Implement a consistent logging strategy across both servers.
- [x] Abstract Base Class (ABC): Use the abc module to ensure subclasses implement required methods.
- [x] Common API Methods:
- connect_hardware: Logic to connect instrument settings.
- start() / stop(): Start and stop the tcp server.
- handle_command(): Device-specific implementation of commands.
- send_error(): send error message.
- send_ack(): send acknowledgement.
-
### Tasks
base on the goals, deduce the tasks required. check them off once they're done
- [x] #280
- [x] #284
- [ ] #295

### Related Resources
Current script:
- https://github.com/Relm-Arrowny/shilei_pulse_generator/blob/main/src/pulse_generator_sever.py
- https://github.com/Relm-Arrowny/zhinstHF2/blob/main/src/HF2Sever.py

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.