DataBroker Basics¶
What is the Data Broker?¶
The Data Broker prodives one interface for retrieving data from all sources.
You, the user, don’t have to know where the data is stored or in what format it is stored. The Data Broker returns all the data in one simply-structured bundle. All measurements are given as standard Python data types (integer, float, or string) or numpy arrays.
Quick Start¶
This demonstrates the basic usage with minimal explanation. To understand what is being done, read the next section.
In [1]: from dataportal.broker import DataBroker
In [2]: from dataportal.muxer import DataMuxer
In [3]: header = DataBroker[-1] # get most recent run
---------------------------------------------------------------------------
StopIteration Traceback (most recent call last)
/Users/dallan/Documents/Repos/dataportal/dataportal/broker/simple_broker.py in __getitem__(self, key)
61 try:
---> 62 result = next(gen)
63 except StopIteration:
StopIteration:
During handling of the above exception, another exception occurred:
IndexError Traceback (most recent call last)
<ipython-input-3-40ed62db5c60> in <module>()
----> 1 header = DataBroker[-1] # get most recent run
/Users/dallan/Documents/Repos/dataportal/dataportal/broker/simple_broker.py in __getitem__(self, key)
63 except StopIteration:
64 raise IndexError(
---> 65 "There are only {0} runs.".format(i))
66 header = Header.from_run_start(result)
67 elif isinstance(key, six.string_types):
IndexError: There are only 0 runs.
In [4]: events = DataBroker.fetch_events(header)