From 60d6635e8e7949f83a274a9a96fb6f7ab6fcccc2 Mon Sep 17 00:00:00 2001 From: Jens Peter Secher Date: Thu, 30 Nov 2023 13:04:20 +0100 Subject: [PATCH 1/3] Fix sweep generation --- docs/examples/QDevil/QDAC2/Sweep.ipynb | 5 +++-- qcodes_contrib_drivers/drivers/QDevil/QDAC2.py | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/examples/QDevil/QDAC2/Sweep.ipynb b/docs/examples/QDevil/QDAC2/Sweep.ipynb index dd159fab6..8841ef600 100644 --- a/docs/examples/QDevil/QDAC2/Sweep.ipynb +++ b/docs/examples/QDevil/QDAC2/Sweep.ipynb @@ -126,6 +126,7 @@ "source": [ "dc_sweep = qdac.ch03.dc_sweep(\n", " repetitions=2,\n", + " stepped=True,\n", " start_V=-1,\n", " stop_V=1,\n", " points=11,\n", @@ -247,7 +248,7 @@ ], "metadata": { "kernelspec": { - "display_name": "qcodespip311", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -261,7 +262,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.0 | packaged by conda-forge | (main, Jan 16 2023, 14:12:30) [MSC v.1916 64 bit (AMD64)]" + "version": "3.10.12" }, "nbsphinx": { "execute": "never" diff --git a/qcodes_contrib_drivers/drivers/QDevil/QDAC2.py b/qcodes_contrib_drivers/drivers/QDevil/QDAC2.py index 5baa7f4aa..d627e068a 100644 --- a/qcodes_contrib_drivers/drivers/QDevil/QDAC2.py +++ b/qcodes_contrib_drivers/drivers/QDevil/QDAC2.py @@ -7,10 +7,10 @@ from pyvisa.errors import VisaIOError from qcodes.utils import validators from typing import NewType, Tuple, Sequence, List, Dict, Optional -from packaging.version import Version, parse +from packaging.version import parse import abc -# Version 1.8.0 +# Version 1.9.0 # # Guiding principles for this driver for QDevil QDAC-II # ----------------------------------------------------- @@ -400,7 +400,7 @@ def __init__(self, channel: 'QDac2Channel', start_V: float, stop_V: float, channel.write_channel('sour{0}:volt:mode swe') self._set_voltages(start_V, stop_V) channel.write_channel(f'sour{"{0}"}:swe:poin {points}') - self._set_trigger_mode(stepped) + self._set_generation_mode(stepped) channel.write_channel(f'sour{"{0}"}:swe:dwel {dwell_s}') super()._set_delay(delay_s) self._set_direction(backwards) @@ -411,10 +411,10 @@ def _set_voltages(self, start_V: float, stop_V: float): self._write_channel(f'sour{"{0}"}:swe:star {start_V}') self._write_channel(f'sour{"{0}"}:swe:stop {stop_V}') - def _set_trigger_mode(self, stepped: bool) -> None: + def _set_generation_mode(self, stepped: bool) -> None: if stepped: return self._write_channel('sour{0}:swe:gen step') - self._write_channel('sour{0}:swe:gen auto') + self._write_channel('sour{0}:swe:gen anal') def _set_direction(self, backwards: bool) -> None: if backwards: @@ -1578,7 +1578,7 @@ def dc_sweep(self, start_V: float, stop_V: float, points: int, dwell_s (float, optional): Seconds between each voltage (default 1ms) delay_s (float, optional): Seconds of delay after receiving a trigger (default 0) backwards (bool, optional): Sweep in reverse (default is forward) - stepped (bool, optional): True means that each step needs to be triggered (default False) + stepped (bool, optional): True means discrete steps (default True) Returns: Sweep_Context: context manager From 37976c85e76ea1860a7532f4d9572ad7e5c77b88 Mon Sep 17 00:00:00 2001 From: Jens Peter Secher Date: Tue, 12 Dec 2023 13:19:32 +0100 Subject: [PATCH 2/3] QSwitch: Use the *OPC? query instead of delay --- docs/examples/QDevil/QSwitch/Debugging.ipynb | 90 ++++++++++++-- docs/examples/QDevil/QSwitch/Usage.ipynb | 112 +++++++++++++++--- .../drivers/QDevil/QSwitch.py | 6 +- 3 files changed, 181 insertions(+), 27 deletions(-) diff --git a/docs/examples/QDevil/QSwitch/Debugging.ipynb b/docs/examples/QDevil/QSwitch/Debugging.ipynb index 90bb734ff..e60d95a4f 100644 --- a/docs/examples/QDevil/QSwitch/Debugging.ipynb +++ b/docs/examples/QDevil/QSwitch/Debugging.ipynb @@ -8,9 +8,65 @@ "# QSwitch debugging\n" ] }, + { + "cell_type": "markdown", + "id": "8428f8bd", + "metadata": {}, + "source": [ + "The QSwitch only supports a single Ethernet connection at a time. If you find yourself in a situation where you cannot connect to the instrument, then it might be because some process on your computer still has a connection to the instrument. To identify which process, do something like" + ] + }, + { + "cell_type": "markdown", + "id": "06be4a1a", + "metadata": {}, + "source": [ + "```\n", + "$ netstat -ntpn | grep '192.168.8.21'\n", + "tcp 0 0 192.168.8.66:43772 192.168.8.21:5025 ESTABLISHED 153450/python3\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "8708065e", + "metadata": {}, + "source": [ + "Then you can forcefully kill the process like" + ] + }, + { + "cell_type": "markdown", + "id": "945dcaf4", + "metadata": {}, + "source": [ + "```\n", + "$ kill 153450\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "b39d8c3c", + "metadata": {}, + "source": [ + "and then wait for the TCP connection to let go:" + ] + }, + { + "cell_type": "markdown", + "id": "8e9d32f9", + "metadata": {}, + "source": [ + "```\n", + "$ netstat -ntpn | grep '192.168.8.21'\n", + "tcp 0 0 192.168.8.66:43772 192.168.8.21:5025 TIME_WAIT -\n", + "```" + ] + }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "id": "85f2a1e0", "metadata": {}, "outputs": [ @@ -18,7 +74,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Connected to: Quantum Machines QSwitch (serial:5, firmware:0.160) in 0.11s\n" + "Connected to: Quantum Machines QSwitch (serial:2, firmware:0.178) in 0.11s\n" ] } ], @@ -26,7 +82,7 @@ "import pprint\n", "pp = pprint.PrettyPrinter()\n", "from qcodes_contrib_drivers.drivers.QDevil import QSwitch\n", - "qswitch_addr = '192.168.8.18'\n", + "qswitch_addr = '192.168.8.20'\n", "qswitch = QSwitch.QSwitch('switch', visalib='@py', address=f'TCPIP::{qswitch_addr}::5025::SOCKET')" ] }, @@ -40,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "id": "d0c7fc28", "metadata": {}, "outputs": [], @@ -50,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 6, "id": "64f0cbe6", "metadata": {}, "outputs": [ @@ -60,7 +116,7 @@ "'0,\"No error\"'" ] }, - "execution_count": 4, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -77,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "id": "0d8a7693", "metadata": {}, "outputs": [ @@ -85,7 +141,15 @@ "name": "stdout", "output_type": "stream", "text": [ - "['*rst', 'stat?', 'clos (@5!9)', 'open (@5!0)', 'clos (@5!5)', 'all?']\n" + "['*rst',\n", + " 'stat?',\n", + " 'clos (@5!9)',\n", + " '*opc?',\n", + " 'open (@5!0)',\n", + " '*opc?',\n", + " 'clos (@5!5)',\n", + " '*opc?',\n", + " 'all?']\n" ] } ], @@ -93,6 +157,16 @@ "pp.pprint(qswitch.get_recorded_scpi_commands())" ] }, + { + "cell_type": "code", + "execution_count": 8, + "id": "995394e6", + "metadata": {}, + "outputs": [], + "source": [ + "qswitch.close()" + ] + }, { "cell_type": "markdown", "id": "588fabac", diff --git a/docs/examples/QDevil/QSwitch/Usage.ipynb b/docs/examples/QDevil/QSwitch/Usage.ipynb index 62fbca324..4f8cb64b6 100644 --- a/docs/examples/QDevil/QSwitch/Usage.ipynb +++ b/docs/examples/QDevil/QSwitch/Usage.ipynb @@ -32,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 3, "id": "5787c333-0d69-47db-bfe3-37bead44a7c5", "metadata": {}, "outputs": [ @@ -40,7 +40,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Connected to: Quantum Machines QSwitch (serial:4, firmware:0.160) in 0.07s\n" + "Connected to: Quantum Machines QSwitch (serial:2, firmware:0.178) in 0.05s\n" ] } ], @@ -67,12 +67,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "Connected to: Quantum Machines QSwitch (serial:5, firmware:0.160) in 0.13s\n" + "Connected to: Quantum Machines QSwitch (serial:2, firmware:0.178) in 0.12s\n" ] } ], "source": [ - "qswitch_addr = '192.168.8.16'\n", + "qswitch_addr = '192.168.8.21'\n", "qswitch = QSwitch.QSwitch('switch', visalib='@py', address=f'TCPIP::{qswitch_addr}::5025::SOCKET')" ] }, @@ -110,6 +110,35 @@ "cell_type": "markdown", "id": "2fc0260b-8052-457a-b820-15edd7a699d3", "metadata": {}, + "source": [ + "Or in expanded form:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "c592efa5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'(@1!0,2!0,3!0,4!0,5!0,6!0,7!0,8!0,9!0,10!0,11!0,12!0,13!0,14!0,15!0,16!0,17!0,18!0,19!0,20!0,21!0,22!0,23!0,24!0)'" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "QSwitch.expand_channel_list(qswitch.state())" + ] + }, + { + "cell_type": "markdown", + "id": "f20fa87f", + "metadata": {}, "source": [ "Or expressed as a Python array:" ] @@ -293,7 +322,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 10, "id": "9d3d65c5", "metadata": {}, "outputs": [], @@ -313,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "3f7f92ca", "metadata": {}, "outputs": [], @@ -331,7 +360,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "45ae7eea", "metadata": {}, "outputs": [], @@ -358,7 +387,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 13, "id": "ac31add0", "metadata": {}, "outputs": [], @@ -376,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "id": "86cfd2da", "metadata": {}, "outputs": [], @@ -403,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 15, "id": "e0ad0e89", "metadata": {}, "outputs": [], @@ -440,7 +469,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "245cd62c", "metadata": {}, "outputs": [], @@ -458,7 +487,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "54374fb6", "metadata": {}, "outputs": [], @@ -485,17 +514,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "f48f9830", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'1': ['grounded'],\n", + " '2': ['grounded'],\n", + " '3': ['grounded'],\n", + " '4': ['grounded'],\n", + " 'sensor': ['grounded'],\n", + " '6': ['grounded'],\n", + " '7': ['grounded'],\n", + " '8': ['grounded'],\n", + " '9': ['grounded'],\n", + " '10': ['grounded'],\n", + " '11': ['grounded'],\n", + " '12': ['grounded'],\n", + " '13': ['grounded'],\n", + " '14': ['grounded'],\n", + " '15': ['grounded'],\n", + " '16': ['grounded'],\n", + " '17': ['grounded'],\n", + " '18': ['grounded'],\n", + " '19': ['grounded'],\n", + " '20': ['grounded'],\n", + " '21': ['grounded'],\n", + " 'plunger': ['connected', 'breakout DMM'],\n", + " '24': ['breakout 1']}" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "qswitch.overview()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "b5030c09", "metadata": {}, "outputs": [], @@ -521,7 +583,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "dfdba65e", "metadata": {}, "outputs": [], @@ -529,6 +591,24 @@ "qswitch.auto_save('on')\n", "qswitch.auto_save('off')" ] + }, + { + "cell_type": "markdown", + "id": "bff23cac", + "metadata": {}, + "source": [ + "The QSwitch only supports a single Ethernet connection at a time, so you can explicitly tell Python to let go of the connection:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "44bac656", + "metadata": {}, + "outputs": [], + "source": [ + "qswitch.close()" + ] } ], "metadata": { diff --git a/qcodes_contrib_drivers/drivers/QDevil/QSwitch.py b/qcodes_contrib_drivers/drivers/QDevil/QSwitch.py index 45b66d870..05d73d269 100644 --- a/qcodes_contrib_drivers/drivers/QDevil/QSwitch.py +++ b/qcodes_contrib_drivers/drivers/QDevil/QSwitch.py @@ -9,7 +9,7 @@ Tuple, Sequence, List, Dict, Set, Union, Optional) from packaging.version import parse -# Version 0.4.0 +# Version 0.5.0 State = Sequence[Tuple[int, int]] @@ -317,7 +317,7 @@ def write(self, cmd: str) -> None: """ try: self._write(cmd) - sleep_s(0.075) + self.ask('*opc?') errors = super().ask('all?') except Exception as error: raise ValueError(f'Error: {repr(error)} after executing {cmd}') @@ -418,7 +418,7 @@ def _check_for_wrong_model(self) -> None: def _check_for_incompatiable_firmware(self) -> None: firmware = self.IDN()['firmware'] - least_compatible_fw = '0.155' + least_compatible_fw = '0.178' if parse(firmware) < parse(least_compatible_fw): raise ValueError(f'Incompatible firmware {firmware}. You need at ' f'least {least_compatible_fw}') From a7b769923755472d3806c7964a4e58ae3e74dc5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:36:29 +0000 Subject: [PATCH 3/3] Bump actions/upload-artifact from 3 to 4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 11f4c1f04..489420331 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -77,7 +77,7 @@ jobs: ./make.bat html if: runner.os == 'Windows' - name: Upload build docs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: docs_${{ matrix.python-version }}_${{ matrix.os }} path: ${{ github.workspace }}/docs/_build/html