diff --git a/docs/examples/Qcodes example ATS_ONWORK.ipynb b/docs/examples/Qcodes example ATS_ONWORK.ipynb new file mode 100644 index 00000000000..922d37e5816 --- /dev/null +++ b/docs/examples/Qcodes example ATS_ONWORK.ipynb @@ -0,0 +1,1659 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "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 = this;\r\n", + " me._interval = 0;\r\n", + " me._minimize = '';\r\n", + " me._restore = '';\r\n", + "\r\n", + " // max lines of output to show\r\n", + " me.maxOutputLength = 500;\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",
+       "\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('.qcodes-process-list');\r\n",
+       "            me.abortButton = me.$el.find('.qcodes-abort-loop');\r\n",
+       "            me.processLinesButton = me.$el.find('.qcodes-processlines')\r\n",
+       "\r\n",
+       "            me.outputLines = [];\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.processLinesButton.click(function() {\r\n",
+       "                // toggle multiline process list display\r\n",
+       "                me.subprocessesMultiline = !me.subprocessesMultiline;\r\n",
+       "                me.showSubprocesses();\r\n",
+       "            });\r\n",
+       "\r\n",
+       "            me.$el.find('.js-state').click(function() {\r\n",
+       "                var state = this.className.substr(this.className.indexOf('qcodes'))\r\n",
+       "                        .split('-')[1].split(' ')[0];\r\n",
+       "                me.model.set('_state', state);\r\n",
+       "            });\r\n",
+       "\r\n",
+       "            $(window)\r\n",
+       "                .off('resize.qcodes')\r\n",
+       "                .on('resize.qcodes', function() {me.clipBounds();});\r\n",
+       "\r\n",
+       "            me.update();\r\n",
+       "        },\r\n",
+       "\r\n",
+       "        updateState: function() {\r\n",
+       "            var me = this,\r\n",
+       "                oldState = me.$el.attr('qcodes-state'),\r\n",
+       "                state = me.model.get('_state');\r\n",
+       "\r\n",
+       "            if(state === oldState) return;\r\n",
+       "\r\n",
+       "            setTimeout(function() {\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",
+       "                    console.log('here');\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\r\n",
+       "                        .draggable({stop: function() { me.clipBounds(); }})\r\n",
+       "                        .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",
+       "                // any previous highlighting is now moot\r\n",
+       "                me.$el.removeClass('qcodes-highlight');\r\n",
+       "            }, 0);\r\n",
+       "\r\n",
+       "        },\r\n",
+       "\r\n",
+       "        clipBounds: function() {\r\n",
+       "            var me = this;\r\n",
+       "            if(me.$el.attr('qcodes-state') === 'floated') {\r\n",
+       "                var bounds = me.$el[0].getBoundingClientRect(),\r\n",
+       "                    minVis = 40,\r\n",
+       "                    maxLeft = window.innerWidth - minVis,\r\n",
+       "                    minLeft = minVis - bounds.width,\r\n",
+       "                    maxTop = window.innerHeight - minVis;\r\n",
+       "\r\n",
+       "                if(bounds.left > maxLeft) me.$el.css('left', maxLeft);\r\n",
+       "                else if(bounds.left < minLeft) me.$el.css('left', minLeft);\r\n",
+       "\r\n",
+       "                if(bounds.top > maxTop) me.$el.css('top', maxTop);\r\n",
+       "                else if(bounds.top < 0) me.$el.css('top', 0);\r\n",
+       "            }\r\n",
+       "        },\r\n",
+       "\r\n",
+       "        display: function(message) {\r\n",
+       "            var me = this;\r\n",
+       "            if(message) {\r\n",
+       "                var initialScroll = me.outputArea.scrollTop();\r\n",
+       "                me.outputArea.scrollTop(me.outputArea.prop('scrollHeight'));\r\n",
+       "                var scrollBottom = me.outputArea.scrollTop();\r\n",
+       "\r\n",
+       "                if(me.$el.attr('qcodes-state') === 'minimized') {\r\n",
+       "                    // if we add text and the box is minimized, highlight the\r\n",
+       "                    // title bar to alert the user that there are new messages.\r\n",
+       "                    // remove then add the class, so we get the animation again\r\n",
+       "                    // if it's already highlighted\r\n",
+       "                    me.$el.removeClass('qcodes-highlight');\r\n",
+       "                    setTimeout(function(){\r\n",
+       "                        me.$el.addClass('qcodes-highlight');\r\n",
+       "                    }, 0);\r\n",
+       "                }\r\n",
+       "\r\n",
+       "                var newLines = message.split('\\n'),\r\n",
+       "                    out = me.outputLines,\r\n",
+       "                    outLen = out.length;\r\n",
+       "                if(outLen) out[outLen - 1] += newLines[0];\r\n",
+       "                else out.push(newLines[0]);\r\n",
+       "\r\n",
+       "                for(var i = 1; i < newLines.length; i++) {\r\n",
+       "                    out.push(newLines[i]);\r\n",
+       "                }\r\n",
+       "\r\n",
+       "                if(out.length > me.maxOutputLength) {\r\n",
+       "                    out.splice(0, out.length - me.maxOutputLength + 1,\r\n",
+       "                        '<<< Output clipped >>>');\r\n",
+       "                }\r\n",
+       "\r\n",
+       "                me.outputArea.text(out.join('\\n'));\r\n",
+       "                me.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",
+       "                me.outputArea.scrollTop(initialScroll === scrollBottom ?\r\n",
+       "                    me.outputArea.prop('scrollHeight') : initialScroll);\r\n",
+       "            }\r\n",
+       "\r\n",
+       "            me.showSubprocesses();\r\n",
+       "            me.updateState();\r\n",
+       "        },\r\n",
+       "\r\n",
+       "        showSubprocesses: function() {\r\n",
+       "            var me = this,\r\n",
+       "                replacer = me.subprocessesMultiline ? '
' : ', ',\r\n", + " processes = (me.model.get('_processes') || '')\r\n", + " .replace(/\\n/g, '>' + replacer + '<');\r\n", + "\r\n", + " if(processes) processes = '<' + processes + '>';\r\n", + " else processes = 'No subprocesses';\r\n", + "\r\n", + " me.abortButton.toggleClass('disabled', processes.indexOf('Measurement')===-1);\r\n", + "\r\n", + " me.subprocessList.html(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" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "pyqtgraph plotting not supported, try \"from qcodes.plots.pyqtgraph import QtPlot\" to see the full error\n", + "No loop running\n" + ] + } + ], + "source": [ + "# import all necessary things\n", + "%matplotlib nbagg\n", + "\n", + "import qcodes as qc\n", + "import qcodes.instrument.parameter as parameter\n", + "import qcodes.instrument_drivers.AlazarTech.ATS9870 as ATSdriver\n", + "import qcodes.instrument_drivers.AlazarTech.ATS_acquisition_controllers as ats_contr\n", + "\n", + "qc.halt_bg()\n", + "qc.set_mp_method('spawn') # force Windows behavior on mac\n", + "\n", + "# this makes a widget in the corner of the window to show and control\n", + "# subprocesses and any output they would print to the terminal\n", + "qc.show_subprocess_widget()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'bits_per_sample': 8,\n", + " 'board_id': 1,\n", + " 'board_kind': 'ATS9870',\n", + " 'max_samples': 4294966272,\n", + " 'system_id': 1}]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Command to list all alazar boards connected to the system\n", + "ATSdriver.AlazarTech_ATS.find_boards()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'CPLD_version': '13.8',\n", + " 'SDK_version': '5.9.11',\n", + " 'asopc_type': '2435577968',\n", + " 'driver_version': '5.9.11',\n", + " 'firmware': None,\n", + " 'latest_cal_date': '29-05-13',\n", + " 'memory_size': '4294966272',\n", + " 'model': 'ATS9870',\n", + " 'pcie_link_speed': '0.25GB/s',\n", + " 'pcie_link_width': '4',\n", + " 'serial': '910323',\n", + " 'vendor': 'AlazarTech'}" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create the ATS9870 instrument on the new server \"alazar_server\"\n", + "ats_inst = ATSdriver.AlazarTech_ATS9870(name='Alazar1', server_name=\"alazar_server\")\n", + "# Print all information about this Alazar card\n", + "ats_inst.get_idn()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "# Instantiate an acquisition controller (In this case we are doing a simple DFT) on the same server (\"alazar_server\") and \n", + "# provide the name of the name of the alazar card that this controller should control\n", + "acquisition_controller = ats_contr.DFT_AcquisitionController(name='acquisition_controller', \n", + " demodulation_frequency=10e6, \n", + " alazar_name='Alazar1', \n", + " server_name=\"alazar_server\")" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# Configure all settings in the Alazar card\n", + "ats_inst.config(#clock_source='INTERNAL_CLOCK',\n", + " sample_rate=100000000,\n", + " #clock_edge='CLOCK_EDGE_RISING',\n", + " #decimation=0,\n", + " #coupling=['AC','AC'],\n", + " channel_range=[2.,2.],\n", + " #impedance=[50,50],\n", + " #bwlimit=['DISABLED','DISABLED'],\n", + " #trigger_operation='TRIG_ENGINE_OP_J',\n", + " #trigger_engine1='TRIG_ENGINE_J',\n", + " trigger_source1='EXTERNAL',\n", + " #trigger_slope1='TRIG_SLOPE_POSITIVE',\n", + " #trigger_level1=128,\n", + " #trigger_engine2='TRIG_ENGINE_K',\n", + " #trigger_source2='DISABLE',\n", + " #trigger_slope2='TRIG_SLOPE_POSITIVE',\n", + " #trigger_level2=128,\n", + " #external_trigger_coupling='AC',\n", + " #external_trigger_range='ETR_5V',\n", + " #trigger_delay=0,\n", + " #timeout_ticks=0\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "# This command is specific to this acquisition controller. The kwargs provided here are being forwarded to ats_inst.acquire\n", + "# This way, it becomes easy to change acquisition specific settings from the ipython notebook\n", + "acquisition_controller.set_acquisitionkwargs(#mode='NPT',\n", + " samples_per_record=1024,\n", + " records_per_buffer=70,\n", + " buffers_per_acquisition=1,\n", + " #channel_selection='AB',\n", + " #transfer_offset=0,\n", + " #external_startcapture='ENABLED',\n", + " #enable_record_headers='DISABLED',\n", + " #alloc_buffers='DISABLED',\n", + " #fifo_only_streaming='DISABLED',\n", + " #interleave_samples='DISABLED',\n", + " #get_processed_data='DISABLED',\n", + " allocated_buffers=64,\n", + " #buffer_timeout=1000\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.024900543063357889" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Getting the value of the parameter 'acquisition' of the instrument 'acquisition_controller' performes the entire acquisition \n", + "# protocol. This again depends on the specific implementation of the acquisition controller\n", + "acquisition_controller.acquisition()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS9870.AlazarTech_ATS9870',\n", + " 'functions': {},\n", + " 'name': 'Alazar1',\n", + " 'parameters': {'IDN': {'__class__': 'qcodes.instrument.parameter.StandardParameter',\n", + " 'instrument': 'qcodes.instrument_drivers.AlazarTech.ATS9870.AlazarTech_ATS9870',\n", + " 'instrument_name': 'Alazar1',\n", + " 'label': 'IDN',\n", + " 'name': 'IDN',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': {'CPLD_version': '13.8',\n", + " 'SDK_version': '5.9.11',\n", + " 'asopc_type': '2435577968',\n", + " 'driver_version': '5.9.11',\n", + " 'firmware': None,\n", + " 'latest_cal_date': '29-05-13',\n", + " 'memory_size': '4294966272',\n", + " 'model': 'ATS9870',\n", + " 'pcie_link_speed': '0.25GB/s',\n", + " 'pcie_link_width': '4',\n", + " 'serial': '910323',\n", + " 'vendor': 'AlazarTech'}},\n", + " 'alloc_buffers': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Alloc Buffers',\n", + " 'name': 'alloc_buffers',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'allocated_buffers': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Allocated Buffers',\n", + " 'name': 'allocated_buffers',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 64},\n", + " 'buffer_timeout': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Buffer Timeout',\n", + " 'name': 'buffer_timeout',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'ms',\n", + " 'value': 1000},\n", + " 'buffers_per_acquisition': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Buffers per Acquisition',\n", + " 'name': 'buffers_per_acquisition',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 1},\n", + " 'bwlimit1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Bandwidth limit channel 1',\n", + " 'name': 'bwlimit1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'bwlimit2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Bandwidth limit channel 2',\n", + " 'name': 'bwlimit2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'channel_range1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Range channel 1',\n", + " 'name': 'channel_range1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'V',\n", + " 'value': 2.0},\n", + " 'channel_range2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Range channel 2',\n", + " 'name': 'channel_range2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'V',\n", + " 'value': 2.0},\n", + " 'channel_selection': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Channel Selection',\n", + " 'name': 'channel_selection',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'AB'},\n", + " 'clock_edge': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Clock Edge',\n", + " 'name': 'clock_edge',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'CLOCK_EDGE_RISING'},\n", + " 'clock_source': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Clock Source',\n", + " 'name': 'clock_source',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'INTERNAL_CLOCK'},\n", + " 'coupling1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Coupling channel 1',\n", + " 'name': 'coupling1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'AC'},\n", + " 'coupling2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Coupling channel 2',\n", + " 'name': 'coupling2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'AC'},\n", + " 'decimation': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Decimation',\n", + " 'name': 'decimation',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 0},\n", + " 'enable_record_headers': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Enable Record Headers',\n", + " 'name': 'enable_record_headers',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'external_startcapture': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'External Startcapture',\n", + " 'name': 'external_startcapture',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'ENABLED'},\n", + " 'external_trigger_coupling': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'External Trigger Coupling',\n", + " 'name': 'external_trigger_coupling',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'AC'},\n", + " 'external_trigger_range': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'External Trigger Range',\n", + " 'name': 'external_trigger_range',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'ETR_5V'},\n", + " 'fifo_only_streaming': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Fifo Only Streaming',\n", + " 'name': 'fifo_only_streaming',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'get_processed_data': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Get Processed Data',\n", + " 'name': 'get_processed_data',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'impedance1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Impedance channel 1',\n", + " 'name': 'impedance1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'Ohm',\n", + " 'value': 50},\n", + " 'impedance2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Impedance channel 2',\n", + " 'name': 'impedance2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'Ohm',\n", + " 'value': 50},\n", + " 'interleave_samples': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Interleave Samples',\n", + " 'name': 'interleave_samples',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLED'},\n", + " 'mode': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Acquisiton mode',\n", + " 'name': 'mode',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'NPT'},\n", + " 'records_per_buffer': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Records per Buffer',\n", + " 'name': 'records_per_buffer',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 70},\n", + " 'sample_rate': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Sample Rate',\n", + " 'name': 'sample_rate',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'S/s',\n", + " 'value': 100000000},\n", + " 'samples_per_record': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Samples per Record',\n", + " 'name': 'samples_per_record',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 1024},\n", + " 'timeout_ticks': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Timeout Ticks',\n", + " 'name': 'timeout_ticks',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '10 us',\n", + " 'value': 0},\n", + " 'transfer_offset': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Transer Offset',\n", + " 'name': 'transfer_offset',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'Samples',\n", + " 'value': 0},\n", + " 'trigger_delay': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Delay',\n", + " 'name': 'trigger_delay',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': 'Sample clock cycles',\n", + " 'value': 0},\n", + " 'trigger_engine1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Engine 1',\n", + " 'name': 'trigger_engine1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'TRIG_ENGINE_K'},\n", + " 'trigger_engine2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Engine 2',\n", + " 'name': 'trigger_engine2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'TRIG_ENGINE_K'},\n", + " 'trigger_level1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Level 1',\n", + " 'name': 'trigger_level1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 128},\n", + " 'trigger_level2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Level 2',\n", + " 'name': 'trigger_level2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 128},\n", + " 'trigger_operation': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Operation',\n", + " 'name': 'trigger_operation',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'TRIG_ENGINE_OP_J'},\n", + " 'trigger_slope1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Slope 1',\n", + " 'name': 'trigger_slope1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'TRIG_SLOPE_POSITIVE'},\n", + " 'trigger_slope2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Slope 2',\n", + " 'name': 'trigger_slope2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'TRIG_SLOPE_POSITIVE'},\n", + " 'trigger_source1': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Source 1',\n", + " 'name': 'trigger_source1',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'EXTERNAL'},\n", + " 'trigger_source2': {'__class__': 'qcodes.instrument_drivers.AlazarTech.ATS.AlazarParameter',\n", + " 'label': 'Trigger Source 2',\n", + " 'name': 'trigger_source2',\n", + " 'ts': '2016-08-16 14:21:37',\n", + " 'units': '',\n", + " 'value': 'DISABLE'}}}" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# make a snapshot of the 'ats_inst' instrument\n", + "ats_inst.snapshot()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "DataSet:\n", + " mode = DataMode.PULL_FROM_SERVER\n", + " location = '2016-08-16/14-21-37_AlazarTest'\n", + " | | | \n", + " Setpoint | dummy_set | dummy | (50,)\n", + " Measured | acquisition_controller_acquisition | acquisition | (50,)\n", + "started at 2016-08-16 14:21:39\n" + ] + }, + { + "data": { + "application/javascript": [ + "/* Put everything inside the global mpl namespace */\n", + "window.mpl = {};\n", + "\n", + "mpl.get_websocket_type = function() {\n", + " if (typeof(WebSocket) !== 'undefined') {\n", + " return WebSocket;\n", + " } else if (typeof(MozWebSocket) !== 'undefined') {\n", + " return MozWebSocket;\n", + " } else {\n", + " alert('Your browser does not have WebSocket support.' +\n", + " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", + " 'Firefox 4 and 5 are also supported but you ' +\n", + " 'have to enable WebSockets in about:config.');\n", + " };\n", + "}\n", + "\n", + "mpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n", + " this.id = figure_id;\n", + "\n", + " this.ws = websocket;\n", + "\n", + " this.supports_binary = (this.ws.binaryType != undefined);\n", + "\n", + " if (!this.supports_binary) {\n", + " var warnings = document.getElementById(\"mpl-warnings\");\n", + " if (warnings) {\n", + " warnings.style.display = 'block';\n", + " warnings.textContent = (\n", + " \"This browser does not support binary websocket messages. \" +\n", + " \"Performance may be slow.\");\n", + " }\n", + " }\n", + "\n", + " this.imageObj = new Image();\n", + "\n", + " this.context = undefined;\n", + " this.message = undefined;\n", + " this.canvas = undefined;\n", + " this.rubberband_canvas = undefined;\n", + " this.rubberband_context = undefined;\n", + " this.format_dropdown = undefined;\n", + "\n", + " this.image_mode = 'full';\n", + "\n", + " this.root = $('
');\n", + " this._root_extra_style(this.root)\n", + " this.root.attr('style', 'display: inline-block');\n", + "\n", + " $(parent_element).append(this.root);\n", + "\n", + " this._init_header(this);\n", + " this._init_canvas(this);\n", + " this._init_toolbar(this);\n", + "\n", + " var fig = this;\n", + "\n", + " this.waiting = false;\n", + "\n", + " this.ws.onopen = function () {\n", + " fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n", + " fig.send_message(\"send_image_mode\", {});\n", + " fig.send_message(\"refresh\", {});\n", + " }\n", + "\n", + " this.imageObj.onload = function() {\n", + " if (fig.image_mode == 'full') {\n", + " // Full images could contain transparency (where diff images\n", + " // almost always do), so we need to clear the canvas so that\n", + " // there is no ghosting.\n", + " fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n", + " }\n", + " fig.context.drawImage(fig.imageObj, 0, 0);\n", + " };\n", + "\n", + " this.imageObj.onunload = function() {\n", + " this.ws.close();\n", + " }\n", + "\n", + " this.ws.onmessage = this._make_on_message_function(this);\n", + "\n", + " this.ondownload = ondownload;\n", + "}\n", + "\n", + "mpl.figure.prototype._init_header = function() {\n", + " var titlebar = $(\n", + " '
');\n", + " var titletext = $(\n", + " '
');\n", + " titlebar.append(titletext)\n", + " this.root.append(titlebar);\n", + " this.header = titletext[0];\n", + "}\n", + "\n", + "\n", + "\n", + "mpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n", + "\n", + "}\n", + "\n", + "\n", + "mpl.figure.prototype._root_extra_style = function(canvas_div) {\n", + "\n", + "}\n", + "\n", + "mpl.figure.prototype._init_canvas = function() {\n", + " var fig = this;\n", + "\n", + " var canvas_div = $('
');\n", + "\n", + " canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n", + "\n", + " function canvas_keyboard_event(event) {\n", + " return fig.key_event(event, event['data']);\n", + " }\n", + "\n", + " canvas_div.keydown('key_press', canvas_keyboard_event);\n", + " canvas_div.keyup('key_release', canvas_keyboard_event);\n", + " this.canvas_div = canvas_div\n", + " this._canvas_extra_style(canvas_div)\n", + " this.root.append(canvas_div);\n", + "\n", + " var canvas = $('');\n", + " canvas.addClass('mpl-canvas');\n", + " canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n", + "\n", + " this.canvas = canvas[0];\n", + " this.context = canvas[0].getContext(\"2d\");\n", + "\n", + " var rubberband = $('');\n", + " rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n", + "\n", + " var pass_mouse_events = true;\n", + "\n", + " canvas_div.resizable({\n", + " start: function(event, ui) {\n", + " pass_mouse_events = false;\n", + " },\n", + " resize: function(event, ui) {\n", + " fig.request_resize(ui.size.width, ui.size.height);\n", + " },\n", + " stop: function(event, ui) {\n", + " pass_mouse_events = true;\n", + " fig.request_resize(ui.size.width, ui.size.height);\n", + " },\n", + " });\n", + "\n", + " function mouse_event_fn(event) {\n", + " if (pass_mouse_events)\n", + " return fig.mouse_event(event, event['data']);\n", + " }\n", + "\n", + " rubberband.mousedown('button_press', mouse_event_fn);\n", + " rubberband.mouseup('button_release', mouse_event_fn);\n", + " // Throttle sequential mouse events to 1 every 20ms.\n", + " rubberband.mousemove('motion_notify', mouse_event_fn);\n", + "\n", + " rubberband.mouseenter('figure_enter', mouse_event_fn);\n", + " rubberband.mouseleave('figure_leave', mouse_event_fn);\n", + "\n", + " canvas_div.on(\"wheel\", function (event) {\n", + " event = event.originalEvent;\n", + " event['data'] = 'scroll'\n", + " if (event.deltaY < 0) {\n", + " event.step = 1;\n", + " } else {\n", + " event.step = -1;\n", + " }\n", + " mouse_event_fn(event);\n", + " });\n", + "\n", + " canvas_div.append(canvas);\n", + " canvas_div.append(rubberband);\n", + "\n", + " this.rubberband = rubberband;\n", + " this.rubberband_canvas = rubberband[0];\n", + " this.rubberband_context = rubberband[0].getContext(\"2d\");\n", + " this.rubberband_context.strokeStyle = \"#000000\";\n", + "\n", + " this._resize_canvas = function(width, height) {\n", + " // Keep the size of the canvas, canvas container, and rubber band\n", + " // canvas in synch.\n", + " canvas_div.css('width', width)\n", + " canvas_div.css('height', height)\n", + "\n", + " canvas.attr('width', width);\n", + " canvas.attr('height', height);\n", + "\n", + " rubberband.attr('width', width);\n", + " rubberband.attr('height', height);\n", + " }\n", + "\n", + " // Set the figure to an initial 600x600px, this will subsequently be updated\n", + " // upon first draw.\n", + " this._resize_canvas(600, 600);\n", + "\n", + " // Disable right mouse context menu.\n", + " $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n", + " return false;\n", + " });\n", + "\n", + " function set_focus () {\n", + " canvas.focus();\n", + " canvas_div.focus();\n", + " }\n", + "\n", + " window.setTimeout(set_focus, 100);\n", + "}\n", + "\n", + "mpl.figure.prototype._init_toolbar = function() {\n", + " var fig = this;\n", + "\n", + " var nav_element = $('
')\n", + " nav_element.attr('style', 'width: 100%');\n", + " this.root.append(nav_element);\n", + "\n", + " // Define a callback function for later on.\n", + " function toolbar_event(event) {\n", + " return fig.toolbar_button_onclick(event['data']);\n", + " }\n", + " function toolbar_mouse_event(event) {\n", + " return fig.toolbar_button_onmouseover(event['data']);\n", + " }\n", + "\n", + " for(var toolbar_ind in mpl.toolbar_items) {\n", + " var name = mpl.toolbar_items[toolbar_ind][0];\n", + " var tooltip = mpl.toolbar_items[toolbar_ind][1];\n", + " var image = mpl.toolbar_items[toolbar_ind][2];\n", + " var method_name = mpl.toolbar_items[toolbar_ind][3];\n", + "\n", + " if (!name) {\n", + " // put a spacer in here.\n", + " continue;\n", + " }\n", + " var button = $('