Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
labcode
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CST
labcode
Commits
010a6244
Commit
010a6244
authored
9 months ago
by
Alexandros Asonitis
Browse files
Options
Downloads
Patches
Plain Diff
keithley class works!
parent
d19a3a71
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
TLM_tool/keithley224_lib.py
+13
-1
13 additions, 1 deletion
TLM_tool/keithley224_lib.py
TLM_tool/keithley_first.ipynb
+69
-81
69 additions, 81 deletions
TLM_tool/keithley_first.ipynb
with
82 additions
and
82 deletions
TLM_tool/keithley224.py
→
TLM_tool/keithley224
_lib
.py
+
13
−
1
View file @
010a6244
import
pyvisa
class
K
eithley224
(
object
):
class
k
eithley224
(
object
):
"""
Control Class for the Keithley 224
"""
...
...
@@ -125,7 +125,19 @@ class Keithley224(object):
self
.
inst
.
control_ren
(
0
)
# Return to local Mode see codes above
self
.
inst
.
close
()
def
read_parameters
(
self
):
"""
Sends the setted data back to the software (Without prefix) current-voltage-wait_time
"""
str_response
=
self
.
inst
.
query
(
"
G1X
"
)
str_response
=
str_response
.
strip
()
values
=
str_response
.
split
(
'
,
'
)
I
=
float
(
values
[
0
])
V
=
float
(
values
[
1
])
W
=
float
(
values
[
2
])
return
I
,
V
,
W
...
...
This diff is collapsed.
Click to expand it.
TLM_tool/keithley_first.ipynb
+
69
−
81
View file @
010a6244
...
...
@@ -2,135 +2,123 @@
"cells": [
{
"cell_type": "code",
"execution_count":
6
,
"id": "
29f2491b-d6fe-4d60-88f8-7c2341b404fe
",
"execution_count":
1
,
"id": "
4d4cbcef-908f-4cd0-89be-790fccb51cb3
",
"metadata": {},
"outputs": [],
"source": [
"import pyvisa\n",
"import time"
"import keithley224_lib \n",
"\n",
"k224 = keithley224_lib.keithley224()"
]
},
{
"cell_type": "code",
"execution_count":
7
,
"id": "
9bd148de-3fbb-44a7-98b9-408b83f4226
c",
"execution_count":
2
,
"id": "
0c6838b
c",
"metadata": {},
"outputs": [],
"source": [
"rm =pyvisa.ResourceManager()\n",
"rm.list_resources()\n",
"k224= rm.open_resource('GPIB0::15::INSTR')\n",
"k224.timeout = None"
"k224.set_current(50e-3)"
]
},
{
"cell_type": "code",
"execution_count":
11
,
"id": "
33cf3ace-54b1-44ab-8be5-5d32ea2b4ca8
",
"execution_count":
3
,
"id": "
b8ed02bc
",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"10"
"outputs": [],
"source": [
"\n",
"k224.set_time(999e-3)"
]
},
"execution_count": 11,
{
"cell_type": "code",
"execution_count": 4,
"id": "d01b65c4",
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"\n",
"k224.write(\"I7.5E-2X\")"
"k224.display(0)"
]
},
{
"cell_type": "code",
"execution_count":
9
,
"id": "
440d2ced-b449-4ca6-bd2d-ef7c9955a346
",
"execution_count":
5
,
"id": "
0f0ae471
",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<StatusCode.success: 0>"
"outputs": [],
"source": [
"k224.set_operation(1)"
]
},
"execution_count": 9,
{
"cell_type": "code",
"execution_count": 6,
"id": "077207eb",
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"k224.
control_ren(3
)"
"k224.
set_range(0
)"
]
},
{
"cell_type": "code",
"execution_count":
10
,
"id": "
65f1c08d-e8d6-4af6-957c-6b502bfa364
c",
"execution_count":
7
,
"id": "
871f6c1
c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\nVI_GPIB_REN_DEASSERT = 0\\nVI_GPIB_REN_ASSERT = 1\\nVI_GPIB_REN_DEASSERT_GTL = 2\\nVI_GPIB_REN_ASSERT_ADDRESS = 3\\nVI_GPIB_REN_ASSERT_LLO = 4\\nVI_GPIB_REN_ASSERT_ADDRESS_LLO = 5\\nVI_GPIB_REN_ADDRESS_GTL = 6\\n'"
"outputs": [],
"source": [
"k224.set_voltage_limit(5)"
]
},
"execution_count": 10,
{
"cell_type": "code",
"execution_count": 8,
"id": "ae19a392",
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"\"\"\"\n",
"VI_GPIB_REN_DEASSERT = 0\n",
"VI_GPIB_REN_ASSERT = 1\n",
"VI_GPIB_REN_DEASSERT_GTL = 2\n",
"VI_GPIB_REN_ASSERT_ADDRESS = 3\n",
"VI_GPIB_REN_ASSERT_LLO = 4\n",
"VI_GPIB_REN_ASSERT_ADDRESS_LLO = 5\n",
"VI_GPIB_REN_ADDRESS_GTL = 6\n",
"\"\"\"\n",
"\n",
"# in comparison with the manual and the pyvisa constants"
"i,v,w = k224.read_parameters()"
]
},
{
"cell_type": "code",
"execution_count": 1
2
,
"id": "
9f123901-72cb-46ca-bff7-82336e6f5fa1
",
"execution_count": 1
1
,
"id": "
da3d49f4
",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5"
"name": "stdout",
"output_type": "stream",
"text": [
"0.05\n",
"5.0\n",
"0.999\n"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"k224.write(\"D0X\")"
"print(i)\n",
"print(v)\n",
"print(w)"
]
},
{
"cell_type": "code",
"execution_count":
null
,
"id": "
4d4cbcef-908f-4cd0-89be-790fccb51cb3
",
"execution_count":
12
,
"id": "
80ea11ce
",
"metadata": {},
"outputs": [],
"source": []
"source": [
"del k224"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3
(ipykernel)
",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
...
...
@@ -144,7 +132,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.1
2.0
"
"version": "3.1
1.1
"
}
},
"nbformat": 4,
...
...
%% Cell type:code id:
29f2491b-d6fe-4d60-88f8-7c2341b404fe
tags:
%% Cell type:code id:
4d4cbcef-908f-4cd0-89be-790fccb51cb3
tags:
```
python
import
pyvisa
import
time
import
keithley224_lib
k224
=
keithley224_lib
.
keithley224
()
```
%% Cell type:code id:
9bd148de-3fbb-44a7-98b9-408b83f4226
c tags:
%% Cell type:code id:
0c6838b
c tags:
```
python
rm
=
pyvisa
.
ResourceManager
()
rm
.
list_resources
()
k224
=
rm
.
open_resource
(
'
GPIB0::15::INSTR
'
)
k224
.
timeout
=
None
k224
.
set_current
(
50e-3
)
```
%% Cell type:code id:
33cf3ace-54b1-44ab-8be5-5d32ea2b4ca8
tags:
%% Cell type:code id:
b8ed02bc
tags:
```
python
k224
.
write
(
"
I7.5E-2X
"
)
k224
.
set_time
(
999e-3
)
```
%%
Output
%%
Cell type:code id:d01b65c4 tags:
10
```
python
k224
.
display
(
0
)
```
%% Cell type:code id:
440d2ced-b449-4ca6-bd2d-ef7c9955a346
tags:
%% Cell type:code id:
0f0ae471
tags:
```
python
k224
.
control_re
n
(
3
)
k224
.
set_operatio
n
(
1
)
```
%%
Output
%%
Cell type:code id:077207eb tags:
<StatusCode.success: 0>
```
python
k224
.
set_range
(
0
)
```
%% Cell type:code id:
65f1c08d-e8d6-4af6-957c-6b502bfa364
c tags:
%% Cell type:code id:
871f6c1
c tags:
```
python
"""
VI_GPIB_REN_DEASSERT = 0
VI_GPIB_REN_ASSERT = 1
VI_GPIB_REN_DEASSERT_GTL = 2
VI_GPIB_REN_ASSERT_ADDRESS = 3
VI_GPIB_REN_ASSERT_LLO = 4
VI_GPIB_REN_ASSERT_ADDRESS_LLO = 5
VI_GPIB_REN_ADDRESS_GTL = 6
"""
# in comparison with the manual and the pyvisa constants
k224
.
set_voltage_limit
(
5
)
```
%%
Output
%%
Cell type:code id:ae19a392 tags:
'\nVI_GPIB_REN_DEASSERT = 0\nVI_GPIB_REN_ASSERT = 1\nVI_GPIB_REN_DEASSERT_GTL = 2\nVI_GPIB_REN_ASSERT_ADDRESS = 3\nVI_GPIB_REN_ASSERT_LLO = 4\nVI_GPIB_REN_ASSERT_ADDRESS_LLO = 5\nVI_GPIB_REN_ADDRESS_GTL = 6\n'
```
python
i
,
v
,
w
=
k224
.
read_parameters
()
```
%% Cell type:code id:
9f123901-72cb-46ca-bff7-82336e6f5fa1
tags:
%% Cell type:code id:
da3d49f4
tags:
```
python
k224
.
write
(
"
D0X
"
)
print
(
i
)
print
(
v
)
print
(
w
)
```
%% Output
5
0.05
5.0
0.999
%% Cell type:code id:
4d4cbcef-908f-4cd0-89be-790fccb51cb3
tags:
%% Cell type:code id:
80ea11ce
tags:
```
python
del
k224
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment