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.

Credit: Jake vanderPlas, "The Unexpected Effectiveness of Python in Sciene", PyCon 2017

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.
Learn about Bluesky »

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).
Learn about Ophyd »
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')

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.
Learn about Suitcase »
Supported formats so far include:
  • CSV
  • TIFF
  • SPEC file
  • msgpack
  • JSONL
  • 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 strctures 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.
Learn about Data Broker »

"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 »