499 lines
55 KiB
Plaintext
499 lines
55 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "d1bb781f-f286-44cf-a3e3-181e06281487",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\"\"\"\n",
|
||
|
"INIT:connect to keithley\n",
|
||
|
"- has to be run before anything else\n",
|
||
|
"- the 'keithley' variable represents the device\n",
|
||
|
"- use keithley.write(), keithley.query(), etc to interact\n",
|
||
|
"\"\"\"\n",
|
||
|
"\n",
|
||
|
"import pyvisa\n",
|
||
|
"from time import sleep\n",
|
||
|
"from matplotlib import pyplot as plt\n",
|
||
|
"import numpy as np\n",
|
||
|
"import keithley\n",
|
||
|
"import file_io\n",
|
||
|
"import measure\n",
|
||
|
"\n",
|
||
|
"keithley = keithley.init_keithley()\n",
|
||
|
"keithley.write(\"format.data = format.ASCII\")\n",
|
||
|
"print(keithley.query(\"*IDN?\"))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "52743b4a-7e0c-4fb5-ace4-4328e5e18940",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"measure.measure_count(keithley, count=100, interval=0.05, beep_done=True)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"id": "c6a08ceb-1fe9-4517-af74-40a5006de1e8",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"67"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"name": "stderr",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Task exception was never retrieved\n",
|
||
|
"future: <Task finished name='Task-5' coro=<_ServiceBrowserBase._async_start_query_sender() done, defined at /usr/lib/python3.10/site-packages/zeroconf/_services/browser.py:442> exception=NotRunningException()>\n",
|
||
|
"Traceback (most recent call last):\n",
|
||
|
" File \"/usr/lib/python3.10/site-packages/zeroconf/_services/browser.py\", line 445, in _async_start_query_sender\n",
|
||
|
" await self.zc.async_wait_for_start()\n",
|
||
|
" File \"/usr/lib/python3.10/site-packages/zeroconf/_core.py\", line 507, in async_wait_for_start\n",
|
||
|
" raise NotRunningException\n",
|
||
|
"zeroconf._exceptions.NotRunningException\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"keithley.write(\"format.data = format.DREAL\\nformat.byteorder = format.LITTLEENDIAN\")\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 11,
|
||
|
"id": "4ffc1758-a27e-4d4f-87ad-d969da05dbad",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"0.000000e+00, 5.000000e-02, 1.000000e-01, 1.500000e-01, 2.000000e-01, 2.500000e-01, 3.000000e-01, 3.500000e-01, 4.000000e-01, 4.500000e-01, 5.000000e-01, 5.500000e-01, 6.000000e-01, 6.500000e-01, 7.000000e-01, 7.500000e-01, 8.000000e-01, 8.500000e-01, 9.000000e-01, 9.500000e-01, 1.000000e+00, 1.050000e+00, 1.100000e+00, 1.150000e+00, 1.200000e+00, 1.250000e+00, 1.300000e+00, 1.350000e+00, 1.400000e+00, 1.450000e+00, 1.500000e+00, 1.550000e+00, 1.600000e+00, 1.690891e+00, 1.710923e+00, 1.750000e+00, 1.800000e+00, 1.850000e+00, 1.900000e+00, 1.950000e+00, 2.000000e+00, 2.050000e+00, 2.100000e+00, 2.150000e+00, 2.200000e+00, 2.250000e+00, 2.300000e+00, 2.350000e+00, 2.420332e+00, 2.450000e+00, 2.500000e+00, 2.550000e+00, 2.600000e+00, 2.650000e+00, 2.700000e+00, 2.750000e+00, 2.820553e+00, 2.890843e+00, 2.910875e+00, 2.950000e+00, 3.000000e+00, 3.050000e+00, 3.100000e+00, 3.150000e+00, 3.200000e+00, 3.250000e+00, 3.300000e+00, 3.350000e+00, 3.400000e+00, 3.450000e+00, 3.500000e+00, 3.550000e+00, 3.600000e+00, 3.650000e+00, 3.700000e+00, 3.750000e+00, 3.800000e+00, 3.850000e+00, 3.900000e+00, 3.950000e+00, 4.000000e+00, 4.050000e+00, 4.100000e+00, 4.150000e+00, 4.200000e+00, 4.250000e+00, 4.300000e+00, 4.350000e+00, 4.400000e+00, 4.450000e+00, 4.500000e+00, 4.550000e+00, 4.600000e+00, 4.650000e+00, 4.700000e+00, 4.750000e+00, 4.800000e+00, 4.850000e+00, 4.900000e+00, 4.950000e+00\n",
|
||
|
"\n",
|
||
|
"[100.0]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(keithley.query(f\"print(smua.nvbuffer1.n)\"))\n",
|
||
|
"keithley.write(\"format.data = format.ASCII\")\n",
|
||
|
"buffer = keithley.query_ascii_values(f\"printbuffer(1, smua.nvbuffer1.n, smua.nvbuffer1.timestamps)\") #, datatype='d', container=np.array)\n",
|
||
|
"print(buffer)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 14,
|
||
|
"id": "b7c57345-13ff-4f52-a4b0-58561dcab0a8",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"readings: [ 4.974127e-10 -1.418591e-12 -1.573563e-12 -1.728535e-12 -1.704693e-12\n",
|
||
|
" -1.847744e-12 -1.931190e-12 -1.788139e-12 -1.871586e-12 -2.169609e-12\n",
|
||
|
" -2.074242e-12 -1.895428e-12 -1.895428e-12 -1.776218e-12 -1.990795e-12\n",
|
||
|
" -1.788139e-12 -1.811981e-12 -1.657009e-12 -1.573563e-12 -2.396107e-12\n",
|
||
|
" -2.515316e-12 -2.765656e-12 -2.825260e-12 -3.147125e-12 -2.300739e-12\n",
|
||
|
" -2.825260e-12 -3.278255e-12 -5.257130e-12 -6.818771e-12 -8.916855e-12\n",
|
||
|
" -7.712841e-12 6.437302e-12 -1.142025e-11 -1.206398e-11 -4.649043e-10\n",
|
||
|
" -3.427613e-09 -2.460408e-09 -2.340376e-09 -1.306653e-10 1.496077e-11\n",
|
||
|
" 2.933741e-11 1.953280e-09 8.579970e-10 9.226799e-12 -1.095533e-11\n",
|
||
|
" -2.508163e-11 -2.776039e-09 -8.686423e-09 4.935264e-12 1.246929e-11\n",
|
||
|
" 3.225744e-09 2.814472e-09 1.877034e-09 2.229273e-09 1.713574e-09\n",
|
||
|
" 8.355618e-10 -4.332781e-10 5.896091e-11 5.762577e-11 8.129537e-09\n",
|
||
|
" 4.044378e-09 1.771629e-09 7.849216e-10 4.098892e-10 3.390551e-10\n",
|
||
|
" 2.956390e-10 3.033876e-10 1.716256e-10 1.463890e-11 -5.078316e-12\n",
|
||
|
" -6.949902e-12 -8.106232e-12 -6.473065e-12 -4.506111e-12 4.919767e-11\n",
|
||
|
" 3.052297e-08 1.161162e-08 -9.892106e-09 -3.613818e-09 -5.004287e-09\n",
|
||
|
" -2.015829e-11 -4.183054e-11 -1.810908e-10 -2.042532e-10 -3.516316e-10\n",
|
||
|
" 5.099773e-11 1.921976e-08 -1.256589e-08 -4.242897e-10 -1.358986e-12\n",
|
||
|
" -3.445148e-12 -3.838539e-12 -4.184246e-12 -7.402897e-12 -2.840877e-10\n",
|
||
|
" -2.872229e-10 -2.730966e-10 -1.134396e-10 -4.376173e-11 -3.576279e-14], \n",
|
||
|
"timestamps: [0. 0.05 0.1 0.15 0.2 0.25 0.3 0.35\n",
|
||
|
" 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75\n",
|
||
|
" 0.8 0.85 0.9 0.95 1. 1.05 1.1 1.15\n",
|
||
|
" 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55\n",
|
||
|
" 1.6 1.690891 1.710923 1.75 1.8 1.85 1.9 1.95\n",
|
||
|
" 2. 2.05 2.1 2.15 2.2 2.25 2.3 2.35\n",
|
||
|
" 2.420332 2.45 2.5 2.55 2.6 2.65 2.7 2.75\n",
|
||
|
" 2.820553 2.890843 2.910875 2.95 3. 3.05 3.1 3.15\n",
|
||
|
" 3.2 3.25 3.3 3.35 3.4 3.45 3.5 3.55\n",
|
||
|
" 3.6 3.65 3.7 3.75 3.8 3.85 3.9 3.95\n",
|
||
|
" 4. 4.05 4.1 4.15 4.2 4.25 4.3 4.35\n",
|
||
|
" 4.4 4.45 4.5 4.55 4.6 4.65 4.7 4.75\n",
|
||
|
" 4.8 4.85 4.9 4.95 ]\n",
|
||
|
"readings: [-1.556139e-01 -1.663574e-01 -1.621783e-01 -1.685456e-01 -1.634915e-01\n",
|
||
|
" -1.711711e-01 -1.661170e-01 -1.711710e-01 -1.665548e-01 -1.742343e-01\n",
|
||
|
" -1.669925e-01 -1.724839e-01 -1.674302e-01 -1.733590e-01 -1.669922e-01\n",
|
||
|
" -1.729215e-01 -1.687431e-01 -1.772979e-01 -1.770578e-01 -1.829874e-01\n",
|
||
|
" -1.674301e-01 -1.606676e-01 -1.437982e-01 -1.322218e-01 -1.140394e-01\n",
|
||
|
" -1.151545e-01 -9.478331e-02 -6.351433e-02 -2.557993e-04 6.995752e-02\n",
|
||
|
" 1.734703e-01 1.487249e-01 1.095815e-01 1.079751e+01 1.263197e+01\n",
|
||
|
" 1.362582e+01 1.300827e+01 1.259473e+01 1.025542e+01 3.997076e+00\n",
|
||
|
" -9.946833e+00 -1.482129e+01 -1.399363e+01 -1.326294e+01 -1.132879e+01\n",
|
||
|
" -5.142632e+00 1.148345e+01 1.378293e+01 -3.400979e-01 -9.995720e-01\n",
|
||
|
" -1.749203e+00 -1.385303e+00 -1.056456e+00 -1.082226e+00 -8.675261e-01\n",
|
||
|
" -7.083023e-01 8.988955e-02 4.139638e+00 -6.590693e+00 -1.697538e+01\n",
|
||
|
" -1.556470e+01 -1.461764e+01 -1.392116e+01 -1.365366e+01 -1.351573e+01\n",
|
||
|
" -1.343544e+01 -1.343307e+01 -1.329787e+01 -1.297363e+01 -1.218130e+01\n",
|
||
|
" -1.076091e+01 -8.683739e+00 -6.708155e+00 -5.400786e+00 -7.245429e+00\n",
|
||
|
" -1.917886e+01 -1.436163e+01 1.541487e+01 1.495236e+01 1.484173e+01\n",
|
||
|
" 1.273334e+01 1.251023e+01 1.266481e+01 1.274583e+01 1.290255e+01\n",
|
||
|
" 1.080429e+01 -1.518563e+01 1.614336e+01 1.317309e+01 1.189001e+01\n",
|
||
|
" 1.109593e+01 1.094126e+01 1.113482e+01 1.139770e+01 1.268495e+01\n",
|
||
|
" 1.251639e+01 1.248731e+01 1.230242e+01 1.220341e+01 1.181950e+01], \n",
|
||
|
"timestamps: [0. 0.05 0.1 0.15 0.2 0.25 0.3 0.35\n",
|
||
|
" 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75\n",
|
||
|
" 0.8 0.85 0.9 0.95 1. 1.05 1.1 1.15\n",
|
||
|
" 1.2 1.25 1.3 1.35 1.4 1.45 1.5 1.55\n",
|
||
|
" 1.6 1.690891 1.710923 1.75 1.8 1.85 1.9 1.95\n",
|
||
|
" 2. 2.05 2.1 2.15 2.2 2.25 2.3 2.35\n",
|
||
|
" 2.420332 2.45 2.5 2.55 2.6 2.65 2.7 2.75\n",
|
||
|
" 2.820553 2.890843 2.910875 2.95 3. 3.05 3.1 3.15\n",
|
||
|
" 3.2 3.25 3.3 3.35 3.4 3.45 3.5 3.55\n",
|
||
|
" 3.6 3.65 3.7 3.75 3.8 3.85 3.9 3.95\n",
|
||
|
" 4. 4.05 4.1 4.15 4.2 4.25 4.3 4.35\n",
|
||
|
" 4.4 4.45 4.5 4.55 4.6 4.65 4.7 4.75\n",
|
||
|
" 4.8 4.85 4.9 4.95 ]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"buffer1 = measure.collect_buffer(keithley, buffer_nr=1)\n",
|
||
|
"buffer2 = measure.collect_buffer(keithley, buffer_nr=2)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"id": "3390e755-9e37-4b12-8499-9afb577d6505",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"[[ 0.000000e+00 4.974127e-10]\n",
|
||
|
" [ 5.000000e-02 -1.418591e-12]\n",
|
||
|
" [ 1.000000e-01 -1.573563e-12]\n",
|
||
|
" [ 1.500000e-01 -1.728535e-12]\n",
|
||
|
" [ 2.000000e-01 -1.704693e-12]\n",
|
||
|
" [ 2.500000e-01 -1.847744e-12]\n",
|
||
|
" [ 3.000000e-01 -1.931190e-12]\n",
|
||
|
" [ 3.500000e-01 -1.788139e-12]\n",
|
||
|
" [ 4.000000e-01 -1.871586e-12]\n",
|
||
|
" [ 4.500000e-01 -2.169609e-12]\n",
|
||
|
" [ 5.000000e-01 -2.074242e-12]\n",
|
||
|
" [ 5.500000e-01 -1.895428e-12]\n",
|
||
|
" [ 6.000000e-01 -1.895428e-12]\n",
|
||
|
" [ 6.500000e-01 -1.776218e-12]\n",
|
||
|
" [ 7.000000e-01 -1.990795e-12]\n",
|
||
|
" [ 7.500000e-01 -1.788139e-12]\n",
|
||
|
" [ 8.000000e-01 -1.811981e-12]\n",
|
||
|
" [ 8.500000e-01 -1.657009e-12]\n",
|
||
|
" [ 9.000000e-01 -1.573563e-12]\n",
|
||
|
" [ 9.500000e-01 -2.396107e-12]\n",
|
||
|
" [ 1.000000e+00 -2.515316e-12]\n",
|
||
|
" [ 1.050000e+00 -2.765656e-12]\n",
|
||
|
" [ 1.100000e+00 -2.825260e-12]\n",
|
||
|
" [ 1.150000e+00 -3.147125e-12]\n",
|
||
|
" [ 1.200000e+00 -2.300739e-12]\n",
|
||
|
" [ 1.250000e+00 -2.825260e-12]\n",
|
||
|
" [ 1.300000e+00 -3.278255e-12]\n",
|
||
|
" [ 1.350000e+00 -5.257130e-12]\n",
|
||
|
" [ 1.400000e+00 -6.818771e-12]\n",
|
||
|
" [ 1.450000e+00 -8.916855e-12]\n",
|
||
|
" [ 1.500000e+00 -7.712841e-12]\n",
|
||
|
" [ 1.550000e+00 6.437302e-12]\n",
|
||
|
" [ 1.600000e+00 -1.142025e-11]\n",
|
||
|
" [ 1.690891e+00 -1.206398e-11]\n",
|
||
|
" [ 1.710923e+00 -4.649043e-10]\n",
|
||
|
" [ 1.750000e+00 -3.427613e-09]\n",
|
||
|
" [ 1.800000e+00 -2.460408e-09]\n",
|
||
|
" [ 1.850000e+00 -2.340376e-09]\n",
|
||
|
" [ 1.900000e+00 -1.306653e-10]\n",
|
||
|
" [ 1.950000e+00 1.496077e-11]\n",
|
||
|
" [ 2.000000e+00 2.933741e-11]\n",
|
||
|
" [ 2.050000e+00 1.953280e-09]\n",
|
||
|
" [ 2.100000e+00 8.579970e-10]\n",
|
||
|
" [ 2.150000e+00 9.226799e-12]\n",
|
||
|
" [ 2.200000e+00 -1.095533e-11]\n",
|
||
|
" [ 2.250000e+00 -2.508163e-11]\n",
|
||
|
" [ 2.300000e+00 -2.776039e-09]\n",
|
||
|
" [ 2.350000e+00 -8.686423e-09]\n",
|
||
|
" [ 2.420332e+00 4.935264e-12]\n",
|
||
|
" [ 2.450000e+00 1.246929e-11]\n",
|
||
|
" [ 2.500000e+00 3.225744e-09]\n",
|
||
|
" [ 2.550000e+00 2.814472e-09]\n",
|
||
|
" [ 2.600000e+00 1.877034e-09]\n",
|
||
|
" [ 2.650000e+00 2.229273e-09]\n",
|
||
|
" [ 2.700000e+00 1.713574e-09]\n",
|
||
|
" [ 2.750000e+00 8.355618e-10]\n",
|
||
|
" [ 2.820553e+00 -4.332781e-10]\n",
|
||
|
" [ 2.890843e+00 5.896091e-11]\n",
|
||
|
" [ 2.910875e+00 5.762577e-11]\n",
|
||
|
" [ 2.950000e+00 8.129537e-09]\n",
|
||
|
" [ 3.000000e+00 4.044378e-09]\n",
|
||
|
" [ 3.050000e+00 1.771629e-09]\n",
|
||
|
" [ 3.100000e+00 7.849216e-10]\n",
|
||
|
" [ 3.150000e+00 4.098892e-10]\n",
|
||
|
" [ 3.200000e+00 3.390551e-10]\n",
|
||
|
" [ 3.250000e+00 2.956390e-10]\n",
|
||
|
" [ 3.300000e+00 3.033876e-10]\n",
|
||
|
" [ 3.350000e+00 1.716256e-10]\n",
|
||
|
" [ 3.400000e+00 1.463890e-11]\n",
|
||
|
" [ 3.450000e+00 -5.078316e-12]\n",
|
||
|
" [ 3.500000e+00 -6.949902e-12]\n",
|
||
|
" [ 3.550000e+00 -8.106232e-12]\n",
|
||
|
" [ 3.600000e+00 -6.473065e-12]\n",
|
||
|
" [ 3.650000e+00 -4.506111e-12]\n",
|
||
|
" [ 3.700000e+00 4.919767e-11]\n",
|
||
|
" [ 3.750000e+00 3.052297e-08]\n",
|
||
|
" [ 3.800000e+00 1.161162e-08]\n",
|
||
|
" [ 3.850000e+00 -9.892106e-09]\n",
|
||
|
" [ 3.900000e+00 -3.613818e-09]\n",
|
||
|
" [ 3.950000e+00 -5.004287e-09]\n",
|
||
|
" [ 4.000000e+00 -2.015829e-11]\n",
|
||
|
" [ 4.050000e+00 -4.183054e-11]\n",
|
||
|
" [ 4.100000e+00 -1.810908e-10]\n",
|
||
|
" [ 4.150000e+00 -2.042532e-10]\n",
|
||
|
" [ 4.200000e+00 -3.516316e-10]\n",
|
||
|
" [ 4.250000e+00 5.099773e-11]\n",
|
||
|
" [ 4.300000e+00 1.921976e-08]\n",
|
||
|
" [ 4.350000e+00 -1.256589e-08]\n",
|
||
|
" [ 4.400000e+00 -4.242897e-10]\n",
|
||
|
" [ 4.450000e+00 -1.358986e-12]\n",
|
||
|
" [ 4.500000e+00 -3.445148e-12]\n",
|
||
|
" [ 4.550000e+00 -3.838539e-12]\n",
|
||
|
" [ 4.600000e+00 -4.184246e-12]\n",
|
||
|
" [ 4.650000e+00 -7.402897e-12]\n",
|
||
|
" [ 4.700000e+00 -2.840877e-10]\n",
|
||
|
" [ 4.750000e+00 -2.872229e-10]\n",
|
||
|
" [ 4.800000e+00 -2.730966e-10]\n",
|
||
|
" [ 4.850000e+00 -1.134396e-10]\n",
|
||
|
" [ 4.900000e+00 -4.376173e-11]\n",
|
||
|
" [ 4.950000e+00 -3.576279e-14]]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"print(buffer1)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "2beb660c-62b7-4d66-8162-601dfabd53f1",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"plt.plot(buffer1)\n",
|
||
|
"plt.plot(buffer2)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"id": "a96e2c53-67fa-49ac-87b4-22c34190a2b7",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAisAAAGdCAYAAADT1TPdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABfAElEQVR4nO3deZxcZZkv8N+ptfdOL+kt6XR2to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WGBbtPxsXSYqCgxWyHLU6bVpimuBfGRWOG6/2Om2gRisENkWgxWynL7RyJTZ+kpv2vtNpxvI5dRuAzGzUqw4FI6oODBYIcvpGZ4CALTWlKW9n8spMyvGMyPyvtoC22BY6C5qVDw4FI6oODBYIcs5OTwJAGidlT5YiQ2FM/6xZSurS1OzAgBTQQYrxSgQ5FA4omLAYIUsp3somlmpzZBZyaF1OaQW2CrqqcsAt4KKVZCZFaKiwGCFLEfdBqotT3s/2Q2UTS1CUFNg63Ao8LhYt1LMtBNswwxWiGyLwQpZjroNZDizkk03UOTiJetdylyctVLMtN1AzKwQ2ReDFbKUcFjg1Eg0szIrU2Yl+3H7QU3NCgCevFzkAuwGIioKDFbIUvrHfQiEBBwK0FSdvnU5l8xKUFOzAoCD4YqcthuIwQqRfTFYIUuR9Sqzq71wO9N/ezqnMxRObgNx5H5R45wVouLAYIUs5eSQseJaIBZwZNMNFNTMWQG4DVTsOMGWqDgwWCFL6TZYXAvk1g0UCsW6gQBoTl42P7PiD4Z1NRY0fdqzgVhgS2RfDFbIUoy2LQPTq1mRBbZ
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"38"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from IPython.display import clear_output\n",
|
||
|
"\n",
|
||
|
"smua_settings = \"\"\"\n",
|
||
|
"display.clear() \n",
|
||
|
"display.settext('starting')\n",
|
||
|
"smua.reset()\n",
|
||
|
"smua.measure.autorangev = smua.AUTORANGE_ON\n",
|
||
|
"smua.source.output = smua.OUTPUT_OFF\n",
|
||
|
"-- max 20 V expected\n",
|
||
|
"smua.measure.rangev = 20\n",
|
||
|
"\"\"\"\n",
|
||
|
"measure.run_lua(keithley, \"smua_reset.lua\")\n",
|
||
|
"keithley.write(\"smua.source.output = smua.OUTPUT_ON\")\n",
|
||
|
"data = []\n",
|
||
|
"for i in range(200):\n",
|
||
|
" data.append(tuple(float(v) for v in keithley.query(\"print(smua.measure.v())\").strip('\\n').split('\\t')))\n",
|
||
|
" # print(i, data[-1])\n",
|
||
|
" clear_output(wait=True)\n",
|
||
|
" plt.plot(data)\n",
|
||
|
" plt.show()\n",
|
||
|
" sleep(0.05)\n",
|
||
|
"\n",
|
||
|
"keithley.write(\"smua.source.output = smua.OUTPUT_OFF\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 13,
|
||
|
"id": "4e78e53e-a34d-4425-906e-0123a502d1f5",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"ename": "VisaIOError",
|
||
|
"evalue": "VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.",
|
||
|
"output_type": "error",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mVisaIOError\u001b[0m Traceback (most recent call last)",
|
||
|
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mkeithley\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread_raw\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
|
||
|
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pyvisa/resources/messagebased.py:405\u001b[0m, in \u001b[0;36mMessageBasedResource.read_raw\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 388\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mread_raw\u001b[39m(\u001b[38;5;28mself\u001b[39m, size: Optional[\u001b[38;5;28mint\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mbytes\u001b[39m:\n\u001b[1;32m 389\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Read the unmodified string sent from the instrument to the computer.\u001b[39;00m\n\u001b[1;32m 390\u001b[0m \n\u001b[1;32m 391\u001b[0m \u001b[38;5;124;03m In contrast to read(), no termination characters are stripped.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 403\u001b[0m \n\u001b[1;32m 404\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 405\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mbytes\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_raw\u001b[49m\u001b[43m(\u001b[49m\u001b[43msize\u001b[49m\u001b[43m)\u001b[49m)\n",
|
||
|
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pyvisa/resources/messagebased.py:442\u001b[0m, in \u001b[0;36mMessageBasedResource._read_raw\u001b[0;34m(self, size)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m status \u001b[38;5;241m==\u001b[39m loop_status:\n\u001b[1;32m 436\u001b[0m logger\u001b[38;5;241m.\u001b[39mdebug(\n\u001b[1;32m 437\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m - reading \u001b[39m\u001b[38;5;132;01m%d\u001b[39;00m\u001b[38;5;124m bytes (last status \u001b[39m\u001b[38;5;132;01m%r\u001b[39;00m\u001b[38;5;124m)\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 438\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_resource_name,\n\u001b[1;32m 439\u001b[0m size,\n\u001b[1;32m 440\u001b[0m status,\n\u001b[1;32m 441\u001b[0m )\n\u001b[0;32m--> 442\u001b[0m chunk, status \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvisalib\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msession\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msize\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 443\u001b[0m ret\u001b[38;5;241m.\u001b[39mextend(chunk)\n\u001b[1;32m 444\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m errors\u001b[38;5;241m.\u001b[39mVisaIOError \u001b[38;5;28;01mas\u001b[39;00m e:\n",
|
||
|
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pyvisa_py/highlevel.py:519\u001b[0m, in \u001b[0;36mPyVisaLibrary.read\u001b[0;34m(self, session, count)\u001b[0m\n\u001b[1;32m 513\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m:\n\u001b[1;32m 514\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (\n\u001b[1;32m 515\u001b[0m \u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 516\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandle_return_value(session, StatusCode\u001b[38;5;241m.\u001b[39merror_invalid_object),\n\u001b[1;32m 517\u001b[0m )\n\u001b[0;32m--> 519\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m data, \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_return_value\u001b[49m\u001b[43m(\u001b[49m\u001b[43msession\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstatus_code\u001b[49m\u001b[43m)\u001b[49m\n",
|
||
|
"File \u001b[0;32m/usr/lib/python3.10/site-packages/pyvisa/highlevel.py:251\u001b[0m, in \u001b[0;36mVisaLibraryBase.handle_return_value\u001b[0;34m(self, session, status_code)\u001b[0m\n\u001b[1;32m 248\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_last_status_in_session[session] \u001b[38;5;241m=\u001b[39m rv\n\u001b[1;32m 250\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m rv \u001b[38;5;241m<\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 251\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m errors\u001b[38;5;241m.\u001b[39mVisaIOError(rv)\n\u001b[1;32m 253\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m rv \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39missue_warning_on:\n\u001b[1;32m 254\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m session \u001b[38;5;129;01mand\u001b[39;00m rv \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ignore_warning_in_session[session]:\n",
|
||
|
"\u001b[0;31mVisaIOError\u001b[0m: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed."
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"keithley.read_raw()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "d597ff99-d56d-45c4-8e1c-3ee1eebfb565",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"measure.run_lua(keithley, \"buffer_reset.lua\")\n",
|
||
|
"measure.run_lua(keithley, \"smua_reset.lua\")\n",
|
||
|
"keithley.write(\"smua.measure.count = 100\")\n",
|
||
|
"keithley.write(\"smua.measure.interval = 0.05\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "7e7adaa9-e81d-498b-9e01-b838643a1050",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
" keithley.write(\"smua.measure.iv(smua.nvbuffer1, smua.nvbuffer2)\")\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "aafa7d7e-dedd-4546-bf80-b247eb947402",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"keithley.write(\"format.data = format.DREAL\\nformat.byteorder = format.LITTLEENDIAN\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "40dbecd1-7405-4a6c-81d9-0d3f407c0efc",
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"keithley.query_binary_values(\"printbuffer(1, smua.nvbuffer1.n, smua.nvbuffer1)\", container=)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "3979a9de-f4b9-448e-a2f3-b36cbea9658c",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "60431b81-a860-4964-8f60-0aca8fdde36a",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3 (ipykernel)",
|
||
|
"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.10.10"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|