{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# `specfile_example()` - Output scan(s) to a SPEC data file." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "One of the common concerns is how to access data from bluesky's database. The standard way is to replay the document stream from each of the scans through a bluesky callback that writes the data to the desired file format. Here, we write data to the SPEC file format.\n", "\n", "First, we must load the libraries we'll need." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from databroker import Broker\n", "from apstools.examples import specfile_example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we create an instance of the *Broker()* using our mongodb database. (For this to work, we know we already have a file located in `~/.config/databroker/mongodb_config.yml` that describes the databroker configuration for mongodb.)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "db = Broker.named(\"mongodb_config\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# get the most recent scan, by steps\n", "\n", "The databroker instance, `db`, provides access to its scans by several means. One way is to consider `db` as a list and retreive the last item from the list. This will return a *header* to the scan. The *header* is the common reference to be used. As is the common term, we will call it `h` and print its *start* document.\n", "\n", "For this first example, we'll work through the steps one by one." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:databroker._core:Interpreting key = -1 as an integer\n" ] }, { "data": { "text/html": [ "\n", "\n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", "
hints \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", "
dimensions \n", " \n", " \n", " [[['m1'], 'primary']]\n", " \n", " \n", "
\n", " \n", "
md \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", "
activity \n", " \n", " \n", " TuneAxis development and testing\n", " \n", " \n", "
peak_bkg \n", " \n", " \n", " 0.0045580721055284755\n", " \n", " \n", "
peak_center \n", " \n", " \n", " -1.3940973681450914\n", " \n", " \n", "
peak_eta \n", " \n", " \n", " 0.2993015167776747\n", " \n", " \n", "
peak_model \n", " \n", " \n", " pseudo Voigt\n", " \n", " \n", "
peak_scale \n", " \n", " \n", " 100000.0\n", " \n", " \n", "
peak_sigma \n", " \n", " \n", " 0.025534621641250733\n", " \n", " \n", "
\n", " \n", "
plan_name \n", " \n", " \n", " TuneAxis.tune\n", " \n", " \n", "
plan_type \n", " \n", " \n", " generator\n", " \n", " \n", "
scan_id \n", " \n", " \n", " 5\n", " \n", " \n", "
time \n", " \n", " \n", " 26 minutes ago (2019-02-19T17:12:23.527238)\n", " \n", " \n", "
tune_md \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", "
initial_position \n", " \n", " \n", " -1.5\n", " \n", " \n", "
time_iso8601 \n", " \n", " \n", " 2019-02-19 17:12:23.523994\n", " \n", " \n", "
width \n", " \n", " \n", " 2.5\n", " \n", " \n", "
\n", " \n", "
tune_parameters \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", "
initial_position \n", " \n", " \n", " -1.5\n", " \n", " \n", "
num \n", " \n", " \n", " 30\n", " \n", " \n", "
peak_choice \n", " \n", " \n", " cen\n", " \n", " \n", "
width \n", " \n", " \n", " 2.5\n", " \n", " \n", "
x_axis \n", " \n", " \n", " m1\n", " \n", " \n", "
y_axis \n", " \n", " \n", " spvoigt\n", " \n", " \n", "
\n", " \n", "
uid \n", " \n", " \n", " 957d83c1-9f11-47df-936b-ce14a396cd76\n", " \n", " \n", "
" ], "text/plain": [ "{'time': 1550617943.5272377,\n", " 'uid': '957d83c1-9f11-47df-936b-ce14a396cd76',\n", " 'plan_name': 'TuneAxis.tune',\n", " 'tune_parameters': {'num': 30,\n", " 'width': 2.5,\n", " 'initial_position': -1.5,\n", " 'peak_choice': 'cen',\n", " 'x_axis': 'm1',\n", " 'y_axis': 'spvoigt'},\n", " 'hints': {'dimensions': [[['m1'], 'primary']]},\n", " 'scan_id': 5,\n", " 'plan_type': 'generator',\n", " 'md': {'activity': 'TuneAxis development and testing',\n", " 'peak_model': 'pseudo Voigt',\n", " 'peak_scale': 100000.0,\n", " 'peak_center': -1.3940973681450914,\n", " 'peak_sigma': 0.025534621641250733,\n", " 'peak_eta': 0.2993015167776747,\n", " 'peak_bkg': 0.0045580721055284755},\n", " 'tune_md': {'width': 2.5,\n", " 'initial_position': -1.5,\n", " 'time_iso8601': '2019-02-19 17:12:23.523994'}}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h = db[-1]\n", "h.start" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The databroker provides a simple table view of this scan (header):" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timespvoigtm1m1_user_setpoint
seq_num
12019-02-19 17:12:25.014852762466.418222-2.75-2.750000
22019-02-19 17:12:25.290538549467.980011-2.66-2.663793
32019-02-19 17:12:25.583233356469.676953-2.58-2.577586
42019-02-19 17:12:25.886490583472.047289-2.49-2.491379
52019-02-19 17:12:26.187965870474.704056-2.41-2.405172
62019-02-19 17:12:26.487434149478.553311-2.32-2.318966
72019-02-19 17:12:26.789104462483.710237-2.23-2.232759
82019-02-19 17:12:27.089837313489.921848-2.15-2.146552
92019-02-19 17:12:27.390726089499.752081-2.06-2.060345
102019-02-19 17:12:27.692264795514.531356-1.97-1.974138
112019-02-19 17:12:27.994757175534.952488-1.89-1.887931
122019-02-19 17:12:28.295151949573.787303-1.80-1.801724
132019-02-19 17:12:28.595917225638.421241-1.72-1.715517
142019-02-19 17:12:28.897848606802.419072-1.63-1.629310
152019-02-19 17:12:29.1983859541345.299016-1.54-1.543103
162019-02-19 17:12:29.4991812716869.195912-1.46-1.456897
172019-02-19 17:12:29.79997730361175.978285-1.37-1.370690
182019-02-19 17:12:30.1011891371886.595248-1.28-1.284483
192019-02-19 17:12:30.401387691964.993245-1.20-1.198276
202019-02-19 17:12:30.704622269695.656838-1.11-1.112069
212019-02-19 17:12:31.004489422602.295158-1.03-1.025862
222019-02-19 17:12:31.304865837550.147832-0.94-0.939655
232019-02-19 17:12:31.605018616521.581939-0.85-0.853448
242019-02-19 17:12:31.906407356505.826402-0.77-0.767241
252019-02-19 17:12:32.210166693494.027851-0.68-0.681034
262019-02-19 17:12:32.508801937485.958977-0.59-0.594828
272019-02-19 17:12:32.810102224480.753471-0.51-0.508621
282019-02-19 17:12:33.111250877476.359713-0.42-0.422414
292019-02-19 17:12:33.411003590473.360218-0.34-0.336207
302019-02-19 17:12:33.710982561470.708557-0.25-0.250000
\n", "
" ], "text/plain": [ " time spvoigt m1 m1_user_setpoint\n", "seq_num \n", "1 2019-02-19 17:12:25.014852762 466.418222 -2.75 -2.750000\n", "2 2019-02-19 17:12:25.290538549 467.980011 -2.66 -2.663793\n", "3 2019-02-19 17:12:25.583233356 469.676953 -2.58 -2.577586\n", "4 2019-02-19 17:12:25.886490583 472.047289 -2.49 -2.491379\n", "5 2019-02-19 17:12:26.187965870 474.704056 -2.41 -2.405172\n", "6 2019-02-19 17:12:26.487434149 478.553311 -2.32 -2.318966\n", "7 2019-02-19 17:12:26.789104462 483.710237 -2.23 -2.232759\n", "8 2019-02-19 17:12:27.089837313 489.921848 -2.15 -2.146552\n", "9 2019-02-19 17:12:27.390726089 499.752081 -2.06 -2.060345\n", "10 2019-02-19 17:12:27.692264795 514.531356 -1.97 -1.974138\n", "11 2019-02-19 17:12:27.994757175 534.952488 -1.89 -1.887931\n", "12 2019-02-19 17:12:28.295151949 573.787303 -1.80 -1.801724\n", "13 2019-02-19 17:12:28.595917225 638.421241 -1.72 -1.715517\n", "14 2019-02-19 17:12:28.897848606 802.419072 -1.63 -1.629310\n", "15 2019-02-19 17:12:29.198385954 1345.299016 -1.54 -1.543103\n", "16 2019-02-19 17:12:29.499181271 6869.195912 -1.46 -1.456897\n", "17 2019-02-19 17:12:29.799977303 61175.978285 -1.37 -1.370690\n", "18 2019-02-19 17:12:30.101189137 1886.595248 -1.28 -1.284483\n", "19 2019-02-19 17:12:30.401387691 964.993245 -1.20 -1.198276\n", "20 2019-02-19 17:12:30.704622269 695.656838 -1.11 -1.112069\n", "21 2019-02-19 17:12:31.004489422 602.295158 -1.03 -1.025862\n", "22 2019-02-19 17:12:31.304865837 550.147832 -0.94 -0.939655\n", "23 2019-02-19 17:12:31.605018616 521.581939 -0.85 -0.853448\n", "24 2019-02-19 17:12:31.906407356 505.826402 -0.77 -0.767241\n", "25 2019-02-19 17:12:32.210166693 494.027851 -0.68 -0.681034\n", "26 2019-02-19 17:12:32.508801937 485.958977 -0.59 -0.594828\n", "27 2019-02-19 17:12:32.810102224 480.753471 -0.51 -0.508621\n", "28 2019-02-19 17:12:33.111250877 476.359713 -0.42 -0.422414\n", "29 2019-02-19 17:12:33.411003590 473.360218 -0.34 -0.336207\n", "30 2019-02-19 17:12:33.710982561 470.708557 -0.25 -0.250000" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h.table()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's write it as a SPEC data file (namely: `spec1.dat`):" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:apstools.filewriters:wrote header to SPEC file: spec1.dat\n", "INFO:apstools.filewriters:wrote scan 5 to SPEC file: spec1.dat\n", "INFO:apstools.examples:\n", "#S 5 TuneAxis.tune()\n", "#D Tue Feb 19 17:12:23 2019\n", "#C Tue Feb 19 17:12:23 2019. plan_type = generator\n", "#C Tue Feb 19 17:12:23 2019. uid = 957d83c1-9f11-47df-936b-ce14a396cd76\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.3940973681450914, 'peak_sigma': 0.025534621641250733, 'peak_eta': 0.2993015167776747, 'peak_bkg': 0.0045580721055284755}\n", "#MD tune_md = {'width': 2.5, 'initial_position': -1.5, 'time_iso8601': '2019-02-19 17:12:23.523994'}\n", "#MD tune_parameters = {'num': 30, 'width': 2.5, 'initial_position': -1.5, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 30\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "1.4876151084899902 -2.75 -2.75 466.4182216464095 1\n", "1.763300895690918 -2.66 -2.663793103448276 467.98001092446935 2\n", "2.0559957027435303 -2.58 -2.5775862068965516 469.67695329594545 2\n", "2.3592529296875 -2.49 -2.4913793103448274 472.047288907075 2\n", "2.6607282161712646 -2.41 -2.405172413793103 474.7040562212433 3\n", "2.9601964950561523 -2.32 -2.3189655172413794 478.5533112429079 3\n", "3.261866807937622 -2.23 -2.2327586206896552 483.7102374329128 3\n", "3.5625996589660645 -2.15 -2.146551724137931 489.9218481592604 4\n", "3.8634884357452393 -2.06 -2.060344827586207 499.7520810347462 4\n", "4.165027141571045 -1.97 -1.9741379310344827 514.5313559643142 4\n", "4.467519521713257 -1.8900000000000001 -1.8879310344827585 534.9524879098316 4\n", "4.767914295196533 -1.8 -1.8017241379310345 573.7873029083775 5\n", "5.068679571151733 -1.72 -1.7155172413793103 638.421240937402 5\n", "5.370610952377319 -1.6300000000000001 -1.629310344827586 802.4190715914328 5\n", "5.671148300170898 -1.54 -1.543103448275862 1345.2990156134879 6\n", "5.971943616867065 -1.46 -1.456896551724138 6869.195912401152 6\n", "6.27273964881897 -1.37 -1.3706896551724137 61175.97828509437 6\n", "6.573951482772827 -1.28 -1.2844827586206895 1886.595248462487 7\n", "6.874150037765503 -1.2 -1.1982758620689653 964.993245164857 7\n", "7.177384614944458 -1.11 -1.1120689655172413 695.6568384742045 7\n", "7.477251768112183 -1.03 -1.0258620689655171 602.2951582973135 7\n", "7.777628183364868 -0.9400000000000001 -0.9396551724137929 550.1478319972741 8\n", "8.077780961990356 -0.85 -0.853448275862069 521.581938800707 8\n", "8.379169702529907 -0.77 -0.7672413793103448 505.8264024061124 8\n", "8.682929039001465 -0.68 -0.6810344827586206 494.0278510735762 9\n", "8.981564283370972 -0.59 -0.5948275862068964 485.9589769631584 9\n", "9.282864570617676 -0.51 -0.5086206896551722 480.7534707945549 9\n", "9.584013223648071 -0.42 -0.42241379310344795 476.3597129378231 10\n", "9.883765935897827 -0.34 -0.3362068965517242 473.3602181333745 10\n", "10.18374490737915 -0.25 -0.25 470.70855736072207 10\n", "#C Tue Feb 19 17:12:35 2019. num_events_primary = 30\n", "#C Tue Feb 19 17:12:35 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:12:35 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.examples:Look at SPEC data file: spec1.dat\n" ] } ], "source": [ "specfile_example(h, filename=\"spec1.dat\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's view that file from disk storage:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "#F spec1.dat\r\n", "#E 1550619537\r\n", "#D Tue Feb 19 17:38:57 2019\r\n", "#C BlueSky user = mintadmin host = mint-vm\r\n", "\r\n", "#S 5 TuneAxis.tune()\r\n", "#D Tue Feb 19 17:12:23 2019\r\n", "#C Tue Feb 19 17:12:23 2019. plan_type = generator\r\n", "#C Tue Feb 19 17:12:23 2019. uid = 957d83c1-9f11-47df-936b-ce14a396cd76\r\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.3940973681450914, 'peak_sigma': 0.025534621641250733, 'peak_eta': 0.2993015167776747, 'peak_bkg': 0.0045580721055284755}\r\n", "#MD tune_md = {'width': 2.5, 'initial_position': -1.5, 'time_iso8601': '2019-02-19 17:12:23.523994'}\r\n", "#MD tune_parameters = {'num': 30, 'width': 2.5, 'initial_position': -1.5, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\r\n", "#N 30\r\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\r\n", "1.4876151084899902 -2.75 -2.75 466.4182216464095 1\r\n", "1.763300895690918 -2.66 -2.663793103448276 467.98001092446935 2\r\n", "2.0559957027435303 -2.58 -2.5775862068965516 469.67695329594545 2\r\n", "2.3592529296875 -2.49 -2.4913793103448274 472.047288907075 2\r\n", "2.6607282161712646 -2.41 -2.405172413793103 474.7040562212433 3\r\n", "2.9601964950561523 -2.32 -2.3189655172413794 478.5533112429079 3\r\n", "3.261866807937622 -2.23 -2.2327586206896552 483.7102374329128 3\r\n", "3.5625996589660645 -2.15 -2.146551724137931 489.9218481592604 4\r\n", "3.8634884357452393 -2.06 -2.060344827586207 499.7520810347462 4\r\n", "4.165027141571045 -1.97 -1.9741379310344827 514.5313559643142 4\r\n", "4.467519521713257 -1.8900000000000001 -1.8879310344827585 534.9524879098316 4\r\n", "4.767914295196533 -1.8 -1.8017241379310345 573.7873029083775 5\r\n", "5.068679571151733 -1.72 -1.7155172413793103 638.421240937402 5\r\n", "5.370610952377319 -1.6300000000000001 -1.629310344827586 802.4190715914328 5\r\n", "5.671148300170898 -1.54 -1.543103448275862 1345.2990156134879 6\r\n", "5.971943616867065 -1.46 -1.456896551724138 6869.195912401152 6\r\n", "6.27273964881897 -1.37 -1.3706896551724137 61175.97828509437 6\r\n", "6.573951482772827 -1.28 -1.2844827586206895 1886.595248462487 7\r\n", "6.874150037765503 -1.2 -1.1982758620689653 964.993245164857 7\r\n", "7.177384614944458 -1.11 -1.1120689655172413 695.6568384742045 7\r\n", "7.477251768112183 -1.03 -1.0258620689655171 602.2951582973135 7\r\n", "7.777628183364868 -0.9400000000000001 -0.9396551724137929 550.1478319972741 8\r\n", "8.077780961990356 -0.85 -0.853448275862069 521.581938800707 8\r\n", "8.379169702529907 -0.77 -0.7672413793103448 505.8264024061124 8\r\n", "8.682929039001465 -0.68 -0.6810344827586206 494.0278510735762 9\r\n", "8.981564283370972 -0.59 -0.5948275862068964 485.9589769631584 9\r\n", "9.282864570617676 -0.51 -0.5086206896551722 480.7534707945549 9\r\n", "9.584013223648071 -0.42 -0.42241379310344795 476.3597129378231 10\r\n", "9.883765935897827 -0.34 -0.3362068965517242 473.3602181333745 10\r\n", "10.18374490737915 -0.25 -0.25 470.70855736072207 10\r\n", "#C Tue Feb 19 17:12:35 2019. num_events_primary = 30\r\n", "#C Tue Feb 19 17:12:35 2019. num_events_PeakStats = 1\r\n", "#C Tue Feb 19 17:12:35 2019. exit_status = success\r\n" ] } ], "source": [ "!cat spec1.dat" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We see that the output of the `specfile_example()` command includes the content of the SPEC file. For the remaining examples, we'll skip this additional step to view the SPEC file contents from disk." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# a range of recent scans\n", "\n", "We can continue to consider the `db` object as a list and use list slicing to access a range of recent scans." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:databroker._core:Interpreting key = slice(-6, None, None) as a slice\n", "INFO:apstools.filewriters:wrote header to SPEC file: spec2.dat\n", "INFO:apstools.filewriters:wrote scan 1 to SPEC file: spec2.dat\n", "INFO:apstools.examples:\n", "#S 1 scan(detectors=['scaler'], num=15, args=['m1', -5, 5], per_step=None)\n", "#D Tue Feb 19 17:11:20 2019\n", "#C Tue Feb 19 17:11:20 2019. plan_type = generator\n", "#C Tue Feb 19 17:11:20 2019. uid = 225eef4b-4a56-427b-b507-e959b216a9f4\n", "#MD motors = ['m1']\n", "#MD num_intervals = 14\n", "#MD num_points = 15\n", "#MD plan_pattern = inner_product\n", "#MD plan_pattern_args = {'num': 15, 'args': [\"EpicsMotor(prefix='vm7:m1', name='m1', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])\", -5, 5]}\n", "#MD plan_pattern_module = bluesky.plan_patterns\n", "#N 15\n", "#L m1 I0 m1_user_setpoint scaler_time scint Epoch_float Epoch clock\n", "-5.0 2.0 -5.0 0.5 3.0 5.246389150619507 5 5000000.0\n", "-4.29 2.0 -4.285714285714286 0.5 3.0 6.928081274032593 7 5000000.0\n", "-3.5700000000000003 3.0 -3.571428571428571 0.5 2.0 8.540517807006836 9 5000000.0\n", "-2.86 2.0 -2.857142857142857 0.5 3.0 10.122943639755249 10 5000000.0\n", "-2.14 2.0 -2.142857142857143 0.5 2.0 11.731646537780762 12 5000000.0\n", "-1.43 2.0 -1.4285714285714284 0.5 1.0 13.331648111343384 13 5000000.0\n", "-0.71 1.0 -0.7142857142857144 0.5 1.0 14.949140787124634 15 5000000.0\n", "0.0 2.0 0.0 0.5 2.0 16.650282859802246 17 5000000.0\n", "0.71 2.0 0.7142857142857144 0.5 2.0 18.361730813980103 18 5000000.0\n", "1.43 1.0 1.4285714285714288 0.5 2.0 20.046799898147583 20 5000000.0\n", "2.14 2.0 2.1428571428571432 0.5 0.0 21.749138832092285 22 5000000.0\n", "2.86 1.0 2.8571428571428577 0.4 2.0 23.461166858673096 23 4000000.0\n", "3.5700000000000003 2.0 3.571428571428571 0.5 3.0 25.067540168762207 25 5000000.0\n", "4.29 2.0 4.2857142857142865 0.5 2.0 26.777003288269043 27 5000000.0\n", "5.0 3.0 5.0 0.5 2.0 28.478744506835938 28 5000000.0\n", "#C Tue Feb 19 17:11:49 2019. num_events_primary = 15\n", "#C Tue Feb 19 17:11:49 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.filewriters:wrote scan 3 to SPEC file: spec2.dat\n", "INFO:apstools.examples:\n", "#S 3 TuneAxis.multi_pass_tune()\n", "#D Tue Feb 19 17:12:19 2019\n", "#C Tue Feb 19 17:12:19 2019. plan_type = generator\n", "#C Tue Feb 19 17:12:19 2019. uid = 37c188c0-4f24-4e9b-b8ab-d610dc8797c5\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.3940973681450914, 'peak_sigma': 0.025534621641250733, 'peak_eta': 0.2993015167776747, 'peak_bkg': 0.0045580721055284755}\n", "#MD pass = 3\n", "#MD pass_max = 6\n", "#MD tune_md = {'width': 0.15625, 'initial_position': -1.3900000000000001, 'time_iso8601': '2019-02-19 17:12:19.684373'}\n", "#MD tune_parameters = {'num': 10, 'width': 0.15625, 'initial_position': -1.3900000000000001, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "0.29555630683898926 -1.47 -1.4681250000000001 4343.664517196899 0\n", "0.47817325592041016 -1.45 -1.450763888888889 12001.373933389279 0\n", "0.6789727210998535 -1.43 -1.4334027777777778 36585.97751958579 1\n", "0.8800690174102783 -1.42 -1.4160416666666669 57093.79924666349 1\n", "1.0813727378845215 -1.4000000000000001 -1.3986805555555557 97090.26002609897 1\n", "1.2834296226501465 -1.3800000000000001 -1.3813194444444445 83559.33671408126 1\n", "1.483093023300171 -1.36 -1.3639583333333334 39939.540804745666 1\n", "1.6826446056365967 -1.35 -1.3465972222222224 23744.262772095804 2\n", "1.8820805549621582 -1.33 -1.3292361111111113 7556.046660537259 2\n", "2.0840554237365723 -1.31 -1.3118750000000001 3291.3575120438236 2\n", "#C Tue Feb 19 17:12:22 2019. num_events_primary = 10\n", "#C Tue Feb 19 17:12:22 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:12:22 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.examples:Look at SPEC data file: spec2.dat\n" ] } ], "source": [ "specfile_example(db[-6:][::-3], filename=\"spec2.dat\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# a specific scan\n", "\n", "The `db` object allows us to access scans by UUID (or any shorter version that remains unique in the database)." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:databroker._core:Interpreting key = 37c188c0 as a str\n", "INFO:apstools.filewriters:wrote header to SPEC file: spec3.dat\n", "INFO:apstools.filewriters:wrote scan 3 to SPEC file: spec3.dat\n", "INFO:apstools.examples:\n", "#S 3 TuneAxis.multi_pass_tune()\n", "#D Tue Feb 19 17:12:19 2019\n", "#C Tue Feb 19 17:12:19 2019. plan_type = generator\n", "#C Tue Feb 19 17:12:19 2019. uid = 37c188c0-4f24-4e9b-b8ab-d610dc8797c5\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.3940973681450914, 'peak_sigma': 0.025534621641250733, 'peak_eta': 0.2993015167776747, 'peak_bkg': 0.0045580721055284755}\n", "#MD pass = 3\n", "#MD pass_max = 6\n", "#MD tune_md = {'width': 0.15625, 'initial_position': -1.3900000000000001, 'time_iso8601': '2019-02-19 17:12:19.684373'}\n", "#MD tune_parameters = {'num': 10, 'width': 0.15625, 'initial_position': -1.3900000000000001, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "0.29555630683898926 -1.47 -1.4681250000000001 4343.664517196899 0\n", "0.47817325592041016 -1.45 -1.450763888888889 12001.373933389279 0\n", "0.6789727210998535 -1.43 -1.4334027777777778 36585.97751958579 1\n", "0.8800690174102783 -1.42 -1.4160416666666669 57093.79924666349 1\n", "1.0813727378845215 -1.4000000000000001 -1.3986805555555557 97090.26002609897 1\n", "1.2834296226501465 -1.3800000000000001 -1.3813194444444445 83559.33671408126 1\n", "1.483093023300171 -1.36 -1.3639583333333334 39939.540804745666 1\n", "1.6826446056365967 -1.35 -1.3465972222222224 23744.262772095804 2\n", "1.8820805549621582 -1.33 -1.3292361111111113 7556.046660537259 2\n", "2.0840554237365723 -1.31 -1.3118750000000001 3291.3575120438236 2\n", "#C Tue Feb 19 17:12:22 2019. num_events_primary = 10\n", "#C Tue Feb 19 17:12:22 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:12:22 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.examples:Look at SPEC data file: spec3.dat\n" ] } ], "source": [ "specfile_example(db[\"37c188c0\"], filename=\"spec3.dat\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# a list of specific scans, by UID\n", "\n", "Suppose we have a list of scans where we know the UID of each one, we can build a list of headers and write a SPEC data file with that list. Here, we have such a list of tuning scans." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:databroker._core:Interpreting key = 957d83c as a str\n", "INFO:databroker._core:Interpreting key = c354fe37-e39f as a str\n", "INFO:apstools.filewriters:wrote header to SPEC file: spec_tunes.dat\n", "INFO:apstools.filewriters:wrote scan 5 to SPEC file: spec_tunes.dat\n", "INFO:apstools.examples:\n", "#S 5 TuneAxis.tune()\n", "#D Tue Feb 19 17:12:23 2019\n", "#C Tue Feb 19 17:12:23 2019. plan_type = generator\n", "#C Tue Feb 19 17:12:23 2019. uid = 957d83c1-9f11-47df-936b-ce14a396cd76\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.3940973681450914, 'peak_sigma': 0.025534621641250733, 'peak_eta': 0.2993015167776747, 'peak_bkg': 0.0045580721055284755}\n", "#MD tune_md = {'width': 2.5, 'initial_position': -1.5, 'time_iso8601': '2019-02-19 17:12:23.523994'}\n", "#MD tune_parameters = {'num': 30, 'width': 2.5, 'initial_position': -1.5, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 30\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "1.4876151084899902 -2.75 -2.75 466.4182216464095 1\n", "1.763300895690918 -2.66 -2.663793103448276 467.98001092446935 2\n", "2.0559957027435303 -2.58 -2.5775862068965516 469.67695329594545 2\n", "2.3592529296875 -2.49 -2.4913793103448274 472.047288907075 2\n", "2.6607282161712646 -2.41 -2.405172413793103 474.7040562212433 3\n", "2.9601964950561523 -2.32 -2.3189655172413794 478.5533112429079 3\n", "3.261866807937622 -2.23 -2.2327586206896552 483.7102374329128 3\n", "3.5625996589660645 -2.15 -2.146551724137931 489.9218481592604 4\n", "3.8634884357452393 -2.06 -2.060344827586207 499.7520810347462 4\n", "4.165027141571045 -1.97 -1.9741379310344827 514.5313559643142 4\n", "4.467519521713257 -1.8900000000000001 -1.8879310344827585 534.9524879098316 4\n", "4.767914295196533 -1.8 -1.8017241379310345 573.7873029083775 5\n", "5.068679571151733 -1.72 -1.7155172413793103 638.421240937402 5\n", "5.370610952377319 -1.6300000000000001 -1.629310344827586 802.4190715914328 5\n", "5.671148300170898 -1.54 -1.543103448275862 1345.2990156134879 6\n", "5.971943616867065 -1.46 -1.456896551724138 6869.195912401152 6\n", "6.27273964881897 -1.37 -1.3706896551724137 61175.97828509437 6\n", "6.573951482772827 -1.28 -1.2844827586206895 1886.595248462487 7\n", "6.874150037765503 -1.2 -1.1982758620689653 964.993245164857 7\n", "7.177384614944458 -1.11 -1.1120689655172413 695.6568384742045 7\n", "7.477251768112183 -1.03 -1.0258620689655171 602.2951582973135 7\n", "7.777628183364868 -0.9400000000000001 -0.9396551724137929 550.1478319972741 8\n", "8.077780961990356 -0.85 -0.853448275862069 521.581938800707 8\n", "8.379169702529907 -0.77 -0.7672413793103448 505.8264024061124 8\n", "8.682929039001465 -0.68 -0.6810344827586206 494.0278510735762 9\n", "8.981564283370972 -0.59 -0.5948275862068964 485.9589769631584 9\n", "9.282864570617676 -0.51 -0.5086206896551722 480.7534707945549 9\n", "9.584013223648071 -0.42 -0.42241379310344795 476.3597129378231 10\n", "9.883765935897827 -0.34 -0.3362068965517242 473.3602181333745 10\n", "10.18374490737915 -0.25 -0.25 470.70855736072207 10\n", "#C Tue Feb 19 17:12:35 2019. num_events_primary = 30\n", "#C Tue Feb 19 17:12:35 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:12:35 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.filewriters:wrote scan 4 to SPEC file: spec_tunes.dat\n", "INFO:apstools.examples:\n", "#S 4 TuneAxis.tune()\n", "#D Tue Feb 19 17:10:52 2019\n", "#C Tue Feb 19 17:10:52 2019. plan_type = generator\n", "#C Tue Feb 19 17:10:52 2019. uid = c354fe37-e39f-42a7-b24f-f0b3b59a1c8d\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.1908101513195635, 'peak_sigma': 0.04845116177798686, 'peak_eta': 0.5791263537920676, 'peak_bkg': 0.009752099380040652}\n", "#MD tune_md = {'width': 2.5, 'initial_position': -1.5, 'time_iso8601': '2019-02-19 17:10:52.469540'}\n", "#MD tune_parameters = {'num': 30, 'width': 2.5, 'initial_position': -1.5, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 30\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "1.5282611846923828 -2.75 -2.75 1031.0781222234173 2\n", "1.7947826385498047 -2.66 -2.663793103448276 1038.124882380028 2\n", "2.0949885845184326 -2.58 -2.5775862068965516 1045.5707027522167 2\n", "2.3961782455444336 -2.49 -2.4913793103448274 1055.6426823064076 2\n", "2.6975252628326416 -2.41 -2.405172413793103 1066.5273723241924 3\n", "3.0000083446502686 -2.32 -2.3189655172413794 1081.636234444343 3\n", "3.301807165145874 -2.23 -2.2327586206896552 1100.8270732277776 3\n", "3.6063222885131836 -2.15 -2.146551724137931 1122.5992089242313 4\n", "3.902678966522217 -2.06 -2.060344827586207 1154.602754917537 4\n", "4.207927465438843 -1.97 -1.9741379310344827 1198.2686400084513 4\n", "4.504903078079224 -1.8900000000000001 -1.8879310344827585 1251.974842763437 5\n", "4.808871269226074 -1.8 -1.8017241379310345 1339.2405231938465 5\n", "5.107389211654663 -1.72 -1.7155172413793103 1456.6401171504733 5\n", "5.407644510269165 -1.6300000000000001 -1.629310344827586 1671.5534154874242 5\n", "5.7077476978302 -1.54 -1.543103448275862 2069.107743111472 6\n", "6.01088547706604 -1.46 -1.456896551724138 2792.482433381273 6\n", "6.31035041809082 -1.37 -1.3706896551724137 4965.871174863845 6\n", "6.61227560043335 -1.28 -1.2844827586206895 21903.86549508707 7\n", "6.912786483764648 -1.2 -1.1982758620689653 98213.82577313672 7\n", "7.213726282119751 -1.11 -1.1120689655172413 26762.359490254385 7\n", "7.514627933502197 -1.03 -1.0258620689655171 5965.534216434976 8\n", "7.8161139488220215 -0.9400000000000001 -0.9396551724137929 3058.707062186916 8\n", "8.116997957229614 -0.85 -0.853448275862069 2122.482907082423 8\n", "8.418410062789917 -0.77 -0.7672413793103448 1732.8968958387352 8\n", "8.717623949050903 -0.68 -0.6810344827586206 1491.5940596405608 9\n", "9.018948554992676 -0.59 -0.5948275862068964 1349.3997779440656 9\n", "9.319568157196045 -0.51 -0.5086206896551722 1267.0437716137985 9\n", "9.61972188949585 -0.42 -0.42241379310344795 1203.1256814560968 10\n", "9.921632528305054 -0.34 -0.3362068965517242 1162.4118444259855 10\n", "10.22286057472229 -0.25 -0.25 1128.3988822476103 10\n", "#C Tue Feb 19 17:11:03 2019. num_events_primary = 30\n", "#C Tue Feb 19 17:11:03 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:11:03 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.examples:Look at SPEC data file: spec_tunes.dat\n" ] } ], "source": [ "hh = [db[uid] for uid in \"957d83c c354fe37-e39f\".split()]\n", "specfile_example(hh, filename=\"spec_tunes.dat\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## \"TuneAxis.multi_pass_tune\" plans within a range of dates\n", "\n", "The `db` object allows for filtering arguments based on any keywords in the *start* document and also by time. Here, we filter between certain dates and also by `plan name`. The dates are specified in ISO8601 format and can include precision beyond a millisecond. Also, we write to the default data file: `test_specdata.txt`." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:apstools.filewriters:wrote header to SPEC file: test_specdata.txt\n", "INFO:apstools.filewriters:wrote scan 3 to SPEC file: test_specdata.txt\n", "INFO:apstools.examples:\n", "#S 3 TuneAxis.multi_pass_tune()\n", "#D Tue Feb 19 17:10:49 2019\n", "#C Tue Feb 19 17:10:49 2019. plan_type = generator\n", "#C Tue Feb 19 17:10:49 2019. uid = 30d80cb1-96b7-4453-9f35-b32de8286d5d\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.1908101513195635, 'peak_sigma': 0.04845116177798686, 'peak_eta': 0.5791263537920676, 'peak_bkg': 0.009752099380040652}\n", "#MD pass = 3\n", "#MD pass_max = 6\n", "#MD tune_md = {'width': 0.15625, 'initial_position': -1.19, 'time_iso8601': '2019-02-19 17:10:49.360310'}\n", "#MD tune_parameters = {'num': 10, 'width': 0.15625, 'initial_position': -1.19, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "0.3052546977996826 -1.27 -1.268125 27817.58713004543 0\n", "0.4878973960876465 -1.25 -1.2507638888888888 44167.199207974816 0\n", "0.6943871974945068 -1.23 -1.2334027777777776 66328.59565348615 1\n", "0.8916161060333252 -1.22 -1.2160416666666667 78568.02440337591 1\n", "1.091200351715088 -1.2 -1.1986805555555555 98213.82577313672 1\n", "1.2912886142730713 -1.18 -1.1813194444444444 97194.39668900441 1\n", "1.4931659698486328 -1.16 -1.1639583333333332 76595.65411197038 1\n", "1.6913893222808838 -1.1500000000000001 -1.1465972222222223 64371.45174610299 2\n", "1.898305892944336 -1.1300000000000001 -1.129236111111111 42610.30009549146 2\n", "2.094428062438965 -1.11 -1.111875 26762.359490254385 2\n", "#C Tue Feb 19 17:10:51 2019. num_events_primary = 10\n", "#C Tue Feb 19 17:10:51 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.filewriters:wrote scan 2 to SPEC file: test_specdata.txt\n", "INFO:apstools.examples:\n", "#S 2 TuneAxis.multi_pass_tune()\n", "#D Tue Feb 19 17:10:45 2019\n", "#C Tue Feb 19 17:10:45 2019. plan_type = generator\n", "#C Tue Feb 19 17:10:45 2019. uid = 0d45103a-1e4a-488e-9230-3eda0e48ec7f\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.1908101513195635, 'peak_sigma': 0.04845116177798686, 'peak_eta': 0.5791263537920676, 'peak_bkg': 0.009752099380040652}\n", "#MD pass = 2\n", "#MD pass_max = 6\n", "#MD tune_md = {'width': -0.625, 'initial_position': -1.12, 'time_iso8601': '2019-02-19 17:10:45.459008'}\n", "#MD tune_parameters = {'num': 10, 'width': -0.625, 'initial_position': -1.12, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "0.5959692001342773 -0.81 -0.8075000000000001 1897.761507700745 1\n", "0.8786449432373047 -0.88 -0.8769444444444445 2349.1376829086926 1\n", "1.1802291870117188 -0.9500000000000001 -0.946388888888889 3228.5812811745923 1\n", "1.4803869724273682 -1.02 -1.0158333333333334 5372.078238670836 1\n", "1.7817153930664062 -1.09 -1.0852777777777778 16674.038926345016 2\n", "2.0819091796875 -1.1500000000000001 -1.1547222222222224 64371.45174610299 2\n", "2.3832626342773438 -1.22 -1.2241666666666668 78568.02440337591 2\n", "2.6844818592071533 -1.29 -1.2936111111111113 17308.293055160128 3\n", "2.9848523139953613 -1.36 -1.3630555555555557 5459.269724815441 3\n", "3.2863705158233643 -1.43 -1.4325 3258.036971621823 3\n", "#C Tue Feb 19 17:10:49 2019. num_events_primary = 10\n", "#C Tue Feb 19 17:10:49 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:10:49 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.filewriters:wrote scan 1 to SPEC file: test_specdata.txt\n", "INFO:apstools.examples:\n", "#S 1 TuneAxis.multi_pass_tune()\n", "#D Tue Feb 19 17:10:38 2019\n", "#C Tue Feb 19 17:10:38 2019. plan_type = generator\n", "#C Tue Feb 19 17:10:38 2019. uid = 481a04b2-d932-496a-b326-e106df42d413\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.1908101513195635, 'peak_sigma': 0.04845116177798686, 'peak_eta': 0.5791263537920676, 'peak_bkg': 0.009752099380040652}\n", "#MD pass = 1\n", "#MD pass_max = 6\n", "#MD tune_md = {'width': 2.5, 'initial_position': -1.5, 'time_iso8601': '2019-02-19 17:10:38.249354'}\n", "#MD tune_parameters = {'num': 10, 'width': 2.5, 'initial_position': -1.5, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "1.489405870437622 -2.75 -2.75 1031.0781222234173 1\n", "1.9589977264404297 -2.47 -2.4722222222222223 1058.1738279963984 2\n", "2.469857931137085 -2.19 -2.1944444444444446 1111.0618403834828 2\n", "2.9717459678649902 -1.92 -1.9166666666666665 1229.7682698861865 3\n", "3.465754985809326 -1.6400000000000001 -1.6388888888888888 1641.2467168949536 3\n", "3.9768714904785156 -1.36 -1.3611111111111112 5459.269724815441 4\n", "4.483443975448608 -1.08 -1.0833333333333333 13348.62794051419 4\n", "4.986635684967041 -0.81 -0.8055555555555554 1897.761507700745 5\n", "5.485551118850708 -0.53 -0.5277777777777777 1284.8804242620822 5\n", "5.976162910461426 -0.25 -0.25 1128.3988822476103 6\n", "#C Tue Feb 19 17:10:45 2019. num_events_primary = 10\n", "#C Tue Feb 19 17:10:45 2019. num_events_PeakStats = 1\n", "#C Tue Feb 19 17:10:45 2019. exit_status = success\n", "INFO:apstools.examples:############################################################\n", "INFO:apstools.examples:Look at SPEC data file: test_specdata.txt\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "30d80cb1 2019-02-19 17:10:49.360310\n", "0d45103a 2019-02-19 17:10:45.459008\n", "481a04b2 2019-02-19 17:10:38.249354\n" ] } ], "source": [ "hh = db(plan_name=\"TuneAxis.multi_pass_tune\", since=\"2019-02-19 17:00\", until=\"2019-02-19 17:11:30\")\n", "for h in hh:\n", " print(h.start[\"uid\"][:8], h.start[\"tune_md\"][\"time_iso8601\"])\n", "specfile_example(hh)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.6" } }, "nbformat": 4, "nbformat_minor": 2 }