Skip to content

Commit

Permalink
Merge pull request #1409 from sohailc/driver/keithley_s64
Browse files Browse the repository at this point in the history
Driver/keithley s46
  • Loading branch information
sohailc authored Dec 7, 2018
2 parents 1483359 + 86be1ff commit 7e38ca5
Show file tree
Hide file tree
Showing 4 changed files with 775 additions and 0 deletions.
346 changes: 346 additions & 0 deletions docs/examples/driver_examples/QCodes example with Keithley S46.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Tektronix Keithley S46\n",
"\n",
"The S46 is an RF swicth with four relays \"A\" to \"D\". These relays either have four or six poles, depending on the instrument model. Each pole constitutes a channel and can either be \"open\" or \"closed\". Channel \"A1\" is attached to the first pole on relay \"A\", channel \"B2\" is attached to the second pole of relay \"B\", etc... \n",
"\n",
"Channels \"A1\" to \"D6\" are all \"normally open\". Only one channel per relay may be closed. \n",
"\n",
"Additionally, there are optionally eight relays \"R1\" to \"R8\" which are two pole relays. One pole is \"normally closed\" and the other \"normally open\". For these relays, we have one channel per relay, so \"R1\" is both a channel and a relay. Upon closing the channel, the normally open pole will close. \n",
"\n",
"In this notebook, we have verified with a multi-meter that channels indeed open and close as expected. \n",
"\n",
"Note: We have performed tests with a six pole instrument. Although it is expected that this driver should work with a four pole instrument, this has not been verified due to a lack of instrument availability "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from qcodes.instrument_drivers.tektronix.Keithley_s46 import S46, LockAcquisitionError"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"s46 = S46(\"s2\", \"GPIB0::7::INSTR\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'D1', 'D2', 'D3', 'D4', 'D5', 'D6', 'R5', 'R8']\n",
"26\n"
]
}
],
"source": [
"print(s46.available_channels)\n",
"print(len(s46.available_channels))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['A2', 'B1']"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.closed_channels()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"s46.open_all_channels()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.closed_channels()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'open'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.A1()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"s46.A1(\"close\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'close'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.A1()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['A1']"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.closed_channels()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Relay A is already in use by channel 1\n"
]
}
],
"source": [
"try: \n",
" s46.A2(\"close\")\n",
" raise(\"We should not be here\")\n",
"except LockAcquisitionError as e: \n",
" print(e)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"s46.A1(\"open\")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"s46.A2(\"close\")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Relay A is already in use by channel 2\n"
]
}
],
"source": [
"try: \n",
" s46.A1(\"close\")\n",
" raise(\"We should not be here\")\n",
"except LockAcquisitionError as e: \n",
" print(e)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"s46.B1(\"close\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Relay B is already in use by channel 7\n"
]
}
],
"source": [
"try: \n",
" s46.B2(\"close\")\n",
" raise(\"We should not be here\")\n",
"except LockAcquisitionError as e: \n",
" print(e)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['A2', 'B1']"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.closed_channels()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"s46.open_all_channels()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"s46.closed_channels()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"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.7"
},
"nbsphinx": {
"execute": "never"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 7e38ca5

Please sign in to comment.