Skip to content

Commit

Permalink
Merge branch 'SMB100A' of github.com:julienbarrier/Qcodes_contrib_dri…
Browse files Browse the repository at this point in the history
…vers into SMB100A
  • Loading branch information
julienbarrier committed Aug 31, 2023
2 parents 69ba972 + a76c9be commit e22470a
Show file tree
Hide file tree
Showing 26 changed files with 2,209 additions and 81 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
OS: ${{ matrix.os }}
UPLOAD_TO_GHPAGES: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v3.6.0
with:
fetch-depth: '0'
# if we upload to ghpages we need the full
# history to generate correct version info
if: ${{ fromJSON(env.UPLOAD_TO_GHPAGES) }}
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v3.6.0
if: ${{ !fromJSON(env.UPLOAD_TO_GHPAGES) }}
- name: setup ubuntu-latest xvfb
uses: ./.github/actions/setup-ubuntu-latest-xvfb
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v3.6.0
with:
submodules: true
- name: setup ubuntu-latest xvfb
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_to_pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
id-token: write
environment: pypi-release-env
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v3.6.0
- name: Set up Python
uses: actions/[email protected]
with:
Expand Down
190 changes: 190 additions & 0 deletions docs/examples/Thorlabs_KLS1550.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5658297a",
"metadata": {},
"source": [
"# QCoDeS example with Thorlabs KLS1550 laser source\n",
"(same .dll as for KLS101, KLSnnn)"
]
},
{
"cell_type": "markdown",
"id": "1a175bbe",
"metadata": {},
"source": [
"## Initialisation\n",
"Import all required libraries for driving the devices."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "e1d78fec",
"metadata": {},
"outputs": [],
"source": [
"import qcodes as qc\n",
"from qcodes_contrib_drivers.drivers.Thorlabs.Kinesis import Thorlabs_Kinesis\n",
"from qcodes_contrib_drivers.drivers.Thorlabs.KLS1550 import Thorlabs_KLS1550"
]
},
{
"cell_type": "markdown",
"id": "59f40438",
"metadata": {},
"source": [
"Create an instance of `Thorlabs_Kinesis` which is a wrapper for the device dll (passed as an argument to the object) that starts up the Kinesis server. The DLL needs be installed from https://www.thorlabs.com/software_pages/viewsoftwarepage.cfm?code=Motion_Control under \"Kinesis software\"."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "58c7f162",
"metadata": {},
"outputs": [],
"source": [
"kinesis = Thorlabs_Kinesis(\"Thorlabs.MotionControl.KCube.LaserSource.dll\", sim=False)\n",
"print(kinesis.device_list())"
]
},
{
"cell_type": "markdown",
"id": "c318ee9d",
"metadata": {},
"source": [
"Create an instance of `Thorlabs_KLS1550` which is the device driver object, opening the device and starting polling (requesting device information) at 200 milisecods loops (must know the serial number shown on the device)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3b0d44a",
"metadata": {},
"outputs": [],
"source": [
"qc.Instrument.close_all()\n",
"laser = Thorlabs_KLS1550(\n",
" name=\"laser\",\n",
" serial_number=\"...\",\n",
" polling_speed=200, \n",
" kinesis=kinesis)"
]
},
{
"cell_type": "markdown",
"id": "23bbe1b8",
"metadata": {},
"source": [
"## Turning the laser output on/off\n",
"Set the parameter `output_enabled` to True for \"laser on\" and False for \"laser off\". Note that the laser will only turn on if the safety switch is also on."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "be1b61a4",
"metadata": {},
"outputs": [],
"source": [
"laser.output_enabled.set(True) # laser turns on"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6bf23da9",
"metadata": {},
"outputs": [],
"source": [
"laser.output_enabled.set(False) # laser turns off"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2f603470",
"metadata": {},
"outputs": [],
"source": [
"laser.output_enabled.get() # Check laser output status"
]
},
{
"cell_type": "markdown",
"id": "c58d355f",
"metadata": {},
"source": [
"## Setting the laser output power\n",
"Set the laser output power in Watts and get the current power value from the device (also in Watts)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d4d690cd",
"metadata": {},
"outputs": [],
"source": [
"laser.power.set(1e-3) # Set power to 1 mW"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e852001",
"metadata": {},
"outputs": [],
"source": [
"laser.power.get() # Gets laser power reading"
]
},
{
"cell_type": "markdown",
"id": "b497e7c7",
"metadata": {},
"source": [
"## Disconnecting\n",
"Disconnect the device from the driver (but not the server, it still shows under `device_list`), stopping polling and closing the device (both for Kinesis server and qcodes)."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7333f215",
"metadata": {},
"outputs": [],
"source": [
"laser.close()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (qcodes)",
"language": "python",
"name": "qcodes"
},
"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.11.4"
},
"toc-autonumbering": false,
"toc-showcode": true,
"toc-showmarkdowntxt": false,
"nbsphinx": {
"execute": "never"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit e22470a

Please sign in to comment.