Skip to content

Commit

Permalink
Merge pull request #272 from QDevil/qswitch
Browse files Browse the repository at this point in the history
QSwitch: Example of Monitor, autosave, & close eth connection
  • Loading branch information
jenshnielsen authored Nov 22, 2023
2 parents e08c7ee + 222af57 commit f76885a
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 2 deletions.
49 changes: 47 additions & 2 deletions docs/examples/QDevil/QSwitch/Debugging.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@
"pp.pprint(qswitch.get_recorded_scpi_commands())"
]
},
{
"cell_type": "markdown",
"id": "588fabac",
"metadata": {},
"source": [
"## Connections"
]
},
{
"cell_type": "markdown",
"id": "4a00d73e-88e0-439c-9b80-15aaffaf2064",
Expand All @@ -103,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"id": "37ac76f2",
"metadata": {},
"outputs": [
Expand All @@ -113,7 +121,7 @@
"('ASRL/dev/ttyS0::INSTR', 'ASRL/dev/ttyACM0::INSTR')"
]
},
"execution_count": 6,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -124,6 +132,43 @@
"rm.list_resources()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "b80a56eb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Connected to: Quantum Machines QSwitch (serial:1, firmware:0.162) in 0.06s\n"
]
}
],
"source": [
"from qcodes_contrib_drivers.drivers.QDevil import QSwitch\n",
"qswitch = QSwitch.QSwitch('switch', visalib='@py', address='ASRL/dev/ttyACM0::INSTR')"
]
},
{
"cell_type": "markdown",
"id": "c3119260",
"metadata": {},
"source": [
"If a python process hangs and blocks the ethernet connection to the QSwitch, you can force the QSwitch to drop the connection:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "33c3719f",
"metadata": {},
"outputs": [],
"source": [
"qswitch.write('system:comm:lan:close')"
]
},
{
"cell_type": "markdown",
"id": "d6bdb22e",
Expand Down
63 changes: 63 additions & 0 deletions docs/examples/QDevil/QSwitch/Usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,69 @@
"qswitch.close_relay(5, 0)\n",
"qswitch.open_relays([(5, 2), (5, 9)])"
]
},
{
"cell_type": "markdown",
"id": "800db438",
"metadata": {},
"source": [
"## Monitors"
]
},
{
"cell_type": "markdown",
"id": "7b49f273",
"metadata": {},
"source": [
"There is a pseudo parameter dedicated to monitoring:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f48f9830",
"metadata": {},
"outputs": [],
"source": [
"qswitch.overview()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b5030c09",
"metadata": {},
"outputs": [],
"source": [
"monitor = qcodes.Monitor(qswitch.overview)"
]
},
{
"cell_type": "markdown",
"id": "f2f5d12a",
"metadata": {},
"source": [
"## Autosave"
]
},
{
"cell_type": "markdown",
"id": "b4fcd850",
"metadata": {},
"source": [
"When turning on autosave, the state will be restored over restart."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dfdba65e",
"metadata": {},
"outputs": [],
"source": [
"qswitch.auto_save('on')\n",
"qswitch.auto_save('off')"
]
}
],
"metadata": {
Expand Down

0 comments on commit f76885a

Please sign in to comment.