MXCuBE Architecture#
MXCuBE (Macromolecular Xtallography Customized Beamline Environment) is a modular framework for controlling synchrotron beamlines for macromolecular crystallography experiments.
This documentation was partly generated automatically and is meant to provide an architectural overview of the concepts involved. It may miss implementation details.
Table of Contents#
System Overview#
MXCuBE is split into two main repositories:
mxcubecore: Hardware abstraction layer and core business logic
mxcubeweb: Web-based user interface and REST/WebSocket API server
High-Level Architecture#
Three-Tier Architecture#
MXCubeCore Architecture#
Core Component Hierarchy#
Hardware Object Base Classes#
Hardware Repository Pattern#
Queue Execution Model#
MXCubeWeb Architecture#
Backend Architecture#
Frontend Architecture#
Component Communication#
Communication Flow#
REST API Flow#
WebSocket Event Flow#
Data Collection Signal Flow#
Data Collection Workflow#
End-to-End Data Collection#
Queue Tree Execution#
Key Components#
1. Hardware Repository (mxcubecore)#
Purpose: Central registry and factory for hardware objects
Key Features:
Singleton pattern for global access (
HWR.beamline.*)Dynamic loading from XML/YAML configurations
Lazy initialization of hardware objects
Event-driven communication via dispatcher
Example:
from mxcubecore import HardwareRepository as HWR
# Access hardware objects
HWR.beamline.diffractometer.move_motors({"omega": 90})
HWR.beamline.detector.prepare_acquisition()
2. Hardware Objects#
Purpose: Abstract hardware control behind unified interfaces
Key Base Classes:
HardwareObject: Base class with state managementAbstractActuator: Values and limits (motors, energy, etc.)AbstractSampleChanger: Sample loading/unloadingAbstractCollect: Data collection orchestration
Control System Adapters:
TANGO (Tango Controls)
EPICS (Experimental Physics and Industrial Control System)
SPEC (Python wrapper for Spec diffractometer control)
3. Queue System#
Purpose: Manage and execute data collection workflows
Components:
QueueModel: Tree structure of samples and tasksQueueEntry: Executable nodes withexecute()methodQueueManager: Traversal and execution engine
Queue Entry Types:
SampleQueueEntry: Mount/unmount operationsDataCollectionQueueEntry: Standard data collectionCharacterisationQueueEntry: Crystal characterisationWorkflowQueueEntry: Multi-step workflowsTaskGroupQueueEntry: Group related tasks
4. MXCUBEApplication (mxcubeweb)#
Purpose: Application-level business logic and state
Components:
Queue: Queue management APILims: LIMS integration (ISPyB, etc.)UserManager: Authentication and authorizationChat: Remote access collaborationWorkflow: Advanced workflows (GPhL, etc.)Harvester: Crystal harvester integration
5. Signal System#
Purpose: Decouple components via event-driven architecture
Pattern:
# Hardware object emits signal
self.emit("valueChanged", new_value)
# Application listens
HWR.beamline.motor.connect("valueChanged", callback)
Signal Flow: Hardware Object → Dispatcher → Signal Handler → Flask-SocketIO → Browser
6. React Frontend#
Purpose: Modern web UI with real-time updates
Stack:
React 18 + Redux for state management
Socket.IO for real-time communication
Vite for fast builds
Bootstrap for styling
Key Containers:
SampleListViewContainer: Sample management and LIMSSampleQueueContainer: Queue visualization and controlSampleViewContainer: Video stream and sample centeringTaskParametersContainer: Data collection forms