{ "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 APS_BlueSky_tools.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", " \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", "
hostname \n", " \n", " \n", " mint-vm\n", " \n", " \n", "
iso8601 \n", " \n", " \n", " 2018-12-27 00:36:00.050644\n", " \n", " \n", "
login_id \n", " \n", " \n", " mintadmin@mint-vm\n", " \n", " \n", "
plan_description \n", " \n", " \n", " archive snapshot of ophyd Signals (usually EPICS PVs)\n", " \n", " \n", "
plan_name \n", " \n", " \n", " snapshot\n", " \n", " \n", "
plan_type \n", " \n", " \n", " generator\n", " \n", " \n", "
purpose \n", " \n", " \n", " example\n", " \n", " \n", "
scan_id \n", " \n", " \n", " 1\n", " \n", " \n", "
software_versions \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", "
APS_Bluesky_Tools \n", " \n", " \n", " 0.0.40+1.g8705698\n", " \n", " \n", "
bluesky \n", " \n", " \n", " 1.4.1\n", " \n", " \n", "
databroker \n", " \n", " \n", " 0.11.3\n", " \n", " \n", "
ophyd \n", " \n", " \n", " 1.3.0\n", " \n", " \n", "
PyEpics \n", " \n", " \n", " 3.3.1\n", " \n", " \n", "
python \n", " \n", " \n", " 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51) \n", "[GCC 7.2.0]\n", " \n", " \n", "
\n", " \n", "
time \n", " \n", " \n", " 7 days ago (2018-12-27T00:36:00.051762)\n", " \n", " \n", "
uid \n", " \n", " \n", " 9bc1fe93-e56b-4dfc-a2bc-ee91b6f88200\n", " \n", " \n", "
username \n", " \n", " \n", " mintadmin\n", " \n", " \n", "
" ], "text/plain": [ "{'time': 1545892560.0517623,\n", " 'uid': '9bc1fe93-e56b-4dfc-a2bc-ee91b6f88200',\n", " 'hints': {},\n", " 'software_versions': {'python': '3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51) \\n[GCC 7.2.0]',\n", " 'PyEpics': '3.3.1',\n", " 'bluesky': '1.4.1',\n", " 'ophyd': '1.3.0',\n", " 'databroker': '0.11.3',\n", " 'APS_Bluesky_Tools': '0.0.40+1.g8705698'},\n", " 'iso8601': '2018-12-27 00:36:00.050644',\n", " 'plan_type': 'generator',\n", " 'plan_name': 'snapshot',\n", " 'username': 'mintadmin',\n", " 'scan_id': 1,\n", " 'plan_description': 'archive snapshot of ophyd Signals (usually EPICS PVs)',\n", " 'login_id': 'mintadmin@mint-vm',\n", " 'hostname': 'mint-vm',\n", " 'purpose': 'example'}" ] }, "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", "
timesignal_0signal_1
seq_num
12018-12-27 00:36:00.1932270530.50044221.118952
\n", "
" ], "text/plain": [ " time signal_0 signal_1\n", "seq_num \n", "1 2018-12-27 00:36:00.193227053 0.500442 21.118952" ] }, "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: `/tmp/spec1.dat`):" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:APS_BlueSky_tools.filewriters:wrote header to SPEC file: /tmp/spec1.dat\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1 to SPEC file: /tmp/spec1.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1 snapshot()\n", "#D Thu Dec 27 00:36:00 2018\n", "#C Thu Dec 27 00:36:00 2018. plan_type = generator\n", "#C Thu Dec 27 00:36:00 2018. uid = 9bc1fe93-e56b-4dfc-a2bc-ee91b6f88200\n", "#MD hostname = mint-vm\n", "#MD iso8601 = 2018-12-27 00:36:00.050644\n", "#MD login_id = mintadmin@mint-vm\n", "#MD plan_description = archive snapshot of ophyd Signals (usually EPICS PVs)\n", "#MD purpose = example\n", "#MD software_versions = {'python': '3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51) \\n[GCC 7.2.0]', 'PyEpics': '3.3.1', 'bluesky': '1.4.1', 'ophyd': '1.3.0', 'databroker': '0.11.3', 'APS_Bluesky_Tools': '0.0.40+1.g8705698'}\n", "#MD username = mintadmin\n", "#N 1\n", "#L Epoch_float signal_0 signal_1 Epoch\n", "0.1414647102355957 0.5004422061971736 21.11895183692659 0\n", "#C Thu Dec 27 00:36:00 2018. num_events_primary = 1\n", "#C Thu Dec 27 00:36:00 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.examples:Look at SPEC data file: /tmp/spec1.dat\n" ] } ], "source": [ "specfile_example(h, filename=\"/tmp/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 /tmp/spec1.dat\r\n", "#E 1546553635\r\n", "#D Thu Jan 03 16:13:55 2019\r\n", "#C BlueSky user = mintadmin host = mint-vm\r\n", "\r\n", "#S 1 snapshot()\r\n", "#D Thu Dec 27 00:36:00 2018\r\n", "#C Thu Dec 27 00:36:00 2018. plan_type = generator\r\n", "#C Thu Dec 27 00:36:00 2018. uid = 9bc1fe93-e56b-4dfc-a2bc-ee91b6f88200\r\n", "#MD hostname = mint-vm\r\n", "#MD iso8601 = 2018-12-27 00:36:00.050644\r\n", "#MD login_id = mintadmin@mint-vm\r\n", "#MD plan_description = archive snapshot of ophyd Signals (usually EPICS PVs)\r\n", "#MD purpose = example\r\n", "#MD software_versions = {'python': '3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51) \\n[GCC 7.2.0]', 'PyEpics': '3.3.1', 'bluesky': '1.4.1', 'ophyd': '1.3.0', 'databroker': '0.11.3', 'APS_Bluesky_Tools': '0.0.40+1.g8705698'}\r\n", "#MD username = mintadmin\r\n", "#N 1\r\n", "#L Epoch_float signal_0 signal_1 Epoch\r\n", "0.1414647102355957 0.5004422061971736 21.11895183692659 0\r\n", "#C Thu Dec 27 00:36:00 2018. num_events_primary = 1\r\n", "#C Thu Dec 27 00:36:00 2018. exit_status = success\r\n" ] } ], "source": [ "!cat /tmp/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 shortcut the call to the command view its output" ] }, { "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:APS_BlueSky_tools.filewriters:wrote header to SPEC file: spec2.dat\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1123 to SPEC file: spec2.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1123 TuneAxis.multi_pass_tune()\n", "#D Wed Dec 26 22:53:10 2018\n", "#C Wed Dec 26 22:53:10 2018. plan_type = generator\n", "#C Wed Dec 26 22:53:10 2018. uid = 9c2d8735-3653-4b42-8428-aed4f2338cbc\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-11 14:03:08.460986\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.4910027475019858, 'peak_sigma': 0.035867168639114114, 'peak_eta': 0.274478257770014, 'peak_bkg': 0.009072591644989138}\n", "#MD pass = 1\n", "#MD pass_max = 6\n", "#MD pid = 22941\n", "#MD proposal_id = None\n", "#MD tune_md = {'width': 2, 'initial_position': -1.5, 'time_iso8601': '2018-12-26 22:53:10.176716'}\n", "#MD tune_parameters = {'num': 10, 'width': 2, '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.2862999439239502 -2.5 -2.5 941.8988337567732 1\n", "1.7633566856384277 -2.2800000000000002 -2.2777777777777777 963.8641386665465 2\n", "2.2642645835876465 -2.06 -2.0555555555555554 1015.891607662856 2\n", "2.767444610595703 -1.83 -1.8333333333333335 1211.120270435262 3\n", "3.268343687057495 -1.61 -1.6111111111111112 3488.620893077524 3\n", "3.7683510780334473 -1.3900000000000001 -1.3888888888888888 5357.115036441337 4\n", "4.268711566925049 -1.17 -1.1666666666666667 1245.710464865523 4\n", "4.769507646560669 -0.9400000000000001 -0.9444444444444446 1023.0724205079424 5\n", "5.271408557891846 -0.72 -0.7222222222222223 966.531417360313 5\n", "5.78016471862793 -0.5 -0.5 943.1665597678073 6\n", "#C Wed Dec 26 22:53:17 2018. num_events_primary = 10\n", "#C Wed Dec 26 22:53:17 2018. num_events_PeakStats = 1\n", "#C Wed Dec 26 22:53:17 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1126 to SPEC file: spec2.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1126 TuneAxis.tune()\n", "#D Wed Dec 26 22:53:23 2018\n", "#C Wed Dec 26 22:53:23 2018. plan_type = generator\n", "#C Wed Dec 26 22:53:23 2018. uid = 61cfbe3b-a9d6-4fcd-ab7e-7a958e264f7c\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-11 14:03:08.460986\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.4910027475019858, 'peak_sigma': 0.035867168639114114, 'peak_eta': 0.274478257770014, 'peak_bkg': 0.009072591644989138}\n", "#MD pid = 22941\n", "#MD proposal_id = None\n", "#MD tune_md = {'width': 2, 'initial_position': -1.5, 'time_iso8601': '2018-12-26 22:53:23.707511'}\n", "#MD tune_parameters = {'num': 30, 'width': 2, '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.3015248775482178 -2.5 -2.5 941.8988337567732 1\n", "1.5810911655426025 -2.43 -2.4310344827586206 947.2481425955149 2\n", "1.8819727897644043 -2.36 -2.3620689655172415 953.938655742215 2\n", "2.183619260787964 -2.29 -2.293103448275862 962.4589367299508 2\n", "2.482908248901367 -2.22 -2.2241379310344827 973.5418849803063 2\n", "2.7829902172088623 -2.16 -2.155172413793103 985.928762146861 3\n", "3.0842223167419434 -2.09 -2.086206896551724 1005.3205709468167 3\n", "3.3849682807922363 -2.02 -2.0172413793103448 1032.8631353302976 3\n", "3.685049533843994 -1.95 -1.9482758620689655 1073.845019664001 4\n", "3.9857964515686035 -1.8800000000000001 -1.8793103448275863 1138.6427117046546 4\n", "4.287221431732178 -1.81 -1.8103448275862069 1249.926147102835 4\n", "4.592670202255249 -1.74 -1.7413793103448276 1465.2073967315803 5\n", "4.889814376831055 -1.67 -1.6724137931034484 1967.071529433235 5\n", "5.193090438842773 -1.6 -1.603448275862069 4305.651308489628 5\n", "5.495426654815674 -1.53 -1.5344827586206897 53659.95108923816 5\n", "5.796449661254883 -1.47 -1.4655172413793103 82467.84575146709 6\n", "6.095568895339966 -1.4000000000000001 -1.396551724137931 7500.245212284662 6\n", "6.395973443984985 -1.33 -1.3275862068965518 2208.092342372961 6\n", "6.703924179077148 -1.26 -1.2586206896551724 1553.3925279814487 7\n", "6.996590852737427 -1.19 -1.1896551724137931 1291.5306003925123 7\n", "7.296735048294067 -1.12 -1.1206896551724137 1161.4194494982387 7\n", "7.5970540046691895 -1.05 -1.0517241379310345 1087.6258272265723 8\n", "7.898257493972778 -0.98 -0.9827586206896552 1041.820820583454 8\n", "8.197754383087158 -0.91 -0.9137931034482758 1011.4654269614203 8\n", "8.498052597045898 -0.84 -0.8448275862068966 990.3245712352481 8\n", "8.799044609069824 -0.78 -0.7758620689655173 976.9307664569862 9\n", "9.100969314575195 -0.71 -0.7068965517241379 965.0264586778117 9\n", "9.400976181030273 -0.64 -0.6379310344827587 955.9300706758908 9\n", "9.70397162437439 -0.5700000000000001 -0.5689655172413794 948.823623519297 10\n", "10.00889801979065 -0.5 -0.5 943.1665597678073 10\n", "#C Wed Dec 26 22:53:35 2018. num_events_primary = 30\n", "#C Wed Dec 26 22:53:35 2018. num_events_PeakStats = 1\n", "#C Wed Dec 26 22:53:35 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.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 = 2da6161b as a str\n", "INFO:APS_BlueSky_tools.filewriters:wrote header to SPEC file: spec3.dat\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 14 to SPEC file: spec3.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 14 scan(detectors=['synthetic_pseudovoigt'], num=219, motor=['m1'], start=-2, stop=0, per_step=None)\n", "#D Thu Oct 26 11:26:39 2017\n", "#C Thu Oct 26 11:26:39 2017. plan_type = generator\n", "#C Thu Oct 26 11:26:39 2017. uid = 2da6161b-bc43-4eb2-b696-ecc1f256a366\n", "#MD EPICS_BASE = /usr/local/epics/base\n", "#MD EPICS_BASE_BIN = /usr/local/epics/base/bin/linux-x86_64\n", "#MD EPICS_BASE_LIB = /usr/local/epics/base/lib/linux-x86_64\n", "#MD EPICS_CA_MAX_ARRAY_BYTES = 16777216\n", "#MD EPICS_EXT = /usr/local/epics/opi\n", "#MD EPICS_EXT_BIN = /usr/local/epics/opi/bin/linux-x86_64\n", "#MD EPICS_EXT_LIB = /usr/local/epics/opi/lib/linux-x86_64\n", "#MD EPICS_HOST_ARCH = linux-x86_64\n", "#MD EPICS_ROOT = /usr/local/epics\n", "#MD beamline_id = developer__YOUR_BEAMLINE_HERE\n", "#MD login_id = mintadmin@mint-vm\n", "#MD motors = ['m1']\n", "#MD num_intervals = 218\n", "#MD num_points = 219\n", "#MD pid = 14515\n", "#MD plan_pattern = linspace\n", "#MD plan_pattern_args = {'start': -2, 'stop': 0, 'num': 219}\n", "#MD plan_pattern_module = numpy\n", "#MD proposal_id = None\n", "#N 219\n", "#L m1 m1_user_setpoint Epoch_float Epoch synthetic_pseudovoigt\n", "-2.0 -2.0 1.9395842552185059 2 112\n", "-1.99 -1.9908256880733946 2.0696828365325928 2 119\n", "-1.98 -1.981651376146789 2.1708405017852783 2 124\n", "-1.97 -1.9724770642201834 2.272226333618164 2 145\n", "-1.96 -1.963302752293578 2.372858762741089 2 138\n", "-1.95 -1.9541284403669725 2.473381519317627 2 132\n", "-1.94 -1.9449541284403669 2.5735628604888916 3 127\n", "-1.94 -1.9357798165137614 2.5911591053009033 3 141\n", "-1.93 -1.926605504587156 2.7717196941375732 3 154\n", "-1.92 -1.9174311926605505 2.8738749027252197 3 147\n", "-1.9100000000000001 -1.908256880733945 2.973125457763672 3 132\n", "-1.9000000000000001 -1.8990825688073394 3.074604034423828 3 176\n", "-1.8900000000000001 -1.889908256880734 3.175036907196045 3 161\n", "-1.8800000000000001 -1.8807339449541285 3.2741494178771973 3 169\n", "-1.87 -1.8715596330275228 3.3734636306762695 3 189\n", "-1.86 -1.8623853211009174 3.4737887382507324 3 169\n", "-1.85 -1.853211009174312 3.5743889808654785 4 182\n", "-1.84 -1.8440366972477065 3.6745359897613525 4 187\n", "-1.83 -1.834862385321101 3.7755277156829834 4 217\n", "-1.83 -1.8256880733944953 3.7829203605651855 4 221\n", "-1.82 -1.81651376146789 3.9755640029907227 4 202\n", "-1.81 -1.8073394495412844 4.07573938369751 4 202\n", "-1.8 -1.7981651376146788 4.176030158996582 4 206\n", "-1.79 -1.7889908256880733 4.276244878768921 4 247\n", "-1.78 -1.7798165137614679 4.376862049102783 4 224\n", "-1.77 -1.7706422018348624 4.47678804397583 4 289\n", "-1.76 -1.761467889908257 4.5770955085754395 5 238\n", "-1.75 -1.7522935779816513 4.676918029785156 5 279\n", "-1.74 -1.7431192660550459 4.777415752410889 5 298\n", "-1.73 -1.7339449541284404 4.8775835037231445 5 316\n", "-1.72 -1.7247706422018347 4.977626800537109 5 326\n", "-1.72 -1.7155963302752293 5.016370058059692 5 282\n", "-1.71 -1.7064220183486238 5.180034399032593 5 313\n", "-1.7 -1.6972477064220184 5.280364274978638 5 328\n", "-1.69 -1.688073394495413 5.3807830810546875 5 358\n", "-1.68 -1.6788990825688073 5.479346513748169 5 405\n", "-1.67 -1.6697247706422018 5.582485675811768 6 382\n", "-1.6600000000000001 -1.6605504587155964 5.681021451950073 6 403\n", "-1.6500000000000001 -1.6513761467889907 5.779608249664307 6 454\n", "-1.6400000000000001 -1.6422018348623852 5.883913278579712 6 479\n", "-1.6300000000000001 -1.6330275229357798 5.982940196990967 6 480\n", "-1.62 -1.6238532110091743 6.084304094314575 6 565\n", "-1.61 -1.614678899082569 6.184609651565552 6 557\n", "-1.61 -1.6055045871559632 6.229325294494629 6 494\n", "-1.6 -1.5963302752293578 6.387313604354858 6 574\n", "-1.59 -1.5871559633027523 6.48369288444519 6 643\n", "-1.58 -1.5779816513761467 6.586878299713135 7 704\n", "-1.57 -1.5688073394495412 6.683458089828491 7 703\n", "-1.56 -1.5596330275229358 6.782962083816528 7 752\n", "-1.55 -1.5504587155963303 6.887020826339722 7 779\n", "-1.54 -1.5412844036697249 6.983880281448364 7 909\n", "-1.53 -1.5321100917431192 7.084657430648804 7 977\n", "-1.52 -1.5229357798165137 7.1844165325164795 7 1048\n", "-1.51 -1.5137614678899083 7.283660650253296 7 1154\n", "-1.5 -1.5045871559633026 7.384425640106201 7 1266\n", "-1.5 -1.4954128440366972 7.427963972091675 7 1262\n", "-1.49 -1.4862385321100917 7.583920478820801 8 1314\n", "-1.48 -1.4770642201834863 7.684139728546143 8 1516\n", "-1.47 -1.4678899082568808 7.784097909927368 8 1600\n", "-1.46 -1.4587155963302751 7.885835409164429 8 1821\n", "-1.45 -1.4495412844036697 7.983985185623169 8 2057\n", "-1.44 -1.4403669724770642 8.084051132202148 8 2226\n", "-1.43 -1.4311926605504586 8.186283826828003 8 2575\n", "-1.42 -1.4220183486238531 8.287083148956299 8 2997\n", "-1.41 -1.4128440366972477 8.388326644897461 8 3394\n", "-1.4000000000000001 -1.4036697247706422 8.485675811767578 8 4059\n", "-1.3900000000000001 -1.3944954128440368 8.590278148651123 9 4797\n", "-1.3900000000000001 -1.385321100917431 8.600952863693237 9 4663\n", "-1.3800000000000001 -1.3761467889908257 8.787045955657959 9 5647\n", "-1.37 -1.3669724770642202 8.891448020935059 9 7043\n", "-1.36 -1.3577981651376145 8.9878830909729 9 9220\n", "-1.35 -1.348623853211009 9.090094089508057 9 12324\n", "-1.34 -1.3394495412844036 9.190693140029907 9 17358\n", "-1.33 -1.3302752293577982 9.286706686019897 9 24998\n", "-1.32 -1.3211009174311927 9.387281656265259 9 36285\n", "-1.31 -1.311926605504587 9.486842155456543 9 52364\n", "-1.3 -1.3027522935779816 9.587370157241821 10 71767\n", "-1.29 -1.2935779816513762 9.687591314315796 10 90243\n", "-1.28 -1.2844036697247705 9.787331819534302 10 99942\n", "-1.28 -1.275229357798165 9.830183506011963 10 100244\n", "-1.27 -1.2660550458715596 9.987783670425415 10 91518\n", "-1.26 -1.2568807339449541 10.088390111923218 10 72638\n", "-1.25 -1.2477064220183487 10.18844723701477 10 53672\n", "-1.24 -1.238532110091743 10.288351774215698 10 37571\n", "-1.23 -1.2293577981651376 10.389311790466309 10 26193\n", "-1.22 -1.2201834862385321 10.489424228668213 10 17891\n", "-1.21 -1.2110091743119265 10.58936095237732 11 12597\n", "-1.2 -1.201834862385321 10.689095497131348 11 9334\n", "-1.19 -1.1926605504587156 10.789262294769287 11 7145\n", "-1.18 -1.18348623853211 10.890271663665771 11 5704\n", "-1.17 -1.1743119266055047 10.990951776504517 11 4726\n", "-1.17 -1.165137614678899 10.998348951339722 11 4725\n", "-1.16 -1.1559633027522935 11.19012188911438 11 4010\n", "-1.1500000000000001 -1.146788990825688 11.290762186050415 11 3423\n", "-1.1400000000000001 -1.1376146788990824 11.391414165496826 11 2897\n", "-1.1300000000000001 -1.128440366972477 11.490862131118774 11 2624\n", "-1.12 -1.1192660550458715 11.592016220092773 12 2409\n", "-1.11 -1.110091743119266 11.691657066345215 12 2036\n", "-1.1 -1.1009174311926606 11.791643381118774 12 1786\n", "-1.09 -1.091743119266055 11.893255949020386 12 1645\n", "-1.08 -1.0825688073394495 11.993340253829956 12 1540\n", "-1.07 -1.073394495412844 12.094505548477173 12 1373\n", "-1.06 -1.0642201834862384 12.192294120788574 12 1242\n", "-1.06 -1.055045871559633 12.230493545532227 12 1199\n", "-1.05 -1.0458715596330275 12.3928062915802 12 1152\n", "-1.04 -1.036697247706422 12.492995262145996 12 1030\n", "-1.03 -1.0275229357798166 12.593729734420776 13 956\n", "-1.02 -1.018348623853211 12.693986654281616 13 878\n", "-1.01 -1.0091743119266054 12.79402232170105 13 787\n", "-1.0 -1.0 12.894392251968384 13 705\n", "-0.99 -0.9908256880733943 12.99453067779541 13 685\n", "-0.98 -0.9816513761467889 13.09462022781372 13 706\n", "-0.97 -0.9724770642201834 13.194965839385986 13 674\n", "-0.96 -0.963302752293578 13.295603036880493 13 582\n", "-0.9500000000000001 -0.9541284403669725 13.395906209945679 13 593\n", "-0.9400000000000001 -0.9449541284403669 13.496107816696167 13 504\n", "-0.9400000000000001 -0.9357798165137614 13.504606246948242 14 565\n", "-0.93 -0.926605504587156 13.696172714233398 14 488\n", "-0.92 -0.9174311926605503 13.796854019165039 14 469\n", "-0.91 -0.9082568807339448 13.896867990493774 14 433\n", "-0.9 -0.8990825688073394 13.997188806533813 14 431\n", "-0.89 -0.8899082568807339 14.097322463989258 14 431\n", "-0.88 -0.8807339449541285 14.197948932647705 14 384\n", "-0.87 -0.8715596330275228 14.298686981201172 14 370\n", "-0.86 -0.8623853211009174 14.399257898330688 14 377\n", "-0.85 -0.8532110091743119 14.500046253204346 15 333\n", "-0.84 -0.8440366972477062 14.59972071647644 15 307\n", "-0.8300000000000001 -0.8348623853211008 14.700014114379883 15 283\n", "-0.8300000000000001 -0.8256880733944953 14.707324504852295 15 288\n", "-0.8200000000000001 -0.8165137614678899 14.899789571762085 15 282\n", "-0.81 -0.8073394495412844 15.000442504882812 15 271\n", "-0.8 -0.7981651376146788 15.101571559906006 15 228\n", "-0.79 -0.7889908256880733 15.201624631881714 15 231\n", "-0.78 -0.7798165137614679 15.301820516586304 15 259\n", "-0.77 -0.7706422018348622 15.402301788330078 15 238\n", "-0.76 -0.7614678899082568 15.502833604812622 16 222\n", "-0.75 -0.7522935779816513 15.6026930809021 16 231\n", "-0.74 -0.7431192660550459 15.703521013259888 16 200\n", "-0.73 -0.7339449541284404 15.802560329437256 16 217\n", "-0.72 -0.7247706422018347 15.90340256690979 16 176\n", "-0.72 -0.7155963302752293 15.910638809204102 16 190\n", "-0.71 -0.7064220183486238 16.103215217590332 16 195\n", "-0.7000000000000001 -0.6972477064220182 16.20481824874878 16 182\n", "-0.6900000000000001 -0.6880733944954127 16.3049795627594 16 169\n", "-0.68 -0.6788990825688073 16.40790843963623 16 180\n", "-0.67 -0.6697247706422018 16.506754398345947 17 172\n", "-0.66 -0.6605504587155964 16.607179403305054 17 138\n", "-0.65 -0.6513761467889907 16.7057785987854 17 151\n", "-0.64 -0.6422018348623852 16.80614686012268 17 135\n", "-0.63 -0.6330275229357798 16.905557870864868 17 155\n", "-0.62 -0.6238532110091741 17.007532119750977 17 136\n", "-0.61 -0.6146788990825687 17.106295108795166 17 134\n", "-0.61 -0.6055045871559632 17.114012241363525 17 126\n", "-0.6 -0.5963302752293578 17.3066885471344 17 134\n", "-0.59 -0.5871559633027523 17.408047199249268 17 151\n", "-0.58 -0.5779816513761467 17.508710861206055 18 133\n", "-0.5700000000000001 -0.5688073394495412 17.608813524246216 18 124\n", "-0.56 -0.5596330275229358 17.70949673652649 18 116\n", "-0.55 -0.5504587155963301 17.80957531929016 18 131\n", "-0.54 -0.5412844036697246 17.909557819366455 18 97\n", "-0.53 -0.5321100917431192 18.00915217399597 18 94\n", "-0.52 -0.5229357798165137 18.10949683189392 18 114\n", "-0.51 -0.5137614678899083 18.209950923919678 18 94\n", "-0.5 -0.5045871559633026 18.310138940811157 18 104\n", "-0.5 -0.49541284403669716 18.34817910194397 18 99\n", "-0.49 -0.4862385321100917 18.511037588119507 19 96\n", "-0.48 -0.47706422018348604 18.611883878707886 19 97\n", "-0.47000000000000003 -0.4678899082568806 18.711103677749634 19 110\n", "-0.46 -0.45871559633027514 18.81114625930786 19 84\n", "-0.45 -0.4495412844036697 18.911903858184814 19 97\n", "-0.44 -0.44036697247706424 19.012233018875122 19 73\n", "-0.43 -0.4311926605504586 19.11232829093933 19 83\n", "-0.42 -0.4220183486238531 19.21228337287903 19 83\n", "-0.41000000000000003 -0.4128440366972477 19.312379598617554 19 78\n", "-0.4 -0.403669724770642 19.412643909454346 19 83\n", "-0.39 -0.39449541284403655 19.51251459121704 20 62\n", "-0.39 -0.3853211009174311 19.523064613342285 20 82\n", "-0.38 -0.37614678899082565 19.71285653114319 20 77\n", "-0.37 -0.3669724770642202 19.8134286403656 20 81\n", "-0.36 -0.35779816513761453 19.913554191589355 20 73\n", "-0.35000000000000003 -0.3486238532110091 20.013850688934326 20 81\n", "-0.34 -0.33944954128440363 20.113746166229248 20 62\n", "-0.33 -0.33027522935779796 20.213977813720703 20 61\n", "-0.32 -0.3211009174311925 20.313727855682373 20 78\n", "-0.31 -0.31192660550458706 20.414042949676514 20 71\n", "-0.3 -0.3027522935779816 20.514230012893677 21 74\n", "-0.29 -0.29357798165137616 20.614856958389282 21 63\n", "-0.28 -0.2844036697247705 20.715309381484985 21 54\n", "-0.28 -0.27522935779816504 20.75356960296631 21 57\n", "-0.27 -0.2660550458715596 20.91570258140564 21 53\n", "-0.26 -0.2568807339449539 21.01627540588379 21 60\n", "-0.25 -0.24770642201834847 21.117006540298462 21 54\n", "-0.24 -0.23853211009174302 21.21702289581299 21 42\n", "-0.23 -0.22935779816513757 21.3173828125 21 58\n", "-0.22 -0.22018348623853212 21.417680501937866 21 55\n", "-0.21 -0.21100917431192645 21.51746106147766 22 43\n", "-0.2 -0.201834862385321 21.61775493621826 22 53\n", "-0.19 -0.19266055045871555 21.717957258224487 22 43\n", "-0.18 -0.18348623853210988 21.8186457157135 22 44\n", "-0.17 -0.17431192660550443 21.918312788009644 22 50\n", "-0.17 -0.16513761467889898 21.92911458015442 22 52\n", "-0.16 -0.15596330275229353 22.118823051452637 22 54\n", "-0.15 -0.14678899082568808 22.22012495994568 22 53\n", "-0.14 -0.1376146788990824 22.320998191833496 22 37\n", "-0.13 -0.12844036697247696 22.422715187072754 22 42\n", "-0.12 -0.11926605504587151 22.522484302520752 23 39\n", "-0.11 -0.11009174311926584 22.620289087295532 23 35\n", "-0.1 -0.10091743119266039 22.721237421035767 23 35\n", "-0.09 -0.09174311926605494 22.82141399383545 23 39\n", "-0.08 -0.08256880733944949 22.921337127685547 23 40\n", "-0.07 -0.07339449541284404 23.020631790161133 23 43\n", "-0.06 -0.06422018348623837 23.12148427963257 23 46\n", "-0.06 -0.05504587155963292 23.12960433959961 23 44\n", "-0.05 -0.04587155963302747 23.32191562652588 23 42\n", "-0.04 -0.0366972477064218 23.423556327819824 23 46\n", "-0.03 -0.02752293577981635 23.526545524597168 24 38\n", "-0.02 -0.0183486238532109 23.625982999801636 24 45\n", "-0.01 -0.00917431192660545 23.7215633392334 24 27\n", "0.0 0.0 23.821766138076782 24 34\n", "#C Thu Oct 26 11:27:03 2017. exit_status = success\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.examples:Look at SPEC data file: spec3.dat\n" ] } ], "source": [ "specfile_example(db[\"2da6161b\"], 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 = 9c2d8735 as a str\n", "INFO:databroker._core:Interpreting key = 099a1882 as a str\n", "INFO:databroker._core:Interpreting key = 98c92dd2 as a str\n", "INFO:databroker._core:Interpreting key = 61cfbe3b as a str\n", "INFO:APS_BlueSky_tools.filewriters:wrote header to SPEC file: spec_tunes.dat\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1123 to SPEC file: spec_tunes.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1123 TuneAxis.multi_pass_tune()\n", "#D Wed Dec 26 22:53:10 2018\n", "#C Wed Dec 26 22:53:10 2018. plan_type = generator\n", "#C Wed Dec 26 22:53:10 2018. uid = 9c2d8735-3653-4b42-8428-aed4f2338cbc\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-11 14:03:08.460986\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.4910027475019858, 'peak_sigma': 0.035867168639114114, 'peak_eta': 0.274478257770014, 'peak_bkg': 0.009072591644989138}\n", "#MD pass = 1\n", "#MD pass_max = 6\n", "#MD pid = 22941\n", "#MD proposal_id = None\n", "#MD tune_md = {'width': 2, 'initial_position': -1.5, 'time_iso8601': '2018-12-26 22:53:10.176716'}\n", "#MD tune_parameters = {'num': 10, 'width': 2, '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.2862999439239502 -2.5 -2.5 941.8988337567732 1\n", "1.7633566856384277 -2.2800000000000002 -2.2777777777777777 963.8641386665465 2\n", "2.2642645835876465 -2.06 -2.0555555555555554 1015.891607662856 2\n", "2.767444610595703 -1.83 -1.8333333333333335 1211.120270435262 3\n", "3.268343687057495 -1.61 -1.6111111111111112 3488.620893077524 3\n", "3.7683510780334473 -1.3900000000000001 -1.3888888888888888 5357.115036441337 4\n", "4.268711566925049 -1.17 -1.1666666666666667 1245.710464865523 4\n", "4.769507646560669 -0.9400000000000001 -0.9444444444444446 1023.0724205079424 5\n", "5.271408557891846 -0.72 -0.7222222222222223 966.531417360313 5\n", "5.78016471862793 -0.5 -0.5 943.1665597678073 6\n", "#C Wed Dec 26 22:53:17 2018. num_events_primary = 10\n", "#C Wed Dec 26 22:53:17 2018. num_events_PeakStats = 1\n", "#C Wed Dec 26 22:53:17 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1124 to SPEC file: spec_tunes.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1124 TuneAxis.multi_pass_tune()\n", "#D Wed Dec 26 22:53:17 2018\n", "#C Wed Dec 26 22:53:17 2018. plan_type = generator\n", "#C Wed Dec 26 22:53:17 2018. uid = 099a1882-d42e-47cf-95dc-df95f3e5132b\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-11 14:03:08.460986\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.4910027475019858, 'peak_sigma': 0.035867168639114114, 'peak_eta': 0.274478257770014, 'peak_bkg': 0.009072591644989138}\n", "#MD pass = 2\n", "#MD pass_max = 6\n", "#MD pid = 22941\n", "#MD proposal_id = None\n", "#MD tune_md = {'width': -0.5, 'initial_position': -1.46, 'time_iso8601': '2018-12-26 22:53:17.282203'}\n", "#MD tune_parameters = {'num': 10, 'width': -0.5, 'initial_position': -1.46, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "0.5094389915466309 -1.21 -1.21 1347.2691374851777 1\n", "0.784205436706543 -1.27 -1.2655555555555555 1611.6541023528666 1\n", "1.087033987045288 -1.32 -1.3211111111111111 2064.7400251398017 1\n", "1.3887536525726318 -1.3800000000000001 -1.3766666666666667 4105.7712642329725 1\n", "1.6884891986846924 -1.43 -1.4322222222222223 25039.0940055141 2\n", "1.9897956848144531 -1.49 -1.4877777777777776 100857.47434002212 2\n", "2.2908341884613037 -1.54 -1.5433333333333332 39021.4431342196 2\n", "2.5914065837860107 -1.6 -1.5988888888888888 4305.651308489628 3\n", "2.89119553565979 -1.6500000000000001 -1.6544444444444444 2240.307989519799 3\n", "3.1918070316314697 -1.71 -1.71 1624.2759485036993 3\n", "#C Wed Dec 26 22:53:20 2018. num_events_primary = 10\n", "#C Wed Dec 26 22:53:20 2018. num_events_PeakStats = 1\n", "#C Wed Dec 26 22:53:20 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1125 to SPEC file: spec_tunes.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1125 TuneAxis.multi_pass_tune()\n", "#D Wed Dec 26 22:53:21 2018\n", "#C Wed Dec 26 22:53:21 2018. plan_type = generator\n", "#C Wed Dec 26 22:53:21 2018. uid = 98c92dd2-c257-470d-8dbe-764a0db50910\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-11 14:03:08.460986\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.4910027475019858, 'peak_sigma': 0.035867168639114114, 'peak_eta': 0.274478257770014, 'peak_bkg': 0.009072591644989138}\n", "#MD pass = 3\n", "#MD pass_max = 6\n", "#MD pid = 22941\n", "#MD proposal_id = None\n", "#MD tune_md = {'width': 0.125, 'initial_position': -1.49, 'time_iso8601': '2018-12-26 22:53:21.082392'}\n", "#MD tune_parameters = {'num': 10, 'width': 0.125, 'initial_position': -1.49, 'peak_choice': 'cen', 'x_axis': 'm1', 'y_axis': 'spvoigt'}\n", "#N 10\n", "#L Epoch_float m1 m1_user_setpoint spvoigt Epoch\n", "0.3177790641784668 -1.55 -1.5525 27069.823573249698 0\n", "0.49188756942749023 -1.54 -1.5386111111111112 39021.4431342196 0\n", "0.6922128200531006 -1.52 -1.5247222222222223 69832.34025253664 1\n", "0.8932130336761475 -1.51 -1.5108333333333333 85398.86333623016 1\n", "1.0937273502349854 -1.5 -1.4969444444444444 97035.1941670026 1\n", "1.2941005229949951 -1.48 -1.4830555555555556 95211.81000609332 1\n", "1.49507737159729 -1.47 -1.4691666666666667 82467.84575146709 1\n", "1.6965291500091553 -1.46 -1.455277777777778 66552.84967274971 2\n", "1.8987789154052734 -1.44 -1.4413888888888888 36387.5048551775 2\n", "2.0988733768463135 -1.43 -1.4275 25039.0940055141 2\n", "#C Wed Dec 26 22:53:23 2018. num_events_primary = 10\n", "#C Wed Dec 26 22:53:23 2018. num_events_PeakStats = 1\n", "#C Wed Dec 26 22:53:23 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1126 to SPEC file: spec_tunes.dat\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1126 TuneAxis.tune()\n", "#D Wed Dec 26 22:53:23 2018\n", "#C Wed Dec 26 22:53:23 2018. plan_type = generator\n", "#C Wed Dec 26 22:53:23 2018. uid = 61cfbe3b-a9d6-4fcd-ab7e-7a958e264f7c\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-11 14:03:08.460986\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD md = {'activity': 'TuneAxis development and testing', 'peak_model': 'pseudo Voigt', 'peak_scale': 100000.0, 'peak_center': -1.4910027475019858, 'peak_sigma': 0.035867168639114114, 'peak_eta': 0.274478257770014, 'peak_bkg': 0.009072591644989138}\n", "#MD pid = 22941\n", "#MD proposal_id = None\n", "#MD tune_md = {'width': 2, 'initial_position': -1.5, 'time_iso8601': '2018-12-26 22:53:23.707511'}\n", "#MD tune_parameters = {'num': 30, 'width': 2, '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.3015248775482178 -2.5 -2.5 941.8988337567732 1\n", "1.5810911655426025 -2.43 -2.4310344827586206 947.2481425955149 2\n", "1.8819727897644043 -2.36 -2.3620689655172415 953.938655742215 2\n", "2.183619260787964 -2.29 -2.293103448275862 962.4589367299508 2\n", "2.482908248901367 -2.22 -2.2241379310344827 973.5418849803063 2\n", "2.7829902172088623 -2.16 -2.155172413793103 985.928762146861 3\n", "3.0842223167419434 -2.09 -2.086206896551724 1005.3205709468167 3\n", "3.3849682807922363 -2.02 -2.0172413793103448 1032.8631353302976 3\n", "3.685049533843994 -1.95 -1.9482758620689655 1073.845019664001 4\n", "3.9857964515686035 -1.8800000000000001 -1.8793103448275863 1138.6427117046546 4\n", "4.287221431732178 -1.81 -1.8103448275862069 1249.926147102835 4\n", "4.592670202255249 -1.74 -1.7413793103448276 1465.2073967315803 5\n", "4.889814376831055 -1.67 -1.6724137931034484 1967.071529433235 5\n", "5.193090438842773 -1.6 -1.603448275862069 4305.651308489628 5\n", "5.495426654815674 -1.53 -1.5344827586206897 53659.95108923816 5\n", "5.796449661254883 -1.47 -1.4655172413793103 82467.84575146709 6\n", "6.095568895339966 -1.4000000000000001 -1.396551724137931 7500.245212284662 6\n", "6.395973443984985 -1.33 -1.3275862068965518 2208.092342372961 6\n", "6.703924179077148 -1.26 -1.2586206896551724 1553.3925279814487 7\n", "6.996590852737427 -1.19 -1.1896551724137931 1291.5306003925123 7\n", "7.296735048294067 -1.12 -1.1206896551724137 1161.4194494982387 7\n", "7.5970540046691895 -1.05 -1.0517241379310345 1087.6258272265723 8\n", "7.898257493972778 -0.98 -0.9827586206896552 1041.820820583454 8\n", "8.197754383087158 -0.91 -0.9137931034482758 1011.4654269614203 8\n", "8.498052597045898 -0.84 -0.8448275862068966 990.3245712352481 8\n", "8.799044609069824 -0.78 -0.7758620689655173 976.9307664569862 9\n", "9.100969314575195 -0.71 -0.7068965517241379 965.0264586778117 9\n", "9.400976181030273 -0.64 -0.6379310344827587 955.9300706758908 9\n", "9.70397162437439 -0.5700000000000001 -0.5689655172413794 948.823623519297 10\n", "10.00889801979065 -0.5 -0.5 943.1665597678073 10\n", "#C Wed Dec 26 22:53:35 2018. num_events_primary = 30\n", "#C Wed Dec 26 22:53:35 2018. num_events_PeakStats = 1\n", "#C Wed Dec 26 22:53:35 2018. exit_status = success\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.examples:Look at SPEC data file: spec_tunes.dat\n" ] } ], "source": [ "hh = [db[uid] for uid in \"9c2d8735 099a1882 98c92dd2 61cfbe3b\".split()]\n", "specfile_example(hh, filename=\"spec_tunes.dat\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## \"scan\" plans in 2018-12 until the start of December 15\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:APS_BlueSky_tools.filewriters:wrote header to SPEC file: test_specdata.txt\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1094 to SPEC file: test_specdata.txt\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1094 scan(detectors=['scaler'], num=5, args=['m1', -1, 1, 'm2', 0, 1], per_step=None)\n", "#D Wed Dec 05 13:39:39 2018\n", "#C Wed Dec 05 13:39:39 2018. plan_type = generator\n", "#C Wed Dec 05 13:39:39 2018. uid = e6a293cf-e517-4a11-8c76-81b6286e32db\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-05 13:37:25.804493\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD motors = ['m1', 'm2']\n", "#MD num_intervals = 4\n", "#MD num_points = 5\n", "#MD pid = 4309\n", "#MD plan_pattern = inner_product\n", "#MD plan_pattern_args = {'num': 5, 'args': [\"EpicsMotor(prefix='prj: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'])\", -1, 1, \"EpicsMotor(prefix='prj:m2', name='m2', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])\", 0, 1]}\n", "#MD plan_pattern_module = bluesky.plan_patterns\n", "#MD proposal_id = None\n", "#N 5\n", "#L m1 m1_user_setpoint m2 m2_user_setpoint Epoch_float Epoch scaler_time\n", "-1.0 -1.0 0.0 0.0 3.7072696685791016 4 1.1\n", "-0.5 -0.5 0.25 0.25 5.7236008644104 6 1.1\n", "0.0 0.0 0.5 0.5 7.7211034297943115 8 1.1\n", "0.5 0.5 0.75 0.75 9.731889724731445 10 1.1\n", "1.0 1.0 1.0 1.0 11.736937999725342 12 1.1\n", "#C Wed Dec 05 13:39:51 2018. num_events_primary = 5\n", "#C Wed Dec 05 13:39:51 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1093 to SPEC file: test_specdata.txt\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1093 scan(detectors=['scaler'], num=5, args=['m1', -1, 1, 'm2', 0, 1], per_step=None)\n", "#D Wed Dec 05 13:39:25 2018\n", "#C Wed Dec 05 13:39:25 2018. plan_type = generator\n", "#C Wed Dec 05 13:39:25 2018. uid = e23bbb44-2bf6-4887-972f-356173860337\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-05 13:37:25.804493\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD motors = ['m1', 'm2']\n", "#MD num_intervals = 4\n", "#MD num_points = 5\n", "#MD pid = 4309\n", "#MD plan_pattern = inner_product\n", "#MD plan_pattern_args = {'num': 5, 'args': [\"EpicsMotor(prefix='prj: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'])\", -1, 1, \"EpicsMotor(prefix='prj:m2', name='m2', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])\", 0, 1]}\n", "#MD plan_pattern_module = bluesky.plan_patterns\n", "#MD proposal_id = None\n", "#N 5\n", "#L m1 m1_user_setpoint m2 m2_user_setpoint Epoch_float Epoch scaler_time\n", "-1.0 -1.0 0.0 0.0 2.584486722946167 3 1.1\n", "-0.5 -0.5 0.25 0.25 4.475306749343872 4 1.1\n", "0.0 0.0 0.5 0.5 6.383528709411621 6 1.1\n", "0.5 0.5 0.75 0.75 8.29332685470581 8 1.1\n", "1.0 1.0 1.0 1.0 10.198333978652954 10 1.1\n", "#C Wed Dec 05 13:39:35 2018. num_events_primary = 5\n", "#C Wed Dec 05 13:39:35 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1088 to SPEC file: test_specdata.txt\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1088 scan(detectors=['scaler'], num=5, args=['m1', -1, 1, 'm2', 0, 1], per_step=None)\n", "#D Wed Dec 05 13:29:14 2018\n", "#C Wed Dec 05 13:29:14 2018. plan_type = generator\n", "#C Wed Dec 05 13:29:14 2018. uid = 26cec641-2f13-4711-a09d-be8d8e2d8ead\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-05 13:26:09.632475\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD motors = ['m1', 'm2']\n", "#MD num_intervals = 4\n", "#MD num_points = 5\n", "#MD pid = 1931\n", "#MD plan_pattern = inner_product\n", "#MD plan_pattern_args = {'num': 5, 'args': [\"EpicsMotor(prefix='prj: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'])\", -1, 1, \"EpicsMotor(prefix='prj:m2', name='m2', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])\", 0, 1]}\n", "#MD plan_pattern_module = bluesky.plan_patterns\n", "#MD proposal_id = None\n", "#N 5\n", "#L m1_user_setpoint m2 m2_user_setpoint scaler_time Epoch_float Epoch m1\n", "-1.0 0.0 0.0 1.1 3.6816906929016113 4 -1.0\n", "-0.5 0.25 0.25 1.1 5.704963445663452 6 -0.5\n", "0.0 0.5 0.5 1.0 7.622475624084473 8 0.0\n", "0.5 0.75 0.75 1.1 9.526179313659668 10 0.5\n", "1.0 1.0 1.0 1.1 11.434032201766968 11 1.0\n", "#C Wed Dec 05 13:29:25 2018. num_events_primary = 5\n", "#C Wed Dec 05 13:29:25 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1087 to SPEC file: test_specdata.txt\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1087 scan(detectors=['scaler'], num=5, args=['m1', -1, 1, 'm2', 0, 1], per_step=None)\n", "#D Wed Dec 05 13:28:55 2018\n", "#C Wed Dec 05 13:28:55 2018. plan_type = generator\n", "#C Wed Dec 05 13:28:55 2018. uid = e40da52b-8e00-4ace-96f8-497bc38f94b4\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-05 13:26:09.632475\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD motors = ['m1', 'm2']\n", "#MD num_intervals = 4\n", "#MD num_points = 5\n", "#MD pid = 1931\n", "#MD plan_pattern = inner_product\n", "#MD plan_pattern_args = {'num': 5, 'args': [\"EpicsMotor(prefix='prj: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'])\", -1, 1, \"EpicsMotor(prefix='prj:m2', name='m2', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])\", 0, 1]}\n", "#MD plan_pattern_module = bluesky.plan_patterns\n", "#MD proposal_id = None\n", "#N 5\n", "#L m1_user_setpoint m2 m2_user_setpoint scaler_time Epoch_float Epoch m1\n", "-1.0 0.0 0.0 1.1 3.6778171062469482 4 -1.0\n", "-0.5 0.25 0.25 1.1 5.577483177185059 6 -0.5\n", "0.0 0.5 0.5 1.1 7.481954097747803 7 0.0\n", "0.5 0.75 0.75 1.1 9.39044713973999 9 0.5\n", "1.0 1.0 1.0 1.1 11.29593825340271 11 1.0\n", "#C Wed Dec 05 13:29:06 2018. num_events_primary = 5\n", "#C Wed Dec 05 13:29:06 2018. exit_status = success\n", "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.filewriters:wrote scan 1086 to SPEC file: test_specdata.txt\n", "INFO:APS_BlueSky_tools.examples:\n", "#S 1086 scan(detectors=['scaler'], num=5, args=['m1', -1, 1, 'm2', 0, 1], per_step=None)\n", "#D Wed Dec 05 13:28:26 2018\n", "#C Wed Dec 05 13:28:26 2018. plan_type = generator\n", "#C Wed Dec 05 13:28:26 2018. uid = 087c957d-f7ec-45b8-97f3-cf80ea46c14d\n", "#MD APS_BlueSky_tools_VERSION = 0.0.35\n", "#MD BLUESKY_VERSION = 1.4.1\n", "#MD OPHYD_VERSION = 1.3.0\n", "#MD SESSION_START = 2018-12-05 13:26:09.632475\n", "#MD beamline_id = developer\n", "#MD ipython_session_start = 2018-02-14 12:54:06.447450\n", "#MD login_id = mintadmin@mint-vm\n", "#MD motors = ['m1', 'm2']\n", "#MD num_intervals = 4\n", "#MD num_points = 5\n", "#MD pid = 1931\n", "#MD plan_pattern = inner_product\n", "#MD plan_pattern_args = {'num': 5, 'args': [\"EpicsMotor(prefix='prj: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'])\", -1, 1, \"EpicsMotor(prefix='prj:m2', name='m2', settle_time=0.0, timeout=None, read_attrs=['user_readback', 'user_setpoint'], configuration_attrs=['user_offset', 'user_offset_dir', 'velocity', 'acceleration', 'motor_egu'])\", 0, 1]}\n", "#MD plan_pattern_module = bluesky.plan_patterns\n", "#MD proposal_id = None\n", "#N 5\n", "#L m1_user_setpoint m2 m2_user_setpoint scaler_time Epoch_float Epoch m1\n", "-1.0 0.0 0.0 1.1 2.8163833618164062 3 -1.0\n", "-0.5 0.25 0.25 1.1 4.767565011978149 5 -0.5\n", "0.0 0.5 0.5 1.1 6.664952754974365 7 0.0\n", "0.5 0.75 0.75 1.1 8.574125528335571 9 0.5\n", "1.0 1.0 1.0 1.1 10.473979234695435 10 1.0\n", "#C Wed Dec 05 13:28:36 2018. num_events_primary = 5\n", "#C Wed Dec 05 13:28:36 2018. exit_status = success\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "INFO:APS_BlueSky_tools.examples:############################################################\n", "INFO:APS_BlueSky_tools.examples:Look at SPEC data file: test_specdata.txt\n" ] } ], "source": [ "specfile_example(db(plan_name=\"scan\", since=\"2018-12\", until=\"2018-12-15\"))" ] }, { "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 }