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
7e46f090
Commit
7e46f090
authored
Sep 5, 2023
by
JupyterHub User
Browse files
Options
Downloads
Patches
Plain Diff
implemented 5 points CTLM with plots and txt file
parent
58383bec
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
hp4155/measurements.py
+84
-41
84 additions, 41 deletions
hp4155/measurements.py
hp4155/working_examples/pandas.ipynb
+20
-6
20 additions, 6 deletions
hp4155/working_examples/pandas.ipynb
with
104 additions
and
47 deletions
hp4155/measurements.py
+
84
−
41
View file @
7e46f090
...
@@ -131,16 +131,28 @@ def stress_sampling():
...
@@ -131,16 +131,28 @@ def stress_sampling():
del
device
del
device
# These are some help functions for the setup of the CTLM measurement
def
single_ctlm
(
time
,
start
=-
50
*
10
**
(
-
3
),
stop
=
50
*
10
**
(
-
3
),
step
=
10
**
(
-
3
),
comp
=
10
V
):
#prepare full measurement
def
ctlm
(
field_name
=
'
M00
'
,
time
=
'
MED
'
,
start
=-
50
*
10
**
(
-
3
),
stop
=
50
*
10
**
(
-
3
),
step
=
10
**
(
-
3
),
comp
=
10
V
,
distances
=
(
5
,
10
,
15
,
25
,
45
)):
#connect to the device
device
=
module
.
HP4155a
(
'
GPIB0::17::INSTR
'
)
#initilize figure
plt
.
figure
()
plt
.
xlabel
(
'
Voltage(V)
'
)
plt
.
ylabel
(
'
Current(A)
'
)
plt
.
title
(
"
CTLM plot
"
)
plt
.
legend
()
#execute five measurements
for
j
in
range
(
len
(
distances
)):
#setup
device
.
reset
()
device
.
reset
()
device
.
inst
.
write
(
"
:PAGE:MEAS
"
)
device
.
inst
.
write
(
"
:PAGE:MEAS
"
)
device
.
inst
.
write
(
"
:PAGE:CHAN:MODE SWEEP
"
)
#go to sweep page and prepare sweep measurement
device
.
inst
.
write
(
"
:PAGE:CHAN:MODE SWEEP
"
)
#go to sweep page and prepare sweep measurement
#setup smus
#smu1 is constant and common
#smu1 is constant and common
device
.
smu_mode_meas
(
1
,
'
COMM
'
)
device
.
smu_mode_meas
(
1
,
'
COMM
'
)
device
.
smu_function_sweep
(
1
,
'
CONS
'
)
device
.
smu_function_sweep
(
1
,
'
CONS
'
)
...
@@ -179,6 +191,7 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V)
...
@@ -179,6 +191,7 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V)
while
device
.
operation_completed
()
==
False
:
while
device
.
operation_completed
()
==
False
:
pass
pass
voltage_values
=
device
.
return_data
(
'
V3
'
)
voltage_values
=
device
.
return_data
(
'
V3
'
)
current_values
=
device
.
return_data
(
'
I3
'
)
current_values
=
device
.
return_data
(
'
I3
'
)
...
@@ -187,3 +200,33 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V)
...
@@ -187,3 +200,33 @@ def single_ctlm(time,start=-50*10**(-3),stop=50*10**(-3),step=10**(-3),comp=10V)
for
i
in
range
(
len
(
voltage_values
)):
for
i
in
range
(
len
(
voltage_values
)):
resistance_values
.
append
(
voltage_values
[
i
]
/
current_values
[
i
])
resistance_values
.
append
(
voltage_values
[
i
]
/
current_values
[
i
])
#plot results of the single measurement
plt
.
plot
(
voltage_values
,
current_values
,
label
=
f
"
distance=
{
distances
[
j
]
}
"
)
#save measurement as txt file
#add title to the results
header
=
[
'
Voltage(V)
'
,
'
Current(A)
'
,
'
Resistance(Ohm)
'
]
data
=
{
header
[
0
]:
voltage_values
,
header
[
1
]:
current_values
,
header
[
2
]:
resisance_values
}
df
=
pd
.
DataFrame
(
data
)
print
(
df
)
date
=
str
(
datetime
.
today
().
replace
(
microsecond
=
0
))
file_name
=
f
"
{
field_name
}
_CTLM_
{
j
+
1
}
.txt
"
#path = f"\\FILESERVER\public\Datentransfer\Asonitis, Alexandros\{file_name}"
#export DataFrame to text file (keep header row and index column)
with
open
(
file_n
,
'
a
'
)
as
f
:
f
.
write
(
'
title
\n
'
)
df_string
=
df
.
to_string
()
f
.
write
(
df_string
)
#wait for confirmation from user after a measurement is done
while
True
:
answer
=
input
(
'
please press enter to continue with the next measurement or finish after the last measurement!
'
)
if
answer
==
""
:
break
#close the connection and plot all the diagramms
plt
.
show
()
del
device
This diff is collapsed.
Click to expand it.
hp4155/working_examples/pandas.ipynb
+
20
−
6
View file @
7e46f090
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
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