{ "metadata": { "nbsphinx": { "execute": "never" }, "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.7-final" }, "orig_nbformat": 2, "kernelspec": { "name": "python_defaultSpec_1598432321198", "display_name": "Python 3.7.7 64-bit ('python37': conda)" } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example for Single Quantum SNSPD" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import qcodes as qc\n", "import matplotlib.pyplot as plt\n", "\n", "from qcodes_contrib_drivers.drivers.SingleQuantum.SingleQuantum import WebSQControlqcode\n", "from qcodes.instrument.parameter import expand_setpoints_helper\n", "from qcodes.dataset.plotting import plot_dataset\n", "from qcodes.logger.logger import start_all_logging" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Connects to the driver, default ip address is 192.168.1.1" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "start_all_logging()\n", "station = qc.Station()\n", "websq = WebSQControlqcode('websq', address='192.168.1.1', port=12000)\n", "station.add_component(websq)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Get the number of detectors" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "number_of_detectors = websq.number_of_detectors()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set the integration time (ms)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "websq.measurement_periode(20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Enable the detectors" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "websq.detectors(True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set the bias current (uA) and trigger levels (mV) with array size equal to the number of detectors in your system." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "websq.bias_current([1, 2, 3, 4])\n", "websq.trigger_level([5, 6, 7, 8])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set the amount of measurements" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "websq.npts(5)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Measurement of a simple IV sweep" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "exp = qc.load_or_create_experiment(\n", " experiment_name='performing_meas_using_parameters_and_dataset',\n", " sample_name=\"no sample\")\n", "timemeas = qc.Measurement(exp=exp)\n", "timemeas.register_parameter(websq.channel1)\n", "timemeas.register_parameter(websq.channel2)\n", "timemeas.register_parameter(websq.channel3)\n", "timemeas.register_parameter(websq.channel4)\n", "\n", "with timemeas.run() as datasaver:\n", " for i in range(10):\n", " # Tests increasing the bias current\n", " websq.bias_current([i, i, i, i])\n", " # Updates the detector counts\n", " websq.counters()\n", " datasaver.add_result(\n", " *expand_setpoints_helper(websq.channel1),\n", " *expand_setpoints_helper(websq.channel2),\n", " *expand_setpoints_helper(websq.channel3),\n", " *expand_setpoints_helper(websq.channel4)\n", " )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Close the connection and plot the measurement" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "dataset = datasaver.dataset\n", "fig, ax = plt.subplots(1)\n", "axes, cbaxes = plot_dataset(dataset, axes=[ax, ax, ax, ax])\n", "# Close connection\n", "websq.close()\n", "plt.show()" ] } ] }