Skip to content

Commit

Permalink
Merge branch 'main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsecher authored Aug 24, 2023
2 parents e9ae3d7 + 76e17c3 commit db3a507
Show file tree
Hide file tree
Showing 13 changed files with 1,564 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
args: install pandoc
if: runner.os == 'Windows'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.6.1
uses: actions/setup-python@v4.7.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
name: docs_${{ matrix.python-version }}_${{ matrix.os }}
path: ${{ github.workspace }}/docs/_build/html
- name: Deploy to gh pages
uses: JamesIves/[email protected].2
uses: JamesIves/[email protected].3
with:
branch: gh-pages
folder: ${{ github.workspace }}/docs/_build/html
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
uses: ./.github/actions/setup-ubuntu-latest-xvfb
if: runner.os == 'Linux'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4.6.1
uses: actions/setup-python@v4.7.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
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 @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/setup-python@v4.6.1
uses: actions/setup-python@v4.7.0
with:
python-version: '3.10'
- name: Install build deps
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
}
8 changes: 6 additions & 2 deletions qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ def get_temperature(self, channel: int) -> float:
names = ['date', 'time', 'y'],
header = None)

# There is no space before the day with BlueFors Control Software v2.2
df.index = pd.to_datetime(df['date']+'-'+df['time'], format='%d-%m-%y-%H:%M:%S')
try:
# There is a space before the day for old BlueFors Control Sofware versions
df.index = pd.to_datetime(df['date']+'-'+df['time'], format=' %d-%m-%y-%H:%M:%S')
except:
# There is no space before the day with BlueFors Control Software v2.2
df.index = pd.to_datetime(df['date']+'-'+df['time'], format='%d-%m-%y-%H:%M:%S')

return df.iloc[-1]['y']
except (PermissionError, OSError) as err:
Expand Down
Loading

0 comments on commit db3a507

Please sign in to comment.