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
11e9e3ea
Commit
11e9e3ea
authored
4 months ago
by
Alexandros Asonitis
Browse files
Options
Downloads
Patches
Plain Diff
ini files part 1
parent
36de4fcf
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/lib/help.py
+38
-0
38 additions, 0 deletions
hp4155/Custom_SMU/lib/help.py
hp4155/Custom_SMU/main.py
+58
-2
58 additions, 2 deletions
hp4155/Custom_SMU/main.py
with
96 additions
and
2 deletions
hp4155/Custom_SMU/lib/help.py
+
38
−
0
View file @
11e9e3ea
...
...
@@ -173,6 +173,44 @@ def check_cons_smu_samp(smus:list):
return
cons_smu_numbers
def
load_ini
():
root
=
tk
.
Tk
()
root
.
withdraw
()
root
.
lift
()
#show window above all other applications
root
.
attributes
(
"
-topmost
"
,
True
)
#window stays above all other applications
file
=
filedialog
.
askopenfilename
(
filetypes
=
[(
"
Ini files
"
,
"
*.ini
"
)],
title
=
'
Select ini file
'
)
while
file
.
endswith
(
"
.ini
"
)
==
False
:
#open again filedialog with error message box
answer
=
tk
.
messagebox
.
askyesno
(
message
=
'
Do you want to cancel the ini file load?
'
)
if
answer
==
True
:
raise
Exception
(
"
Ini File Operation aborted!
"
)
else
:
file
=
filedialog
.
askopenfilename
(
filetypes
=
[(
"
Ini files
"
,
"
*.ini
"
)],
title
=
"
Select ini file
"
)
root
.
destroy
()
return
file
# Get measurement mode from ini file
def
get_mode
(
sections
):
for
section
in
sections
:
if
"
MEASUREMENT MODE:
"
in
section
:
mode
=
section
.
split
(
"
:
"
)[
1
]
return
mode
raise
Exception
(
"
Meaurement mode not found ini file!
"
)
def
get_integration
(
sections
):
for
section
in
sections
:
if
"
INTEGRATION TIME:
"
in
section
:
integration
=
section
.
split
(
"
:
"
)[
1
]
return
integration
raise
Exception
(
"
Integration Time not found ini file!
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
hp4155/Custom_SMU/main.py
+
58
−
2
View file @
11e9e3ea
...
...
@@ -24,9 +24,10 @@ tab.titles = titles
display
(
tab
)
start
=
widgets
.
Button
(
description
=
'
Start Measurement
'
)
ini
=
widgets
.
Button
(
description
=
'
Import from ini.
'
)
output
=
widgets
.
Output
()
display
(
start
,
output
)
display
(
widgets
.
HBox
([
start
,
ini
])
,
output
)
device
=
hp4155a
.
HP4155a
(
'
GPIB0::17::INSTR
'
)
...
...
@@ -34,6 +35,8 @@ 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
()
...
...
@@ -194,6 +197,8 @@ def on_start_clicked(b):
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
...
...
@@ -209,6 +214,8 @@ def on_start_clicked(b):
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
...
...
@@ -384,6 +391,8 @@ def on_start_clicked(b):
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
...
...
@@ -399,6 +408,8 @@ def on_start_clicked(b):
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
...
...
@@ -414,7 +425,7 @@ def on_start_clicked(b):
# Save results
df
=
pd
.
Dataframe
(
values
)
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
_s
weep
.txt
"
filename
=
f
"
{
sample_series
}
_
{
field
}
_
{
dut
}
_
{
measurement_name
}
_s
ampling
.txt
"
txt_file
=
create_file
(
filename
)
ini_file
=
os
.
path
.
splitext
(
txt_file
)[
0
]
+
'
.ini
'
...
...
@@ -544,6 +555,8 @@ def on_start_clicked(b):
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
}
_sweep.txt
"
...
...
@@ -594,9 +607,52 @@ def on_start_clicked(b):
# 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
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
)
...
...
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