{ "cells": [ { "cell_type": "markdown", "id": "4fec8ab8", "metadata": {}, "source": [ "# Accessing data later, after the measurement\n", "\n", "From *APS Python Training for Bluesky Data Acquisition*.\n", "\n", "**Objective**\n", "\n", "Get the data from previous *run(s)* and work with it.\n", "\n", "## Skip the `instrument` package\n", "\n", "There is no need to import the instrument package since we won't measure anything in this notebook.\n", "\n", "## Access the database\n", "\n", "In the instrument package (in file `instrument/framework/initialize.py`), we connected databroker with the MongoDB server using the `class_2021_03` *catalog*. Get that catalog now. We'll need to import some tools first." ] }, { "cell_type": "code", "execution_count": 1, "id": "28528e86", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "catalog: training\n" ] }, { "data": { "text/html": [ "
\n", " | scan_id | \n", "time | \n", "plan_name | \n", "detectors | \n", "
---|---|---|---|---|
0 | \n", "4 | \n", "2021-08-19 14:03:33 | \n", "scan | \n", "[vsc16] | \n", "
1 | \n", "3 | \n", "2021-08-19 14:03:10 | \n", "scan | \n", "[vsc16] | \n", "
2 | \n", "2 | \n", "2021-08-19 14:02:58 | \n", "scan | \n", "[vsc16] | \n", "
3 | \n", "1 | \n", "2021-08-19 14:02:41 | \n", "scan | \n", "[vsc16] | \n", "
4 | \n", "39 | \n", "2021-08-19 13:39:12 | \n", "scan | \n", "[noisy] | \n", "
5 | \n", "38 | \n", "2021-08-19 11:45:29 | \n", "scan | \n", "[scaler1] | \n", "
6 | \n", "37 | \n", "2021-08-19 11:40:40 | \n", "scan | \n", "[noisy] | \n", "
7 | \n", "36 | \n", "2021-08-19 11:39:38 | \n", "scan | \n", "[noisy] | \n", "
8 | \n", "4 | \n", "2021-08-19 11:04:45 | \n", "scan | \n", "[vsc16] | \n", "
9 | \n", "3 | \n", "2021-08-19 11:04:08 | \n", "scan | \n", "[vsc16] | \n", "
10 | \n", "2 | \n", "2021-08-19 11:00:56 | \n", "scan | \n", "[vsc16] | \n", "
11 | \n", "1 | \n", "2021-08-19 10:58:39 | \n", "scan | \n", "[vsc16] | \n", "
12 | \n", "2 | \n", "2021-08-19 10:57:09 | \n", "scan | \n", "[vsc16] | \n", "
13 | \n", "1 | \n", "2021-08-19 10:53:19 | \n", "scan | \n", "[vsc16] | \n", "
14 | \n", "35 | \n", "2021-04-13 12:19:15 | \n", "count | \n", "[temperature] | \n", "
15 | \n", "34 | \n", "2021-04-13 12:18:54 | \n", "count | \n", "[temperature] | \n", "
16 | \n", "33 | \n", "2021-04-13 12:18:51 | \n", "count | \n", "[temperature] | \n", "
17 | \n", "32 | \n", "2021-04-13 12:18:51 | \n", "count | \n", "[temperature] | \n", "
18 | \n", "31 | \n", "2021-04-11 14:15:20 | \n", "count | \n", "[temperature] | \n", "
19 | \n", "30 | \n", "2021-04-11 14:14:58 | \n", "count | \n", "[temperature] | \n", "
<xarray.Dataset>\n", "Dimensions: (time: 50)\n", "Coordinates:\n", " * time (time) float64 1.618e+09 1.618e+09 ... 1.618e+09\n", "Data variables:\n", " temperature_setpoint (time) float64 35.0 35.0 35.0 35.0 ... 35.0 35.0 35.0\n", " temperature (time) float64 34.89 35.01 35.19 ... 35.02 34.62 35.38
array([1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09,\n", " 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09, 1.618334e+09])
array([35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35.,\n", " 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35.,\n", " 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35.,\n", " 35., 35., 35., 35., 35., 35., 35., 35., 35., 35., 35.])
array([34.8896849 , 35.01305409, 35.19233234, 35.0216907 , 35.43205158,\n", " 34.5056611 , 35.37074083, 34.51771572, 34.85019455, 34.82137026,\n", " 35.3455024 , 34.82780957, 35.21680781, 34.54200809, 35.08982223,\n", " 34.87608911, 35.03902495, 35.00504311, 35.42178225, 34.76303502,\n", " 34.91893645, 34.9121767 , 34.5496376 , 34.78567941, 34.63224994,\n", " 35.42848096, 35.0320058 , 35.24485389, 35.22823682, 35.06241703,\n", " 34.86455329, 34.54406806, 35.24770733, 34.91025406, 34.60228122,\n", " 35.48713664, 34.94979019, 35.21024643, 34.94386969, 35.1342565 ,\n", " 35.12812238, 34.58931106, 34.60415808, 35.36431678, 34.6698024 ,\n", " 34.99550622, 35.29185168, 35.02181277, 34.61917296, 35.3817731 ])