diff --git a/docs/examples/driver_examples/Qcodes example with Attocube ANC300.ipynb b/docs/examples/driver_examples/Qcodes example with Attocube ANC300.ipynb index 00723bf6a0d..40f7a958dbe 100644 --- a/docs/examples/driver_examples/Qcodes example with Attocube ANC300.ipynb +++ b/docs/examples/driver_examples/Qcodes example with Attocube ANC300.ipynb @@ -16,12 +16,45 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "import qcodes as qc\n", - "from qcodes.instrument_drivers.Attocube.Attocube_ANC300 import ANC300" + "from qcodes.instrument_drivers.Attocube.Attocube_ANC300 import ANC300\n", + "\n", + "import time\n", + "\n", + "#ef test_ANC300_param(ANC300, param):\n", + "# print(\"Testing parameter: {!s}\".format(param.name))\n", + "# mode = ANC300\n", + "# print(\"Current mode: \")\n", + "# val_0 = qcodes_param.get()\n", + "# print(\"Initial value of {!s} = {} {}\".format(qcodes_param.name, val_0 , qcodes_param.unit))\n", + "# print(\"Valid values for {!s}:\\n{!r}\".format(qcodes_param.name, qcodes_param.vals.valid_values))\n", + "# for val in qcodes_param.vals.valid_values:\n", + "# print(\"Set {!s} = {} {}\".format(qcodes_param.name, val, qcodes_param.unit))\n", + "# qcodes_param.set(val)\n", + "# print(\"Got {!s} = {} {}\".format(qcodes_param.name, qcodes_param.get(), qcodes_param.unit))\n", + "# qcodes_param.set(val_0)\n", + "# print()\n", + "\n", + "def test_qcodes_param(qcodes_param):\n", + " val_0 = qcodes_param.get()\n", + " print(\"Initial value of {!s} = {} {}\".format(qcodes_param.name, val_0 , qcodes_param.unit))\n", + " print(\"Valid values for {!s}:\\n{!r}\".format(qcodes_param.name, qcodes_param.vals.valid_values))\n", + " for val in qcodes_param.vals.valid_values:\n", + " print(\"Set {!s} = {} {}\".format(qcodes_param.name, val, qcodes_param.unit))\n", + " try:\n", + " qcodes_param.set(val)\n", + " except Exception as e:\n", + " print(e)\n", + " print(\"Got {!s} = {} {}\".format(qcodes_param.name, qcodes_param.get(), qcodes_param.unit))\n", + " qcodes_param.set(val_0)\n", + " print()\n", + "\n", + "def print_qcodes_param(qcodes_param):\n", + " print(\"Got {!s} = {} {}\\n\".format(qcodes_param.name, qcodes_param.get(), qcodes_param.unit))" ] }, { @@ -33,7 +66,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -49,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 31, "metadata": { "scrolled": false }, @@ -69,7 +102,7 @@ "\tparameter value\n", "--------------------------------------------------------------------------------\n", "ac_in :\tFalse \n", - "capacitance :\t0.70362 (nF)\n", + "capacitance :\t0.6823 (nF)\n", "dc_in :\tFalse \n", "mode :\tgnd \n", "offset_voltage :\t0 (V)\n", @@ -78,10 +111,10 @@ "serial_no :\tANM300B-M-0945-1003041 \n", "step_amplitude :\t40 (V)\n", "step_down_pattern :\t[255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 2...\n", - "step_frequency :\t100 (Hz)\n", + "step_frequency :\t500 (Hz)\n", "step_up_pattern :\t[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16...\n", "trigger_down_pin :\t2 \n", - "trigger_up_pin :\t1 \n", + "trigger_up_pin :\t6 \n", "attocube_piezo_controller_axis2:\n", "\tparameter value\n", "--------------------------------------------------------------------------------\n", @@ -174,6 +207,694 @@ "piezo_ctrl.print_readable_snapshot(update=True)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Test setting parameters and calling functions" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "None\n" + ] + }, + { + "ename": "ANC300GenericError", + "evalue": "('Axis in wrong mode', \"writing 'stepu 1 c' to \")", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mANC300GenericError\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[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpiezo_ctrl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0maxis1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mset\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'gnd'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpiezo_ctrl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0maxis1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstep_up_cont\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 3\u001b[0m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[0mpiezo_ctrl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0maxis1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\instrument\\function.py\u001b[0m in \u001b[0;36m__call__\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m 114\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\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[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 115\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalidate\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[0m\n\u001b[1;32m--> 116\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_call\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[0m\n\u001b[0m\u001b[0;32m 117\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 118\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcall\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\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[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\utils\\command.py\u001b[0m in \u001b[0;36m__call__\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m 175\u001b[0m raise TypeError(\n\u001b[0;32m 176\u001b[0m 'command takes exactly {} args'.format(self.arg_count))\n\u001b[1;32m--> 177\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexec_function\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[0m\n\u001b[0m", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\utils\\command.py\u001b[0m in \u001b[0;36mcall_by_str\u001b[1;34m(self, *args)\u001b[0m\n\u001b[0;32m 124\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcall_by_str\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\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[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 125\u001b[0m \u001b[1;34m\"\"\"Execute a formatted string.\"\"\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 126\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexec_str\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcmd_str\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\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[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 127\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 128\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcall_by_str_parsed_out\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\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[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\instrument\\channel.py\u001b[0m in \u001b[0;36mwrite\u001b[1;34m(self, cmd)\u001b[0m\n\u001b[0;32m 49\u001b[0m \u001b[1;31m# Pass any commands to read or write from the instrument up to the parent\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 50\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[0mcmd\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 51\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_parent\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwrite\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcmd\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 52\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 53\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mwrite_raw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcmd\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\instrument\\base.py\u001b[0m in \u001b[0;36mwrite\u001b[1;34m(self, cmd)\u001b[0m\n\u001b[0;32m 603\u001b[0m \u001b[0minst\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrepr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 604\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0margs\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0margs\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'writing '\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mrepr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcmd\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m' to '\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0minst\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 605\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 606\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 607\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mwrite_raw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcmd\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m->\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\instrument\\base.py\u001b[0m in \u001b[0;36mwrite\u001b[1;34m(self, cmd)\u001b[0m\n\u001b[0;32m 599\u001b[0m \"\"\"\n\u001b[0;32m 600\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 601\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwrite_raw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcmd\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 602\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 603\u001b[0m \u001b[0minst\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mrepr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\instrument_drivers\\Attocube\\Attocube_ANC300.py\u001b[0m in \u001b[0;36mwrite_raw\u001b[1;34m(self, cmd)\u001b[0m\n\u001b[0;32m 324\u001b[0m '%s: %r.', self.name, resp)\n\u001b[0;32m 325\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 326\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_ask_raw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcmd\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;32mdef\u001b[0m \u001b[0mask_raw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcmd\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32mc:\\users\\he3user\\documents\\python libraries\\qcodes\\qcodes\\instrument_drivers\\Attocube\\Attocube_ANC300.py\u001b[0m in \u001b[0;36m_ask_raw\u001b[1;34m(self, cmd)\u001b[0m\n\u001b[0;32m 383\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mANC300WrongAxisType\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 384\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 385\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mANC300GenericError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0manswer\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstrip\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 386\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 387\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0manswer\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mANC300GenericError\u001b[0m: ('Axis in wrong mode', \"writing 'stepu 1 c' to \")" + ] + } + ], + "source": [ + "print(piezo_ctrl.axis1.mode.set('gnd'))\n", + "print(piezo_ctrl.axis1.step_up_cont())\n", + "time.sleep(2)\n", + "piezo_ctrl.axis1.stop()" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "axis = piezo_ctrl.axis1" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['gnd', 'inp', 'cap', 'stp', 'off', 'stp+', 'stp-']" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "axis.mode.vals.valid_values" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Initial value of mode = gnd \n", + "Valid values for mode:\n", + "['gnd', 'inp', 'cap', 'stp', 'off', 'stp+', 'stp-']\n", + "Set mode = gnd \n", + "Got mode = gnd \n", + "Set mode = inp \n", + "Got mode = inp \n", + "Set mode = cap \n", + "Got mode = cap \n", + "Set mode = stp \n", + "Got mode = stp \n", + "Set mode = off \n", + "Got mode = off \n", + "Set mode = stp+ \n", + "Got mode = stp+ \n", + "Set mode = stp- \n", + "Got mode = stp- \n", + "\n", + "Got capacitance = None nF\n", + "\n", + "Got capacitance = None nF\n", + "\n", + "# General testing\n", + "\n", + "\n", + "## Mode: gnd\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = gnd \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = gnd \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = gnd \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = gnd \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = gnd \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = 0.682303 nF\n", + "\n", + "Got mode = gnd \n", + "\n", + "('Axis in wrong mode', \"writing 'stepu 1' to \")\n", + "\n", + "## Mode: inp\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = inp \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = gnd \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = gnd \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = inp \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = inp \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = 0.682303 nF\n", + "\n", + "Got mode = inp \n", + "\n", + "('Axis in wrong mode', \"writing 'stepu 1' to \")\n", + "\n", + "## Mode: cap\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = cap \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = cap \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = cap \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = cap \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = gnd \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = None nF\n", + "\n", + "Got mode = cap \n", + "\n", + "('Axis in wrong mode', \"writing 'stepu 1' to \")\n", + "\n", + "## Mode: stp\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = stp \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = stp \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = stp \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = stp \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = gnd \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = 0.085288 nF\n", + "\n", + "Got mode = stp \n", + "\n", + "\n", + "## Mode: off\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = off \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = off \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = off \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = off \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = off \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = 0.085288 nF\n", + "\n", + "Got mode = off \n", + "\n", + "('Axis in wrong mode', \"writing 'stepu 1' to \")\n", + "\n", + "## Mode: stp+\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = stp+ \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = stp+ \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = stp+ \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = stp+ \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = off \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = 0.085288 nF\n", + "\n", + "Got mode = stp+ \n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "## Mode: stp-\n", + "\n", + "Initial value of step_frequency = 500 Hz\n", + "Valid values for step_frequency:\n", + "[1, 10000]\n", + "Set step_frequency = 1 Hz\n", + "Got step_frequency = 1 Hz\n", + "Set step_frequency = 10000 Hz\n", + "Got step_frequency = 500 Hz\n", + "\n", + "Initial value of step_amplitude = 40.0 V\n", + "Valid values for step_amplitude:\n", + "[0, 150]\n", + "Set step_amplitude = 0 V\n", + "Got step_amplitude = 0.0 V\n", + "Set step_amplitude = 150 V\n", + "Got step_amplitude = 40.0 V\n", + "\n", + "Got mode = stp- \n", + "\n", + "Initial value of ac_in = False \n", + "Valid values for ac_in:\n", + "[True, False]\n", + "Set ac_in = True \n", + "Got ac_in = True \n", + "Set ac_in = False \n", + "Got ac_in = False \n", + "\n", + "Got mode = stp- \n", + "\n", + "Initial value of dc_in = False \n", + "Valid values for dc_in:\n", + "[True, False]\n", + "Set dc_in = True \n", + "Got dc_in = True \n", + "Set dc_in = False \n", + "Got dc_in = False \n", + "\n", + "Got mode = stp- \n", + "\n", + "Initial value of offset_voltage = 0.0 V\n", + "Valid values for offset_voltage:\n", + "[0, 150]\n", + "Set offset_voltage = 0 V\n", + "Got offset_voltage = 0.0 V\n", + "Set offset_voltage = 150 V\n", + "Got offset_voltage = 40.0 V\n", + "\n", + "Got mode = stp- \n", + "\n", + "Initial value of outp_filter = off Hz\n", + "Valid values for outp_filter:\n", + "[16, 160, 'off']\n", + "Set outp_filter = 16 Hz\n", + "Got outp_filter = 16 Hz\n", + "Set outp_filter = 160 Hz\n", + "Got outp_filter = 160 Hz\n", + "Set outp_filter = off Hz\n", + "Got outp_filter = off Hz\n", + "\n", + "Got mode = off \n", + "\n", + "Got output_voltage = 0.0 V\n", + "\n", + "Got capacitance = 0.085288 nF\n", + "\n", + "Got mode = stp- \n", + "\n", + "\n", + "\n" + ] + } + ], + "source": [ + "test_qcodes_param(axis.mode)\n", + "\n", + "\"\"\"\n", + "Params/funcs that change mode (only for some values ?):\n", + " - step_amplitude (only when set to 0 ?)\n", + " - outp_filter \n", + " - offset_voltage\n", + " - ac_in, dc_in\n", + " - \n", + "\"\"\"\n", + "\n", + "print(\"# Capacitance meas testing\\n\")\n", + "\n", + "axis.mode.set('cap')\n", + "axis.wait_capacitance_updated()\n", + "print_qcodes_param(axis.capacitance)\n", + "\n", + "axis.update_capacitance()\n", + "axis.wait_capacitance_updated()\n", + "print_qcodes_param(axis.capacitance)\n", + "\n", + "print(\"# General testing\\n\")\n", + "for mode in axis.mode.vals.valid_values:\n", + " print(\"## Mode: {}\\n\".format(mode))\n", + " try:\n", + " axis.mode.set(mode)\n", + " test_qcodes_param(axis.step_frequency)\n", + " test_qcodes_param(axis.step_amplitude) # requires more tests (changes mode when set)\n", + " print_qcodes_param(axis.mode)\n", + " axis.mode.set(mode)\n", + " test_qcodes_param(axis.ac_in) # requires more tests (changes mode when set)\n", + " print_qcodes_param(axis.mode)\n", + " axis.mode.set(mode)\n", + " test_qcodes_param(axis.dc_in) # requires more tests (changes mode when set)\n", + " print_qcodes_param(axis.mode)\n", + " axis.mode.set(mode)\n", + " test_qcodes_param(axis.offset_voltage) # requires more tests (changes mode when set)\n", + " print_qcodes_param(axis.mode)\n", + " axis.mode.set(mode)\n", + " test_qcodes_param(axis.outp_filter) # requires more tests (changes mode when set)\n", + " print_qcodes_param(axis.mode)\n", + " axis.mode.set(mode)\n", + " print_qcodes_param(axis.output_voltage)\n", + " print_qcodes_param(axis.capacitance) # weird values\n", + " print_qcodes_param(axis.mode)\n", + " axis.step_up_single()\n", + " axis.wait_steps_end()\n", + " axis.step_up(1000)\n", + " axis.wait_steps_end()\n", + " axis.step_up_cont()\n", + " time.sleep(0.5)\n", + " axis.stop()\n", + " axis.step_down_single()\n", + " axis.wait_steps_end()\n", + " axis.step_down(1000)\n", + " axis.wait_steps_end()\n", + " axis.step_down_cont()\n", + " time.sleep(0.5)\n", + " axis.stop()\n", + " except Exception as e:\n", + " print(e)\n", + " finally:\n", + " print()\n", + "\n", + "print()\n", + "\n", + "#test_qcodes_param(axis.trigger_up_pin) # valid values not well defined enough yet\n", + "#test_qcodes_param(axis.trigger_down_pin)\n", + "\n", + "#test_qcodes_param(axis.step_up_pattern) # valid_values not well defined yet\n", + "#test_qcodes_param(axis.step_down_pattern) # valid_values not well defined yet\n", + "\n", + "#axis.mode.set('stp+')\n", + "#axis.mode.set('stp-')\n", + "#axis.mode.set('inp')\n", + "#axis.mode.set('off')\n", + "axis.mode.set('gnd')" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -183,7 +904,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 85, "metadata": {}, "outputs": [], "source": [