Skip to main content

Unification of NSLS-II data sources

Project description


Databroker


|build_status| |coverage| |pypi_version| |license|

Databroker is a data access tool built around the Bluesky Data Model_. The data it manages may be from ingested files, captured results of a Python-based data analysis, or experimental data acquired using the Bluesky Run Engine.

  • Provide a consistent programmatic interface to data, regardless of storage details like file format or storage medium.
  • Provide metadata and data in a coherent bundle, using standard widely-used Python and SciPy data structures.
  • Support fast, flexible search over metadata.
  • Enable software tools to operate seamlessly on a mixture of live-streaming data from the Bluesky Run Engine and saved data from Databroker.

Databroker is developed in concert with Suitcase. Suitcase does data writing, and databroker does the reading. Databroker builds on Intake, a generic data access tool (outside of the Bluesky Project).

============== ============================================================== PyPI pip install databroker Conda conda install -c conda-forge databroker Source code https://github.com/bluesky/databroker Documentation https://blueskyproject.io/databroker ============== ==============================================================

The bundle of metadata and data looks like this, for example.

.. code:: python

run BlueskyRun uid='4a794c63-8223-4893-895e-d16e763188a8' exit_status='success' 2020-03-07 09:17:40.436 -- 2020-03-07 09:28:53.173 Streams: * primary * baseline

Additional user metadata beyond what is shown is stored in run.metadata. The bundle contains some number of logical tables of data ("streams"). They can be accessed by name and read into a standard data structure from xarray_.

.. code:: python

>>> run.primary.read()
<xarray.Dataset>
Dimensions:                   (time: 411)
Coordinates:
  * time                      (time) float64 1.584e+09 1.584e+09 ... 1.584e+09
Data variables:
    I0                        (time) float64 13.07 13.01 12.95 ... 9.862 9.845
    It                        (time) float64 11.52 11.47 11.44 ... 4.971 4.968
    Ir                        (time) float64 10.96 10.92 10.88 ... 4.761 4.763
    dwti_dwell_time           (time) float64 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
    dwti_dwell_time_setpoint  (time) float64 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0
    dcm_energy                (time) float64 1.697e+04 1.698e+04 ... 1.791e+04
    dcm_energy_setpoint       (time) float64 1.697e+04 1.698e+04 ... 1.791e+04

Common search queries can be done with a high-level Python interface.

.. code:: python

>>> from databroker.queries import TimeRange
>>> catalog.search(TimeRange(since="2020"))

Custom queries can be done with the MongoDB query language_.

.. code:: python

>>> query = {
...    "motors": {"$in": ["x", "y"]},  # scanning either x or y
...    "temperature" {"$lt": 300},  # temperature less than 300
...    "sample.element": "Ni",
... }
>>> catalog.search(query)

See the tutorials for more.

.. |build_status| image:: https://github.com/bluesky/databroker/workflows/Unit%20Tests/badge.svg?branch=master :target: https://github.com/bluesky/databroker/actions?query=workflow%3A%22Unit+Tests%22 :alt: Build Status

.. |coverage| image:: https://codecov.io/gh/bluesky/databroker/branch/master/graph/badge.svg :target: https://codecov.io/gh/bluesky/databroker :alt: Test Coverage

.. |pypi_version| image:: https://img.shields.io/pypi/v/databroker.svg :target: https://pypi-hypernode.com/project/databroker :alt: Latest PyPI version

.. |license| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg :target: https://opensource.org/licenses/BSD-3-Clause :alt: BSD 3-Clause License

.. _xarray: https://xarray.pydata.org/

.. _MongoDB query language: https://docs.mongodb.com/manual/reference/operator/query/

.. _Bluesky Data Model: https://blueskyproject.io/event-model/main/user/explanations/data-model.html

.. _Suitcase: https://blueskyproject.io/suitcase/

.. _Intake: https://intake.readthedocs.io/en/latest/

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

databroker-2.0.0b51.tar.gz (187.2 kB view details)

Uploaded Source

Built Distribution

databroker-2.0.0b51-py2.py3-none-any.whl (202.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file databroker-2.0.0b51.tar.gz.

File metadata

  • Download URL: databroker-2.0.0b51.tar.gz
  • Upload date:
  • Size: 187.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for databroker-2.0.0b51.tar.gz
Algorithm Hash digest
SHA256 a7274ee8a95786253d6fe8094191ba982a85a18232c964430c7506c114b114a2
MD5 40f635e3346596ebb0113fb4365f345b
BLAKE2b-256 d00df4262fd04d48271ebf1beb99f96244f7183183bb0904dbb7b1eb5832255a

See more details on using hashes here.

File details

Details for the file databroker-2.0.0b51-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for databroker-2.0.0b51-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6a76a464a435f877c24b6fe5c97bfca35f4a19473f1a9153870ca15e60b24ae6
MD5 8ffbd83f079eb2570c1df0f7d6b11637
BLAKE2b-256 762d9749eba849a0b84ec947e917e5d770d3b80e48ca86e6e55040efdafe8fb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page