Skip to main content
Homepage
Explore
Search or go to…
/
Sign in
Explore
Primary navigation
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
?
Collapse sidebar
Snippets
Groups
Projects
Show more breadcrumbs
CST
labcode
Commits
f9d54fc7
Commit
f9d54fc7
authored
8 months ago
by
Alexandros Asonitis
Browse files
Options
Downloads
Patches
Plain Diff
Debugging Custom SMU Part 2 (Day 2)
parent
dbdf60e4
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/Custom_SMU/debug.ipynb
+42
-39
42 additions, 39 deletions
hp4155/Custom_SMU/debug.ipynb
hp4155/Custom_SMU/lib/help.py
+7
-7
7 additions, 7 deletions
hp4155/Custom_SMU/lib/help.py
with
49 additions
and
46 deletions
hp4155/Custom_SMU/debug.ipynb
+
42
−
39
View file @
f9d54fc7
...
...
@@ -3,13 +3,13 @@
{
"cell_type": "code",
"execution_count": 1,
"id": "
8faef648-e31f-48c5-a101-d6070b2d1990
",
"id": "
70e36e46-2332-484d-9576-22f869e335bc
",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
e492303ec1f2459e9f63b8498bc1129b
",
"model_id": "
aac9d803eab04d8487de412700c8bd31
",
"version_major": 2,
"version_minor": 0
},
...
...
@@ -23,7 +23,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
85f2ead829654b5c857966936ec6680
f",
"model_id": "
3f50962b21b94d6c88e10a4ad2e15d1
f",
"version_major": 2,
"version_minor": 0
},
...
...
@@ -37,7 +37,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
5c7be71e5aaf426497bd37ba6a4ee6d4
",
"model_id": "
f04dcfa5ab3c442f8c987de79a4b826c
",
"version_major": 2,
"version_minor": 0
},
...
...
@@ -275,7 +275,7 @@
" # These are correcly defined and include the plotted ones\n",
" values = {}\n",
" for variable in variables:\n",
" key =
f\"{
variable['name']
} ({
variable['unit']
}
)\"\n",
" key = variable['name']
+\"(\"+
variable['unit']
+\"
)\"\n",
" values[key] = device.return_values(variable['name'])\n",
"\n",
" plot_results(values,device)\n",
...
...
@@ -283,7 +283,7 @@
" # Save results\n",
" df = pd.DataFrame(values)\n",
"\n",
" filename = f\"{sample_series}_{field}_{dut}_{measurement_name}.txt\"\n",
" filename = f\"{sample_series}_{field}_{dut}_{measurement_name}
_sweep
.txt\"\n",
" txt_file = create_file(filename)\n",
" ini_file = os.path.splitext(txt_file)[0]+'.ini'\n",
"\n",
...
...
@@ -316,53 +316,53 @@
" for i, smu in enumerate(smus):\n",
" config.add_section(f\"SMU{i+1}\")\n",
" for key,value in smu.items():\n",
" config.set(f\"SMU{i+1}\",key,value)\n",
" config.set(f\"SMU{i+1}\",key,
str(
value)
)
\n",
"\n",
" # Secondly the user functions\n",
" config.add_section(\"USER FUNCTIONS\")\n",
" for i, user_function in enumerate(user_functions):\n",
" config.add_section(f\"USER FUNCTION {i+1}\")\n",
" for key,value in user_function.items():\n",
" config.set(f\"USER FUNCTION {i+1}\",key,value)\n",
" config.set(f\"USER FUNCTION {i+1}\",key,
str(
value)
)
\n",
"\n",
" # Then the 3rd page\n",
" config.add_section(\"VAR1\")\n",
" for key,value in var1.items():\n",
" config.set(\"VAR1\",key,value)\n",
" config.set(\"VAR1\",key,
str(
value)
)
\n",
"\n",
" config.add_section(\"VAR2\")\n",
" for key,value in var2.items():\n",
" config.set(\"VAR2\",key,value)\n",
" config.set(\"VAR2\",key,
str(
value)
)
\n",
" \n",
" config.add_section(\"VARD\")\n",
" for key, value in vard.items():\n",
" config.set(\"VARD\",key,value)\n",
" config.set(\"VARD\",key,
str(
value)
)
\n",
"\n",
" config.add_section(\"PULSE\")\n",
" for key,value in pulse.items():\n",
" config.set(\"PULSE\",key,value)\n",
" config.set(\"PULSE\",key,
str(
value)
)
\n",
" \n",
" # Now The constant smus\n",
" config.add_section('CONSTANT SMUS')\n",
" for i, cons_smu in enumerate(cons_smus):\n",
" config.add_section(f\"CONSTANT SMU{i+1}\")\n",
" for key, value in cons_smu.items():\n",
" config.set(f\"CONSTANT SMU{i+1}\",key,value)\n",
" config.set(f\"CONSTANT SMU{i+1}\",key,
str(
value)
)
\n",
" \n",
"\n",
" # Page 4 The axes\n",
" config.add_section('AXES')\n",
" for i,axis in enumerate(axes):\n",
" config
_
add_section(f\"AXIS {i+1}\")\n",
" config
.
add_section(f\"AXIS {i+1}\")\n",
" for key,value in axis.items():\n",
" config.set(f\"AXIS {i+1}\",key,value)\n",
" config.set(f\"AXIS {i+1}\",key,
str(
value)
)
\n",
" \n",
" # Page 5 The varibles\n",
" config.add_section(\"SAVED VARIABLES\")\n",
" for i, variable in enumerate(variables):\n",
" config.add_section(f\"VARIABLE {i+1}\")\n",
" for key,value in variable.items():\n",
" config.set(f\"VARIABLE {i+1}\",key,value)\n",
" config.set(f\"VARIABLE {i+1}\",key,
str(
value)
)
\n",
"\n",
" config.write(configfile)\n",
" # Sampling Measurement Mode\n",
...
...
@@ -375,7 +375,7 @@
" points=third_page[14,0].value,\n",
" filter=int(third_page[17,0].value)\n",
" )\n",
" duration = third_page[1
3
,0].value\n",
" duration = third_page[1
5
,0].value\n",
"\n",
" # Set the smus all constant\n",
" #page 1\n",
...
...
@@ -424,16 +424,11 @@
" device.total_sampling_time(duration)\n",
"\n",
" # Setup the constant SMUs\n",
" cons_smu_numbers = check_cons_smu_samp
ling
(smus)\n",
" for i, cons_smu in enumerate(smus):\n",
" cons_smu_numbers = check_cons_smu_samp(smus)\n",
" for i, cons_smu in enumerate(
cons_
smus):\n",
" if i+1 in cons_smu_numbers: # check if the constant smu was found in the first page func\n",
" device.setup_smu_sampling(i+1,cons_smu) \n",
"\n",
" # Set integration time\n",
" device.intergration_time(integration_time)\n",
" \n",
"\n",
"\n",
" # Now set the axes\n",
" setup_axes(axes,device)\n",
"\n",
...
...
@@ -469,7 +464,7 @@
" # These are correcly defined and include the plotted ones\n",
" values = {}\n",
" for variable in variables:\n",
" key =
f\"{
variable['name']
} ({
variable['unit']
}
)\"\n",
" key = variable['name']
+\"(\"+
variable['unit']
+\"
)\"\n",
" values[key] = device.return_values(variable['name'])\n",
"\n",
" plot_results(values,device)\n",
...
...
@@ -510,41 +505,41 @@
" for i, smu in enumerate(smus):\n",
" config.add_section(f\"SMU{i+1}\")\n",
" for key,value in smu.items():\n",
" config.set(f\"SMU{i+1}\",key,value)\n",
" config.set(f\"SMU{i+1}\",key,
str(
value)
)
\n",
"\n",
" # Secondly the user functions\n",
" config.add_section(\"USER FUNCTIONS\")\n",
" for i, user_function in enumerate(user_functions):\n",
" config.add_section(f\"USER FUNCTION {i+1}\")\n",
" for key,value in user_function.items():\n",
" config.set(f\"USER FUNCTION {i+1}\",key,value)\n",
" config.set(f\"USER FUNCTION {i+1}\",key,
str(
value)
)
\n",
"\n",
" # Then the 3rd page\n",
" config.add_section('SAMPLING PARAMETERS')\n",
" for key,value in parameters.items():\n",
" config.set('SAMPLING PARAMETERS',key,value)\n",
" config.set('SAMPLING PARAMETERS',key,
str(
value)
)
\n",
"\n",
" # Now the constant smus\n",
" config.add_section('CONSTANT SMUS')\n",
" for i, cons_smu in enumerate(cons_smus):\n",
" config.add_section(f\"CONSTANT SMU{i+1}\")\n",
" for key, value in cons_smu.items():\n",
" config.set(f\"CONSTANT SMU{i+1}\",key,value)\n",
" config.set(f\"CONSTANT SMU{i+1}\",key,
str(
value)
)
\n",
" \n",
"\n",
" # Page 4 The axes\n",
" config.add_section('AXES')\n",
" for i,axis in enumerate(axes):\n",
" config
_
add_section(f\"AXIS {i+1}\")\n",
" config
.
add_section(f\"AXIS {i+1}\")\n",
" for key,value in axis.items():\n",
" config.set(f\"AXIS {i+1}\",key,value)\n",
" config.set(f\"AXIS {i+1}\",key,
str(
value)
)
\n",
" \n",
" # Page 5 The varibles\n",
" config.add_section(\"SAVED VARIABLES\")\n",
" for i, variable in enumerate(variables):\n",
" config.add_section(f\"VARIABLE {i+1}\")\n",
" for key,value in variable.items():\n",
" config.set(f\"VARIABLE {i+1}\",key,value)\n",
" config.set(f\"VARIABLE {i+1}\",key,
str(
value)
)
\n",
"\n",
" config.write(configfile)\n",
" else: # Stress\n",
...
...
@@ -568,7 +563,7 @@
" )\n",
"\n",
" # Now define the parameters\n",
" duration = third_page[1
3
,0].value\n",
" duration = third_page[1
5
,0].value\n",
" if duration <= 0:\n",
" error_box(\"Stress Time should be positive!\")\n",
" change_state(first_page,second_page,third_page,fourth_page,fifth_page)\n",
...
...
@@ -611,7 +606,7 @@
" ini.disabled = False\n",
" return\n",
"\n",
" filename = f\"{sample_series}_{field}_{dut}_{measurement_name}_s
weep
.txt\"\n",
" filename = f\"{sample_series}_{field}_{dut}_{measurement_name}_s
tress
.txt\"\n",
" txt_file = create_file(filename)\n",
" ini_file = os.path.splitext(txt_file)[0]+'.ini'\n",
"\n",
...
...
@@ -643,9 +638,9 @@
" config.set(f\"SMU{i+1}\",key,value)\n",
"\n",
" config.add_section('PARAMETERS')\n",
" config.set('PARAMETERS', \"STRESS TIME\",duration)\n",
" config.set('PARAMETERS', \"HOLD TIME\",hold_time)\n",
" config.set('PARAMETERS', \"FILTER\",filter)\n",
" config.set('PARAMETERS', \"STRESS TIME\",
str(
duration)
)
\n",
" config.set('PARAMETERS', \"HOLD TIME\",
str(
hold_time)
)
\n",
" config.set('PARAMETERS', \"FILTER\",
str(
filter)
)
\n",
" \n",
" \n",
" # Now the constant smus\n",
...
...
@@ -653,7 +648,7 @@
" for i, cons_smu in enumerate(cons_smus):\n",
" config.add_section(f\"CONSTANT SMU{i+1}\")\n",
" for key, value in cons_smu.items():\n",
" config.set(f\"CONSTANT SMU{i+1}\",key,value)\n",
" config.set(f\"CONSTANT SMU{i+1}\",key,
str(
value)
)
\n",
" config.write(configfile)\n",
"\n",
" # End of fuction\n",
...
...
@@ -707,6 +702,14 @@
" \n",
"start.on_click(on_start_clicked)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5dcfff06-d975-4473-b3d1-6a3543e319d7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
...
...
...
...
%% Cell type:code id:
8faef648-e31f-48c5-a101-d6070b2d1990
tags:
%% Cell type:code id:
70e36e46-2332-484d-9576-22f869e335bc
tags:
```
python
import
sys
sys
.
path
.
insert
(
0
,
'
./lib
'
)
sys
.
path
.
insert
(
0
,
'
..
'
)
#append parent directory
import
os
import
configparser
import
warnings
from
interface
import
*
from
help
import
*
import
hp4155a
first_page
=
page_1
()
second_page
=
page_2
()
third_page
=
page_3
()
fourth_page
=
page_4
()
fifth_page
=
page_5
()
titles
=
[
"
SMUs
"
,
"
User Functions
"
,
"
Parameters
"
,
"
Plotting
"
,
"
Save to file
"
]
children
=
[
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
]
tab
=
widgets
.
Tab
()
tab
.
children
=
children
tab
.
titles
=
titles
display
(
tab
)
start
=
widgets
.
Button
(
description
=
'
Start Measurement
'
)
ini
=
widgets
.
Button
(
description
=
'
Import from ini.
'
)
output
=
widgets
.
Output
()
display
(
widgets
.
HBox
([
start
,
ini
]),
output
)
device
=
hp4155a
.
HP4155a
(
'
GPIB0::17::INSTR
'
)
def
on_start_clicked
(
b
):
with
output
:
clear_output
()
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
True
ini
.
disabled
=
True
# Reset the device
device
.
reset
()
# Step 1 create the dictionaries appropriately for every measurement
# read general information
measurement_mode
=
third_page
[
0
,
0
].
value
measurement_name
=
fifth_page
[
0
,
0
].
value
processing_nr
=
fifth_page
[
1
,
0
].
value
sample_series
=
fifth_page
[
2
,
0
].
value
field
=
fifth_page
[
3
,
0
].
value
dut
=
fifth_page
[
4
,
0
].
value
integration
=
third_page
[
0
,
1
].
value
# we need constant smus for all measurements
# Constant Smus
cons_smus
=
[]
for
j
in
range
(
1
,
5
):
cons_smus
.
append
(
create_dict
(
value
=
third_page
[
21
,
j
].
value
,
comp
=
third_page
[
22
,
j
].
value
))
# 2nd page
user_functions
=
[]
#iterate over the rows
for
i
in
range
(
1
,
7
):
if
second_page
[
i
,
0
].
value
!=
""
:
# do not save user functions without names
user_functions
.
append
(
create_dict
(
name
=
second_page
[
i
,
0
].
value
,
unit
=
second_page
[
i
,
1
].
value
,
expression
=
second_page
[
i
,
2
].
value
)
)
# Page 4
axes
=
[]
# 0 is x-axis , 1 is y1-axis and 2 is y2-axis
for
j
in
range
(
1
,
4
):
#iterate over the column
axes
.
append
(
create_dict
(
name
=
fourth_page
[
1
,
j
].
value
,
scale
=
fourth_page
[
2
,
j
].
value
,
min
=
fourth_page
[
3
,
j
].
value
,
max
=
fourth_page
[
4
,
j
].
value
)
)
# Page 5
variables
=
[]
for
i
in
range
(
8
):
if
fifth_page
[
6
+
i
,
0
].
value
!=
""
:
# do not save empty rows
variables
.
append
(
create_dict
(
name
=
fifth_page
[
6
+
i
,
0
].
value
,
unit
=
fifth_page
[
6
+
i
,
1
].
value
)
)
# first sweep
if
measurement_mode
==
'
SWEEP
'
:
#page 1
smus
=
[]
#iterate over the rows
for
i
in
range
(
1
,
5
):
smus
.
append
(
create_dict
(
vname
=
first_page
[
i
,
1
].
value
,
iname
=
first_page
[
i
,
2
].
value
,
mode
=
first_page
[
i
,
3
].
value
,
func
=
first_page
[
i
,
4
].
value
,
disabled
=
first_page
[
i
,
5
].
value
)
)
# Page 3
#match hysteris checkbox with the command forwarded to the tool
if
third_page
[
9
,
0
].
value
==
True
:
hyst
=
'
DOUB
'
else
:
hyst
=
'
SING
'
var1
=
create_dict
(
start
=
third_page
[
4
,
0
].
value
,
stop
=
third_page
[
5
,
0
].
value
,
step
=
third_page
[
6
,
0
].
value
,
comp
=
third_page
[
7
,
0
].
value
,
pcomp
=
third_page
[
8
,
0
].
value
,
mode
=
hyst
)
var2
=
create_dict
(
start
=
third_page
[
4
,
1
].
value
,
step
=
third_page
[
5
,
1
].
value
,
points
=
third_page
[
6
,
1
].
value
,
comp
=
third_page
[
7
,
1
].
value
,
pcomp
=
third_page
[
8
,
1
].
value
)
vard
=
create_dict
(
offset
=
third_page
[
4
,
2
].
value
,
ratio
=
third_page
[
5
,
2
].
value
,
comp
=
third_page
[
7
,
2
].
value
,
pcomp
=
third_page
[
8
,
2
].
value
)
pulse
=
create_dict
(
period
=
third_page
[
4
,
3
].
value
,
width
=
third_page
[
5
,
3
].
value
,
base
=
third_page
[
6
,
3
].
value
)
# Now execute measurement
#setup sweep measurement mode
device
.
measurement_mode
(
'
SWE
'
)
#disable all irrelevant units
device
.
disable_not_smu
()
# First Setup Smus
for
i
,
smu
in
enumerate
(
smus
):
if
smu
[
'
disabled
'
]
==
False
:
device
.
setup_smu
(
i
+
1
,
smu
)
else
:
#disabled
device
.
smu_disable
(
i
+
1
)
# Setup User Functions
for
user_function
in
user_functions
:
device
.
user_function
(
user_function
[
'
name
'
],
user_function
[
'
unit
'
],
user_function
[
'
expression
'
])
# Set the integration time
device
.
integration_time
(
integration
)
# Setup VAR1 (always in sweep measurements)
device
.
setup_var1
(
var1
)
# device will check for errors
# Now set the 3 additional columns
if
check_sweep_func
(
smus
,
'
VAR2
'
)
==
True
:
device
.
setup_var2
(
var2
)
if
check_sweep_func
(
smus
,
'
VARD
'
)
==
True
:
device
.
setup_vard
(
vard
)
if
check_sweep_pulse
(
smus
)
==
True
:
device
.
setup_pulse
(
pulse
)
# Check for constant SMUs but not grounded
cons_smu_numbers
=
check_sweep_cons
(
smus
)
for
i
,
cons_smu
in
enumerate
(
cons_smus
):
if
i
+
1
in
cons_smu_numbers
:
# check if the constant smu was found in the first page func
device
.
setup_cons_smu
(
i
+
1
,
cons_smu
)
# Now set the axes
setup_axes
(
axes
,
device
)
# Set the variables to be saved (This function has an exemption)
try
:
save_variables
(
axes
,
variables
,
device
)
except
Exception
as
e
:
error_box
(
e
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
False
ini
.
disabled
=
False
return
# Start the measurement
device
.
single_measurement
()
while
device
.
operation_completed
()
==
False
:
pass
device
.
autoscaling
()
# List all errors occured
counter
,
message
=
device
.
list_all_errors
()
if
counter
>
1
:
error_box
(
message
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
False
ini
.
disabled
=
False
return
# Get the data from the device
# These are correcly defined and include the plotted ones
values
=
{}
for
variable
in
variables
:
key
=
f
"
{
variable
[
'
name
'
]
}
(
{
variable
[
'
unit
'
]
}
)
"
key
=
variable
[
'
name
'
]
+
"
(
"
+
variable
[
'
unit
'
]
+
"
)
"
values
[
key
]
=
device
.
return_values
(
variable
[
'
name
'
])
plot_results
(
values
,
device
)
# Save results
df
=
pd
.
DataFrame
(
values
)
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
.txt
"
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
_sweep
.txt
"
txt_file
=
create_file
(
filename
)
ini_file
=
os
.
path
.
splitext
(
txt_file
)[
0
]
+
'
.ini
'
with
open
(
txt_file
,
'
w
'
)
as
f
:
date
=
str
(
datetime
.
today
().
replace
(
microsecond
=
0
))
f
.
write
(
f
"
{
measurement_name
}
(sweep) at
{
date
}
:
"
+
"
\n
"
)
f
.
write
(
"
Sample Information
\n
"
)
f
.
write
(
f
"
Processing Number:
{
processing_nr
}
"
+
"
\n
"
)
f
.
write
(
f
"
Sample Series:
{
sample_series
}
"
+
"
\n
"
)
f
.
write
(
f
"
Field:
{
field
}
"
+
"
\n
"
)
f
.
write
(
f
"
DUT:
{
dut
}
"
+
"
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
f
"
Measurement parameters can be found at:
{
ini_file
}
"
+
"
\n
"
)
f
.
write
(
"
\n
Results
\n
"
)
df
.
to_csv
(
txt_file
,
sep
=
"
"
,
mode
=
'
a
'
)
# export interface to ini file
# First the Smus
config
=
configparser
.
ConfigParser
()
with
open
(
ini_file
,
'
w
'
)
as
configfile
:
config
.
add_section
(
"
THESE ARE THE PARAMETERS OF THE CORRESPONDING MEASUREMENT
"
)
config
.
add_section
(
"
THE WHOLE INTERFACE IS SAVED SO FIND WHAT YOU NEED
"
)
config
.
add_section
(
"
DO NOT MODIFY THIS FILE
"
)
config
.
add_section
(
f
"
MEASUREMENT MODE:
{
measurement_mode
}
"
)
config
.
add_section
(
f
"
INTEGRATION TIME:
{
integration
}
"
)
# First the smus
config
.
add_section
(
"
SMUS
"
)
for
i
,
smu
in
enumerate
(
smus
):
config
.
add_section
(
f
"
SMU
{
i
+
1
}
"
)
for
key
,
value
in
smu
.
items
():
config
.
set
(
f
"
SMU
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
SMU
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Secondly the user functions
config
.
add_section
(
"
USER FUNCTIONS
"
)
for
i
,
user_function
in
enumerate
(
user_functions
):
config
.
add_section
(
f
"
USER FUNCTION
{
i
+
1
}
"
)
for
key
,
value
in
user_function
.
items
():
config
.
set
(
f
"
USER FUNCTION
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
USER FUNCTION
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Then the 3rd page
config
.
add_section
(
"
VAR1
"
)
for
key
,
value
in
var1
.
items
():
config
.
set
(
"
VAR1
"
,
key
,
value
)
config
.
set
(
"
VAR1
"
,
key
,
str
(
value
)
)
config
.
add_section
(
"
VAR2
"
)
for
key
,
value
in
var2
.
items
():
config
.
set
(
"
VAR2
"
,
key
,
value
)
config
.
set
(
"
VAR2
"
,
key
,
str
(
value
)
)
config
.
add_section
(
"
VARD
"
)
for
key
,
value
in
vard
.
items
():
config
.
set
(
"
VARD
"
,
key
,
value
)
config
.
set
(
"
VARD
"
,
key
,
str
(
value
)
)
config
.
add_section
(
"
PULSE
"
)
for
key
,
value
in
pulse
.
items
():
config
.
set
(
"
PULSE
"
,
key
,
value
)
config
.
set
(
"
PULSE
"
,
key
,
str
(
value
)
)
# Now The constant smus
config
.
add_section
(
'
CONSTANT SMUS
'
)
for
i
,
cons_smu
in
enumerate
(
cons_smus
):
config
.
add_section
(
f
"
CONSTANT SMU
{
i
+
1
}
"
)
for
key
,
value
in
cons_smu
.
items
():
config
.
set
(
f
"
CONSTANT SMU
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
CONSTANT SMU
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Page 4 The axes
config
.
add_section
(
'
AXES
'
)
for
i
,
axis
in
enumerate
(
axes
):
config
_
add_section
(
f
"
AXIS
{
i
+
1
}
"
)
config
.
add_section
(
f
"
AXIS
{
i
+
1
}
"
)
for
key
,
value
in
axis
.
items
():
config
.
set
(
f
"
AXIS
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
AXIS
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Page 5 The varibles
config
.
add_section
(
"
SAVED VARIABLES
"
)
for
i
,
variable
in
enumerate
(
variables
):
config
.
add_section
(
f
"
VARIABLE
{
i
+
1
}
"
)
for
key
,
value
in
variable
.
items
():
config
.
set
(
f
"
VARIABLE
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
VARIABLE
{
i
+
1
}
"
,
key
,
str
(
value
)
)
config
.
write
(
configfile
)
# Sampling Measurement Mode
elif
measurement_mode
==
'
SAMPLING
'
:
# sampling parameters
parameters
=
create_dict
(
mode
=
third_page
[
12
,
0
].
value
,
interval
=
third_page
[
13
,
0
].
value
,
hold
=
third_page
[
16
,
0
].
value
,
points
=
third_page
[
14
,
0
].
value
,
filter
=
int
(
third_page
[
17
,
0
].
value
)
)
duration
=
third_page
[
1
3
,
0
].
value
duration
=
third_page
[
1
5
,
0
].
value
# Set the smus all constant
#page 1
smus
=
[]
#iterate over the rows and set the function to constant
for
i
in
range
(
1
,
5
):
smus
.
append
(
create_dict
(
vname
=
first_page
[
i
,
1
].
value
,
iname
=
first_page
[
i
,
2
].
value
,
mode
=
first_page
[
i
,
3
].
value
,
func
=
'
CONS
'
,
disabled
=
first_page
[
i
,
5
].
value
)
)
# Now start the measurement
device
.
measurement_mode
(
'
SAMP
'
)
#disable all irrelevant units
device
.
disable_not_smu
()
# First Setup Smus
for
i
,
smu
in
enumerate
(
smus
):
if
smu
[
'
disabled
'
]
==
False
:
device
.
setup_smu
(
i
+
1
,
smu
)
else
:
#disabled
device
.
smu_disable
(
i
+
1
)
# Setup User Functions
for
user_function
in
user_functions
:
device
.
user_function
(
user_function
[
'
name
'
],
user_function
[
'
unit
'
],
user_function
[
'
expression
'
])
# Set the integration time
device
.
integration_time
(
integration
)
# Set the sampling parameters
device
.
setup_sampling
(
parameters
)
# Set the total sampling time
if
duration
<=
0
:
warnings
.
warn
(
"
Non positive measurement duration. Auto Sampling time will be set
"
)
device
.
auto_sampling_time
(
1
)
else
:
device
.
total_sampling_time
(
duration
)
# Setup the constant SMUs
cons_smu_numbers
=
check_cons_smu_samp
ling
(
smus
)
for
i
,
cons_smu
in
enumerate
(
smus
):
cons_smu_numbers
=
check_cons_smu_samp
(
smus
)
for
i
,
cons_smu
in
enumerate
(
cons_
smus
):
if
i
+
1
in
cons_smu_numbers
:
# check if the constant smu was found in the first page func
device
.
setup_smu_sampling
(
i
+
1
,
cons_smu
)
# Set integration time
device
.
intergration_time
(
integration_time
)
# Now set the axes
setup_axes
(
axes
,
device
)
# Set the variables to be saved (This function has an exemption)
try
:
save_variables
(
axes
,
variables
,
device
)
except
Exception
as
e
:
error_box
(
e
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
False
ini
.
disabled
=
False
return
# Start the measurement
device
.
single_measurement
()
while
device
.
operation_completed
()
==
False
:
pass
device
.
autoscaling
()
# List all errors occured
counter
,
message
=
device
.
list_all_errors
()
if
counter
>
1
:
error_box
(
message
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
False
ini
.
disabled
=
False
return
# Get the data from the device
# These are correcly defined and include the plotted ones
values
=
{}
for
variable
in
variables
:
key
=
f
"
{
variable
[
'
name
'
]
}
(
{
variable
[
'
unit
'
]
}
)
"
key
=
variable
[
'
name
'
]
+
"
(
"
+
variable
[
'
unit
'
]
+
"
)
"
values
[
key
]
=
device
.
return_values
(
variable
[
'
name
'
])
plot_results
(
values
,
device
)
# Save results
df
=
pd
.
DataFrame
(
values
)
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
_sampling.txt
"
txt_file
=
create_file
(
filename
)
ini_file
=
os
.
path
.
splitext
(
txt_file
)[
0
]
+
'
.ini
'
with
open
(
txt_file
,
'
w
'
)
as
f
:
date
=
str
(
datetime
.
today
().
replace
(
microsecond
=
0
))
f
.
write
(
f
"
{
measurement_name
}
(sampling) at
{
date
}
:
"
+
"
\n
"
)
f
.
write
(
"
Sample Information
\n
"
)
f
.
write
(
f
"
Processing Number:
{
processing_nr
}
"
+
"
\n
"
)
f
.
write
(
f
"
Sample Series:
{
sample_series
}
"
+
"
\n
"
)
f
.
write
(
f
"
Field:
{
field
}
"
+
"
\n
"
)
f
.
write
(
f
"
DUT:
{
dut
}
"
+
"
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
f
"
Measurement parameters can be found at:
{
ini_file
}
"
+
"
\n
"
)
f
.
write
(
"
\n
Results
\n
"
)
df
.
to_csv
(
txt_file
,
sep
=
"
"
,
mode
=
'
a
'
)
# export interface to ini file
# First the Smus
config
=
configparser
.
ConfigParser
()
with
open
(
ini_file
,
'
w
'
)
as
configfile
:
config
.
add_section
(
"
THESE ARE THE PARAMETERS OF THE CORRESPONDING MEASUREMENT
"
)
config
.
add_section
(
"
THE WHOLE INTERFACE IS SAVED SO FIND WHAT YOU NEED
"
)
config
.
add_section
(
"
DO NOT MODIFY THIS FILE
"
)
config
.
add_section
(
f
"
MEASUREMENT MODE:
{
measurement_mode
}
"
)
config
.
add_section
(
f
"
INTEGRATION TIME:
{
integration
}
"
)
# First the smus
config
.
add_section
(
"
SMUS
"
)
for
i
,
smu
in
enumerate
(
smus
):
config
.
add_section
(
f
"
SMU
{
i
+
1
}
"
)
for
key
,
value
in
smu
.
items
():
config
.
set
(
f
"
SMU
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
SMU
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Secondly the user functions
config
.
add_section
(
"
USER FUNCTIONS
"
)
for
i
,
user_function
in
enumerate
(
user_functions
):
config
.
add_section
(
f
"
USER FUNCTION
{
i
+
1
}
"
)
for
key
,
value
in
user_function
.
items
():
config
.
set
(
f
"
USER FUNCTION
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
USER FUNCTION
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Then the 3rd page
config
.
add_section
(
'
SAMPLING PARAMETERS
'
)
for
key
,
value
in
parameters
.
items
():
config
.
set
(
'
SAMPLING PARAMETERS
'
,
key
,
value
)
config
.
set
(
'
SAMPLING PARAMETERS
'
,
key
,
str
(
value
)
)
# Now the constant smus
config
.
add_section
(
'
CONSTANT SMUS
'
)
for
i
,
cons_smu
in
enumerate
(
cons_smus
):
config
.
add_section
(
f
"
CONSTANT SMU
{
i
+
1
}
"
)
for
key
,
value
in
cons_smu
.
items
():
config
.
set
(
f
"
CONSTANT SMU
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
CONSTANT SMU
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Page 4 The axes
config
.
add_section
(
'
AXES
'
)
for
i
,
axis
in
enumerate
(
axes
):
config
_
add_section
(
f
"
AXIS
{
i
+
1
}
"
)
config
.
add_section
(
f
"
AXIS
{
i
+
1
}
"
)
for
key
,
value
in
axis
.
items
():
config
.
set
(
f
"
AXIS
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
AXIS
{
i
+
1
}
"
,
key
,
str
(
value
)
)
# Page 5 The varibles
config
.
add_section
(
"
SAVED VARIABLES
"
)
for
i
,
variable
in
enumerate
(
variables
):
config
.
add_section
(
f
"
VARIABLE
{
i
+
1
}
"
)
for
key
,
value
in
variable
.
items
():
config
.
set
(
f
"
VARIABLE
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
VARIABLE
{
i
+
1
}
"
,
key
,
str
(
value
)
)
config
.
write
(
configfile
)
else
:
# Stress
#page 1
smus
=
[]
#iterate over the rows and set the function to constant
for
i
in
range
(
1
,
5
):
# Set SYNC non SYNC mode
mode
=
first_page
[
i
,
3
].
value
if
mode
!=
'
COMM
'
:
func
=
'
SYNC
'
else
:
func
=
'
NSYNC
'
smus
.
append
(
create_dict
(
name
=
first_page
[
i
,
1
].
value
,
mode
=
mode
,
func
=
func
,
disabled
=
first_page
[
i
,
5
].
value
)
)
# Now define the parameters
duration
=
third_page
[
1
3
,
0
].
value
duration
=
third_page
[
1
5
,
0
].
value
if
duration
<=
0
:
error_box
(
"
Stress Time should be positive!
"
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
return
hold_time
=
third_page
[
16
,
0
].
value
filter
=
int
(
third_page
[
17
,
0
].
value
)
# Now start the measurement
device
.
stress_page
()
device
.
stress_disable_not_smu
()
# First Setup Smus
for
i
,
smu
in
enumerate
(
smus
):
if
smu
[
'
disabled
'
]
==
False
:
device
.
smu_stress
(
i
+
1
,
smu
)
else
:
#disabled
device
.
smu_stress_disable
(
i
+
1
)
# Now set the Parameters
device
.
stress_filter
(
filter
)
device
.
hold_time
(
hold_time
)
device
.
stress_time
(
duration
)
cons_smu_numbers
=
check_cons_smu_sampling
(
smus
)
# works also for sampling
for
i
,
cons_smu
in
enumerate
(
smus
):
if
i
+
1
in
cons_smu_numbers
:
# check if the constant smu was found in the first page func
device
.
setup_smu_stress
(
i
+
1
,
cons_smu
)
# Now start the measurement
device
.
start_stress
()
while
device
.
operation_completed
()
==
False
:
pass
# List all errors occured
counter
,
message
=
device
.
list_all_errors
()
if
counter
>
1
:
error_box
(
message
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
False
ini
.
disabled
=
False
return
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
_s
weep
.txt
"
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
_s
tress
.txt
"
txt_file
=
create_file
(
filename
)
ini_file
=
os
.
path
.
splitext
(
txt_file
)[
0
]
+
'
.ini
'
with
open
(
txt_file
,
'
w
'
)
as
f
:
date
=
str
(
datetime
.
today
().
replace
(
microsecond
=
0
))
f
.
write
(
f
"
{
measurement_name
}
(Stress) at
{
date
}
:
"
+
"
\n
"
)
f
.
write
(
"
Sample Information
\n
"
)
f
.
write
(
f
"
Processing Number:
{
processing_nr
}
"
+
"
\n
"
)
f
.
write
(
f
"
Sample Series:
{
sample_series
}
"
+
"
\n
"
)
f
.
write
(
f
"
Field:
{
field
}
"
+
"
\n
"
)
f
.
write
(
f
"
DUT:
{
dut
}
"
+
"
\n
"
)
f
.
write
(
"
\n
"
)
f
.
write
(
f
"
Measurement parameters can be found at:
{
ini_file
}
"
+
"
\n
"
)
f
.
write
(
"
\n
No Results Available
\n
"
)
#export the interface to ini file
config
=
configparser
.
ConfigParser
()
with
open
(
ini_file
,
'
w
'
)
as
configfile
:
config
.
add_section
(
"
THESE ARE THE PARAMETERS OF THE CORRESPONDING MEASUREMENT
"
)
config
.
add_section
(
"
THE WHOLE INTERFACE IS SAVED SO FIND WHAT YOU NEED
"
)
config
.
add_section
(
"
DO NOT MODIFY THIS FILE
"
)
config
.
add_section
(
f
"
MEASUREMENT MODE:
{
measurement_mode
}
"
)
# First the smus
config
.
add_section
(
"
SMUS
"
)
for
i
,
smu
in
enumerate
(
smus
):
config
.
add_section
(
f
"
SMU
{
i
+
1
}
"
)
for
key
,
value
in
smu
.
items
():
config
.
set
(
f
"
SMU
{
i
+
1
}
"
,
key
,
value
)
config
.
add_section
(
'
PARAMETERS
'
)
config
.
set
(
'
PARAMETERS
'
,
"
STRESS TIME
"
,
duration
)
config
.
set
(
'
PARAMETERS
'
,
"
HOLD TIME
"
,
hold_time
)
config
.
set
(
'
PARAMETERS
'
,
"
FILTER
"
,
filter
)
config
.
set
(
'
PARAMETERS
'
,
"
STRESS TIME
"
,
str
(
duration
)
)
config
.
set
(
'
PARAMETERS
'
,
"
HOLD TIME
"
,
str
(
hold_time
)
)
config
.
set
(
'
PARAMETERS
'
,
"
FILTER
"
,
str
(
filter
)
)
# Now the constant smus
config
.
add_section
(
'
CONSTANT SMUS
'
)
for
i
,
cons_smu
in
enumerate
(
cons_smus
):
config
.
add_section
(
f
"
CONSTANT SMU
{
i
+
1
}
"
)
for
key
,
value
in
cons_smu
.
items
():
config
.
set
(
f
"
CONSTANT SMU
{
i
+
1
}
"
,
key
,
value
)
config
.
set
(
f
"
CONSTANT SMU
{
i
+
1
}
"
,
key
,
str
(
value
)
)
config
.
write
(
configfile
)
# End of fuction
information_box
(
"
Measurement finished!
"
)
change_state
(
first_page
,
second_page
,
third_page
,
fourth_page
,
fifth_page
)
start
.
disabled
=
False
ini
.
disabled
=
False
return
# just to be sure
# This should be tested at the end.
# After the ini files have been created
"""
def on_ini_clicked(b):
with output:
clear_output()
change_state(first_page,second_page,third_page,fourth_page,fifth_page)
start.disabled = True
ini.disabled = True
#load values to the interface
config = configparser.ConfigParser()
try:
file = load_ini()
except Exception as e:
error_box(e)
change_state(first_page,second_page,third_page,fourth_page,fifth_page)
start.disabled = False
ini.disabled = False
return
try:
# Now we do exactly the opposite thing dictionaries to widgets
#read the values from each section
config.read(file)
# Get the sections
sections = config.sections()
# Get the measurement Mode
measurement_mode = get_mode(sections)
# Get the constant smus
for j in range(1,5):
third_page[21,j].value = config.get(f
"
CONSTANT SMU{j}
"
,
'
value
'
)
third_page[22,j].value = config.get(f
"
CONSTANT SMU{j}
"
,
'
comp
'
)
if measurement_mode ==
'
SWEEP
'
:
third_page[0,0].value = measurement_mode
third_page[0,1].value = get_integration(sections)
"""
start
.
on_click
(
on_start_clicked
)
```
%% Output
%% Cell type:code id:5dcfff06-d975-4473-b3d1-6a3543e319d7 tags:
```
python
```
...
...
...
...
This diff is collapsed.
Click to expand it.
hp4155/Custom_SMU/lib/help.py
+
7
−
7
View file @
f9d54fc7
...
...
@@ -132,22 +132,22 @@ def plot_results(values,device):
fig
,
ax1
=
plt
.
subplots
()
ax1
.
set_xlabel
(
x_label
)
ax1
.
set_ylabel
(
y1_label
,
color
=
'
y
'
)
# Yellow Color
ax1
.
set_ylabel
(
y1_label
,
color
=
'
tab:red
'
)
# Yellow Color
ax1
.
set_xscale
(
x_scale
)
ax1
.
set_yscale
(
y1_scale
)
ax1
.
scatter
(
x_values
,
y1_values
,
color
=
'
y
'
)
ax1
.
tick_params
(
axis
=
'
y
'
,
labelcolor
=
'
y
'
,
which
=
'
both
'
)
ax1
.
scatter
(
x_values
,
y1_values
,
color
=
'
tab:red
'
)
ax1
.
tick_params
(
axis
=
'
y
'
,
labelcolor
=
'
tab:red
'
,
which
=
'
both
'
)
if
y2_var
!=
""
:
# Adding Twin Axes # Blue color
ax2
=
ax1
.
twinx
()
ax2
.
set_ylabel
(
y2_label
,
color
=
'
b
'
)
ax2
.
set_ylabel
(
y2_label
,
color
=
'
tab:green
'
)
ax2
.
set_yscale
(
y2_scale
)
ax2
.
scatter
(
x_values
,
y2_values
,
color
=
'
b
'
)
ax2
.
tick_params
(
axis
=
'
y
'
,
labelcolor
=
'
b
'
,
which
=
'
both
'
)
ax2
.
scatter
(
x_values
,
y2_values
,
color
=
'
tab:green
'
)
ax2
.
tick_params
(
axis
=
'
y
'
,
labelcolor
=
'
tab:green
'
,
which
=
'
both
'
)
display
(
fig
)
# The checks will be corrected later
...
...
@@ -175,7 +175,7 @@ def create_file(filename):
def
check_cons_smu_samp
(
smus
:
list
):
cons_smu_numbers
=
[]
for
i
,
smu
in
enumerate
(
smus
):
if
smu
[
'
mode
'
]
!=
'
COMM
'
:
# Non Grounded SMUs
if
smu
[
'
mode
'
]
!=
'
COMM
'
and
smu
[
"
disabled
"
]
==
False
:
# Non Grounded
active
SMUs
cons_smu_numbers
.
append
(
i
+
1
)
# for the actual number of smus
return
cons_smu_numbers
...
...
...
...
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
sign in
to comment