Module qscope.docs.explanation
Explanations
This section provides conceptual explanations of QScope's architecture and design.
Architecture Overview
QScope uses a distributed architecture with these key components:
GUI/Script Client <--> Server <--> System <--> Devices
|
v
Measurements
The architecture separates hardware control (server) from user interfaces (clients), allowing for flexible experiment control.
Role System
The role system provides hardware abstraction through:
- Protocols: Define required device methods
- Interfaces: Provide clean APIs for accessing devices
- Roles: Connect devices to interfaces
- Devices: Implement hardware-specific functionality
This allows measurements to work with abstract roles rather than specific hardware implementations. See the types module for more discussion.
Measurement Framework
The measurement framework is designed to standardize how experiments are defined and executed in QScope.
Measurement Lifecycle
A measurement in QScope follows this lifecycle:
- Configuration: Define parameters through a configuration class
- Initialization: Create a measurement instance with the configuration
- Setup: Prepare devices and initialize data structures
- Execution: Run one or more sweeps to collect data
- Cleanup: Release resources and reset devices
Measurement State Machine
Measurements use a state machine to track their progress (SEE NOTE BELOW):
CREATED → SETUP → RUNNING → PAUSED → FINISHED
↑ ↓ ↑ ↓
↓ ↑ ↓ ↑
--- STOPPING ---
NB: An AI made the above. It isn't correct. It would have been a good idea to create a flowchart when I understood the flow.
Data Flow
Data flows through the measurement system as follows:
- Collection: Raw data from devices
- Processing: Apply calibrations and transformations
- Analysis: Fit models and extract parameters
- Visualization: Display results in the GUI
- Storage: Save data to disk
Client-Server Communication
QScope uses a message-passing architecture for client-server communication:
- Messages: Structured data packets for commands and responses
- Requests: Client-initiated commands to the server
- Responses: Server replies to client requests
- Notifications: Server-initiated messages about state changes
This approach enables: - Multiple simultaneous client connections - Asynchronous operation - Robust error handling