{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Qcodes example with Thorlabs PRM1Z8" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:34:46.710009Z", "start_time": "2019-03-04T16:34:46.690009Z" } }, "outputs": [], "source": [ "from qcodes_contrib_drivers.drivers.Thorlabs.APT import Thorlabs_APT\n", "from qcodes_contrib_drivers.drivers.Thorlabs.PRM1Z8 import Thorlabs_PRM1Z8" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Initialize the instrument\n", "First, we need to initialize the APT server. Then we can initialize the PRM1Z8 polarizer wheel." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:35:36.592510Z", "start_time": "2019-03-04T16:35:31.452562Z" } }, "outputs": [], "source": [ "apt = Thorlabs_APT()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:35:54.442332Z", "start_time": "2019-03-04T16:35:53.222344Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Connected to: Thorlabs TDC001 (serial:83857355, firmware:SW Version 2.0.8) in 1.21s\n" ] } ], "source": [ "thorlabs_prm1z8 = Thorlabs_PRM1Z8(\"Thorlabs_PRM1Z8\", 0, apt)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read the current position\n", "We read the current position of the polarizer wheel." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:36:46.251814Z", "start_time": "2019-03-04T16:36:46.221814Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "position 90.00012969970703 °\n" ] } ], "source": [ "print(thorlabs_prm1z8.position.label, thorlabs_prm1z8.position.get(), thorlabs_prm1z8.position.unit)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Change the position\n", "We change the position of the polarizer wheel and repeat the position reading." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:37:35.411322Z", "start_time": "2019-03-04T16:37:23.291443Z" } }, "outputs": [], "source": [ "thorlabs_prm1z8.position.set(200.0)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:37:35.461322Z", "start_time": "2019-03-04T16:37:35.441322Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "position 200.00189208984375 °\n" ] } ], "source": [ "print(thorlabs_prm1z8.position.label, thorlabs_prm1z8.position.get(), thorlabs_prm1z8.position.unit)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Close instrument" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2019-03-04T16:38:32.798750Z", "start_time": "2019-03-04T16:38:32.258755Z" } }, "outputs": [], "source": [ "thorlabs_prm1z8.close()\n", "apt.apt_clean_up()" ] } ], "metadata": { "hide_input": false, "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.6.8" }, "nbsphinx": { "execute": "never" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }