{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# QCoDeS Example with Agilent 34400A" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "application/javascript": [ "/*\r\n", " * Qcodes Jupyter/IPython widgets\r\n", " */\r\n", "require([\r\n", " 'nbextensions/widgets/widgets/js/widget',\r\n", " 'nbextensions/widgets/widgets/js/manager'\r\n", "], function (widget, manager) {\r\n", "\r\n", " var UpdateView = widget.DOMWidgetView.extend({\r\n", " render: function() {\r\n", " window.MYWIDGET = this;\r\n", " this._interval = 0;\r\n", " this.update();\r\n", " },\r\n", " update: function() {\r\n", " this.display(this.model.get('_message'));\r\n", " this.setInterval();\r\n", " },\r\n", " display: function(message) {\r\n", " /*\r\n", " * display method: override this for custom display logic\r\n", " */\r\n", " this.el.innerHTML = message;\r\n", " },\r\n", " remove: function() {\r\n", " clearInterval(this._updater);\r\n", " },\r\n", " setInterval: function(newInterval) {\r\n", " var me = this;\r\n", " if(newInterval===undefined) newInterval = me.model.get('interval');\r\n", " if(newInterval===me._interval) return;\r\n", "\r\n", " me._interval = newInterval;\r\n", "\r\n", " if(me._updater) clearInterval(me._updater);\r\n", "\r\n", " if(me._interval) {\r\n", " me._updater = setInterval(function() {\r\n", " me.send({myupdate: true});\r\n", " if(!me.model.comm_live) {\r\n", " console.log('missing comm, canceling widget updates', me);\r\n", " clearInterval(me._updater);\r\n", " }\r\n", " }, me._interval * 1000);\r\n", " }\r\n", " }\r\n", " });\r\n", " manager.WidgetManager.register_widget_view('UpdateView', UpdateView);\r\n", "\r\n", " var HiddenUpdateView = UpdateView.extend({\r\n", " display: function(message) {\r\n", " this.$el.hide();\r\n", " }\r\n", " });\r\n", " manager.WidgetManager.register_widget_view('HiddenUpdateView', HiddenUpdateView);\r\n", "\r\n", " var SubprocessView = UpdateView.extend({\r\n", " render: function() {\r\n", " var me = window.SPVIEW = this;\r\n", " me._interval = 0;\r\n", " me._minimize = '';\r\n", " me._restore = '';\r\n", "\r\n", " // in case there is already an outputView present,\r\n", " // like from before restarting the kernel\r\n", " $('.qcodes-output-view').not(me.$el).remove();\r\n", "\r\n", " me.$el\r\n", " .addClass('qcodes-output-view')\r\n", " .attr('qcodes-state', 'docked')\r\n", " .html(\r\n", " '
' +\r\n", " '' +\r\n", " '' +\r\n", " '' +\r\n", " '' +\r\n", " '' +\r\n", " '' +\r\n", " '
' +\r\n", " '
'\r\n",
       "                );\r\n",
       "\r\n",
       "            me.clearButton = me.$el.find('.qcodes-clear-output');\r\n",
       "            me.minButton = me.$el.find('.qcodes-minimize');\r\n",
       "            me.outputArea = me.$el.find('pre');\r\n",
       "            me.subprocessList = me.$el.find('span');\r\n",
       "            me.abortButton = me.$el.find('.qcodes-abort-loop');\r\n",
       "\r\n",
       "            me.clearButton.click(function() {\r\n",
       "                me.outputArea.html('');\r\n",
       "                me.clearButton.addClass('disabled');\r\n",
       "            });\r\n",
       "\r\n",
       "            me.abortButton.click(function() {\r\n",
       "                me.send({abort: true});\r\n",
       "            });\r\n",
       "\r\n",
       "            me.$el.find('.js-state').click(function() {\r\n",
       "                var oldState = me.$el.attr('qcodes-state'),\r\n",
       "                    state = this.className.substr(this.className.indexOf('qcodes'))\r\n",
       "                        .split('-')[1].split(' ')[0];\r\n",
       "\r\n",
       "                // not sure why I can't pop it out of the widgetarea in render, but it seems that\r\n",
       "                // some other bit of code resets the parent after render if I do it there.\r\n",
       "                // To be safe, just do it on every state click.\r\n",
       "                me.$el.appendTo('body');\r\n",
       "\r\n",
       "                if(oldState === 'floated') {\r\n",
       "                    me.$el.draggable('destroy').css({left:'', top: ''});\r\n",
       "                }\r\n",
       "\r\n",
       "                me.$el.attr('qcodes-state', state);\r\n",
       "\r\n",
       "                if(state === 'floated') {\r\n",
       "                    me.$el.draggable().css({\r\n",
       "                        left: window.innerWidth - me.$el.width() - 15,\r\n",
       "                        top: window.innerHeight - me.$el.height() - 10\r\n",
       "                    });\r\n",
       "                }\r\n",
       "            });\r\n",
       "\r\n",
       "            $(window).resize(function() {\r\n",
       "                if(me.$el.attr('qcodes-state') === 'floated') {\r\n",
       "                    var position = me.$el.position(),\r\n",
       "                        minVis = 20,\r\n",
       "                        maxLeft = window.innerWidth - minVis,\r\n",
       "                        maxTop = window.innerHeight - minVis;\r\n",
       "\r\n",
       "                    if(position.left > maxLeft) me.$el.css('left', maxLeft);\r\n",
       "                    if(position.top > maxTop) me.$el.css('top', maxTop);\r\n",
       "                }\r\n",
       "            });\r\n",
       "\r\n",
       "            me.update();\r\n",
       "        },\r\n",
       "\r\n",
       "        display: function(message) {\r\n",
       "            if(message) {\r\n",
       "                var initialScroll = this.outputArea.scrollTop();\r\n",
       "                this.outputArea.scrollTop(this.outputArea.prop('scrollHeight'));\r\n",
       "                var scrollBottom = this.outputArea.scrollTop();\r\n",
       "\r\n",
       "                if(this.$el.attr('qcodes-state') === 'minimized') {\r\n",
       "                    this.$el.find('.qcodes-docked').click();\r\n",
       "                    // always scroll to the bottom if we're restoring\r\n",
       "                    // because of a new message\r\n",
       "                    initialScroll = scrollBottom;\r\n",
       "                }\r\n",
       "\r\n",
       "                this.outputArea.append(message);\r\n",
       "                this.clearButton.removeClass('disabled');\r\n",
       "\r\n",
       "                // if we were scrolled to the bottom initially, make sure\r\n",
       "                // we stay that way.\r\n",
       "                this.outputArea.scrollTop(initialScroll === scrollBottom ?\r\n",
       "                    this.outputArea.prop('scrollHeight') : initialScroll);\r\n",
       "            }\r\n",
       "\r\n",
       "            var processes = this.model.get('_processes') || 'No subprocesses';\r\n",
       "            this.abortButton.toggleClass('disabled', processes.indexOf('Measurement')===-1);\r\n",
       "            this.subprocessList.text(processes);\r\n",
       "        }\r\n",
       "    });\r\n",
       "    manager.WidgetManager.register_widget_view('SubprocessView', SubprocessView);\r\n",
       "});\r\n"
      ],
      "text/plain": [
       ""
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       ""
      ],
      "text/plain": [
       ""
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib nbagg\n",
    "import matplotlib.pyplot as plt\n",
    "import time\n",
    "import numpy as np\n",
    "\n",
    "import qcodes as qc\n",
    "from qcodes.utils.validators import Enum, Strings\n",
    "import qcodes.instrument_drivers.tektronix.Keithley_2600_channels as keith\n",
    "import qcodes.instrument_drivers.agilent.Agilent_34400A as agi\n",
    "\n",
    "from qcodes.loops import Loop"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import time\n",
    "class Timer(object):\n",
    "    def __init__(self, name=None):\n",
    "        self.name = name\n",
    "\n",
    "    def __enter__(self):\n",
    "        self.tstart = time.time()\n",
    "\n",
    "    def __exit__(self, type, value, traceback):\n",
    "        if self.name:\n",
    "            print('[%s]' % self.name,)\n",
    "        print('Elapsed: %s' % (time.time() - self.tstart))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# create Instruments\n",
    "k1 = keith.Keithley_2600('Keithley1', 'GPIB0::15::INSTR')\n",
    "\n",
    "a1 = agi.Agilent_34400A('Agilent1', 'GPIB0::11::INSTR')\n",
    "a2 = agi.Agilent_34400A('Agilent2', 'GPIB0::6::INSTR')\n",
    "\n",
    "# set integration time (number of line cycles)\n",
    "a1.NPLC.set(10)\n",
    "a2.NPLC.set(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "station1 = qc.Station(a1,a2)\n",
    "station1.set_measurement(a1.volt)\n",
    "station2 = qc.Station(a1,a2)\n",
    "station2.set_measurement(a1.volt, a2.volt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Time s1]\n",
      "Elapsed: 2.0011143684387207\n"
     ]
    },
    {
     "ename": "Empty",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mEmpty\u001b[0m                                     Traceback (most recent call last)",
      "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m# Time single readings\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[1;32mwith\u001b[0m \u001b[0mTimer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Time s1'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m     \u001b[0mstation1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmeasure\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      4\u001b[0m \u001b[1;32mwith\u001b[0m \u001b[0mTimer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Time s2'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m     \u001b[0mstation2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmeasure\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mE:\\Git\\Qcodes\\qcodes\\station.py\u001b[0m in \u001b[0;36mmeasure\u001b[1;34m(self, *actions)\u001b[0m\n\u001b[0;32m    105\u001b[0m         \u001b[1;32mfor\u001b[0m \u001b[0maction\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mactions\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    106\u001b[0m             \u001b[1;32mif\u001b[0m \u001b[0mhasattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maction\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'get'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 107\u001b[1;33m                 \u001b[0mout\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maction\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    108\u001b[0m             \u001b[1;32melif\u001b[0m \u001b[0mcallable\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maction\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    109\u001b[0m                 \u001b[0maction\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mE:\\Git\\Qcodes\\qcodes\\instrument\\remote.py\u001b[0m in \u001b[0;36mget\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    121\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    122\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 123\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_instrument\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mconnection\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mask\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'get'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    124\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    125\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mE:\\Git\\Qcodes\\qcodes\\instrument\\server.py\u001b[0m in \u001b[0;36mask\u001b[1;34m(self, func_name, *args, **kwargs)\u001b[0m\n\u001b[0;32m    134\u001b[0m         \u001b[0mQuery\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mserver\u001b[0m \u001b[0mcopy\u001b[0m \u001b[0mof\u001b[0m \u001b[0mthis\u001b[0m \u001b[0minstrument\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mexpecting\u001b[0m \u001b[0ma\u001b[0m \u001b[0mresponse\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    135\u001b[0m         '''\n\u001b[1;32m--> 136\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmanager\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mask\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'ask'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mid\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfunc_name\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    137\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    138\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mwrite\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfunc_name\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mE:\\Git\\Qcodes\\qcodes\\utils\\multiprocessing.py\u001b[0m in \u001b[0;36mask\u001b[1;34m(self, timeout, *query)\u001b[0m\n\u001b[0;32m    332\u001b[0m                 \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_error_queue\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    333\u001b[0m                     \u001b[1;31m# only raise if we're not about to find a deeper error\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 334\u001b[1;33m                     \u001b[1;32mraise\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    335\u001b[0m             \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_check_for_errors\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_expect_error\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    336\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mE:\\Git\\Qcodes\\qcodes\\utils\\multiprocessing.py\u001b[0m in \u001b[0;36mask\u001b[1;34m(self, timeout, *query)\u001b[0m\n\u001b[0;32m    324\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    325\u001b[0m             \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 326\u001b[1;33m                 \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_check_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    327\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    328\u001b[0m                 \u001b[1;32mwhile\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_response_queue\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mE:\\Git\\Qcodes\\qcodes\\utils\\multiprocessing.py\u001b[0m in \u001b[0;36m_check_response\u001b[1;34m(self, timeout)\u001b[0m\n\u001b[0;32m    301\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    302\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_check_response\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 303\u001b[1;33m         \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_response_queue\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    304\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[1;33m==\u001b[0m \u001b[0mSERVER_ERR\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    305\u001b[0m             \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_expect_error\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mc:\\users\\qdev\\anaconda3\\lib\\multiprocessing\\queues.py\u001b[0m in \u001b[0;36mget\u001b[1;34m(self, block, timeout)\u001b[0m\n\u001b[0;32m    103\u001b[0m                     \u001b[0mtimeout\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdeadline\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    104\u001b[0m                     \u001b[1;32mif\u001b[0m \u001b[0mtimeout\u001b[0m \u001b[1;33m<\u001b[0m \u001b[1;36m0\u001b[0m \u001b[1;32mor\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_poll\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 105\u001b[1;33m                         \u001b[1;32mraise\u001b[0m \u001b[0mEmpty\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    106\u001b[0m                 \u001b[1;32melif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_poll\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    107\u001b[0m                     \u001b[1;32mraise\u001b[0m \u001b[0mEmpty\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mEmpty\u001b[0m: "
     ]
    }
   ],
   "source": [
    "# Time single readings\n",
    "with Timer('Time s1'):\n",
    "    station1.measure()\n",
    "with Timer('Time s2'):\n",
    "    station2.measure()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Time single readings\n",
    "with Timer('Time a1'):\n",
    "    a1.volt.get()\n",
    "with Timer('Time a2'):\n",
    "    a2.volt.get()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "with Timer('Time Loop 1'):\n",
    "    data = Loop(k1.a.volt[-5:5:1], 0).each(a1.volt).run(location='testsweep', overwrite=True,background=False)\n",
    "\n",
    "with Timer('Time Loop 2'):\n",
    "    data = Loop(k1.a.volt[-5:5:1], 0).each(a1.volt, a2.volt).run(location='testsweep', overwrite=True,background=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "with Timer('Time Loop 1'):\n",
    "    data = Loop(k1.a.volt[-5:5:1], 0).each(a1.volt).run(location='testsweep', overwrite=True)\n",
    "    while data.sync():\n",
    "        time.sleep(0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with Timer('Time Loop 2'):\n",
    "    data = Loop(k1.a.volt[-5:5:1], 0).each(a1.volt, a2.volt).run(location='testsweep', overwrite=True)\n",
    "    while data.sync():\n",
    "        time.sleep(0.1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "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.7.9"
  },
  "nbsphinx": {
   "execute": "never"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}