Leverage the SciPy Ecosystem
Bluesky enables scientists to leverage the scientific Python ecosystem at every stage of the experiment from data acquistion through data analysis.
Individually Useful Components
The scientific Python ecosystem is built on protocols, such as Numpy's array protocol, that enable software to be combined and repurposed in ways not foreseen by the original authors.
Drawing inspiration from this, the software libraries in the Bluesky Project interoperate through carefully-defined software interfaces. Any given piece may be separately used, extended, or replaced.
Bluesky — Experiment Specification & Orchestration
Bluesky, a library that shares the name of the overall project, is an experiment specification and orchestration engine.
- Specify the logic of an experiment in a high-level, hardware-abstracted way.
- First-class support for adaptive feedback between analysis and acquisition.
- Data is emitted in a streaming fashion in standard Python data structures.
- Pause/resume, robust error handling, and rich metadata capture are built in.
Ophyd — Hardware Abstraction Layer
Ophyd puts the control layer (e.g. EPICS, HTTP, some serial protocol) behind a high-level interface. It keeps device-specific details contained.
- Put the control layer behind a high-level interface.
- Group individual signals into logical "Devices" to be configured and used as one unit.
- Assign signals and devices human-friendly names that propagate into metadata.
- Categorize signals by "kind" (primary reading, configuration, engineering/debugging).
from ophyd import Device, Component, EpicsSignal # Here we group signals into a Device class XYStage(Device): x = Component(EpicsSignal, 'Mtr-X') y = Component(EpicsSignal, 'Mtr-Y') # and connect to multiple instances # of that device. left_stage = XYStage('Left-', name='left_stage') right_stage = XYStage('Right-', name='right_stage')
Ophyd Async — Asynchronous Hardware Abstraction Layer
Ophyd Async is an alternative option to Ophyd that uses asynchronous logic to access the control layer, as well as implementing new features such as EPICS pva access via the p4p python package.Ophyd Async is included on a provisional basis until the v1.0 release. Learn about Ophyd Async »
from ophyd_async.core import Device, DeviceCollector from ophyd_async.epics.demo import Mover from bluesky import RunEngine # Here we group signals into a device class SampleStage(Device): """A demo sample stage with X and Y movables""" def __init__(self, prefix: str, name="") -> None: # each 'mover' contains epics signals like its velocity, units and precision. self.x = Mover(prefix + "X:") self.y = Mover(prefix + "Y:") # make and connect devices. Requires the run engine. RE= RunEngine() with DeviceCollector(): left_stage = SampleStage("Left-") right_stage = SampleStage("Right-")
Bluesky Queue Server — Remote Control of Experiments
Bluesky Queue Server allows users to create and remotely manage the queue of Bluesky plans and the environment for plan execution.
- Extensive set of API for full remote access to server functionality.
- Autonomous execution of sequenced Bluesky plans.
- Remote monitoring of the server.
- Bluesky Queue Server API package for easy development of client applications in Python.
Suitcase — Export / Serialization
Bluesky is file format-agnostic. Individual "suitcase" packages encode data and metadata from bluesky's in-memory data model to existing file formats.
- Export can be performed during acquisition or later.
- It is easy to write new "suitcases" for desired formats.
- The destination does not have to be a file on disk: it could be an in-memory buffer or a web client.
- SPEC file
- and other, technique- and instrument-specific formats
Data Broker — Rich Search and Access to Saved Data
Keeping scientific logic and I/O code separate makes important scientific code easier to maintain and reuse. Data Broker supports this by providing a programmatic interface to data, giving the user standard Python data structures directly.
- The system is unopinionated about data formats.
- Any file I/O happens transparently: the user never sees files, just gets data in memory (e.g. a numpy array).
- Your detector writes in a special format? Register a custom reader at runtime.
"Event Model" — Bluesky's Data Model
Bluesky organizes data and metadata into documents that adhere to a schema. This schema is formalized but minimal and may be composed with existing standards.Learn about Bluesky's Data Model »