Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Climate Lab Test Stand
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MSK-SW
Low-Level Radio Frequency
Climate Lab
Climate Lab Test Stand
Commits
13f40aef
Commit
13f40aef
authored
2 years ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
refactor sweep function
parent
96000ba4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Python_script/climate-lab-gui.py
+4
-4
4 additions, 4 deletions
Python_script/climate-lab-gui.py
Python_script/prototype.py
+26
-16
26 additions, 16 deletions
Python_script/prototype.py
with
30 additions
and
20 deletions
Python_script/climate-lab-gui.py
+
4
−
4
View file @
13f40aef
...
...
@@ -34,10 +34,10 @@ class TestStandMainWindow(QMainWindow):
False
,
config_data
)
try
:
if
self
.
tempSweepButton
.
isChecked
():
temperatures
=
meas
.
perform_
temperature_
sweep
(
self
.
startParameter
.
value
(),
self
.
stopParameter
.
value
(),
self
.
stepParameter
.
value
(),
self
.
fixedParameter
.
value
(),
self
.
s
oakingTime
.
value
(),
self
.
stableReads
.
value
()
)
temperatures
=
meas
.
perform_sweep
(
self
.
startParameter
.
value
(),
self
.
stopParameter
.
value
(),
self
.
stepParameter
.
value
(),
self
.
fixedParameter
.
value
(),
self
.
soakingTime
.
value
(),
self
.
s
tableReads
.
value
(),
'
temperature
'
)
temp_extensions
=
[]
for
t
in
temperatures
:
temp_extensions
.
append
(
str
(
t
)
+
'
deg_
'
+
str
(
self
.
fixedParameter
.
value
())
+
'
rh
'
)
...
...
This diff is collapsed.
Click to expand it.
Python_script/prototype.py
+
26
−
16
View file @
13f40aef
...
...
@@ -93,23 +93,33 @@ class Measurements:
return
measurement_number
def
perform_temperature_sweep
(
self
,
start_temp
,
stop_temp
,
temp_step
,
target_hum
,
soaking_time
,
n_stable_reads
):
current_temp
=
start_temp
temperatures
=
[]
while
current_temp
<
stop_temp
:
temperatures
.
append
(
current_temp
)
current_temp
=
round
(
current_temp
+
temp_step
,
1
)
temperatures
.
append
(
stop_temp
)
for
temp
in
temperatures
:
output_name
=
self
.
output_basename
+
'
_
'
+
str
(
temp
)
+
'
deg_
'
+
str
(
target_hum
)
+
'
rh.csv
'
self
.
measurement_plot
.
fig
.
suptitle
(
"
Temp. sweep measurement
"
+
str
(
temperatures
.
index
(
temp
)
+
1
)
+
'
/
'
+
str
(
len
(
temperatures
))
+
'
:
'
+
str
(
temp
)
+
'
degC,
'
+
str
(
target_hum
)
+
'
rel. hum.
'
,
def
perform_sweep
(
self
,
start_val
,
stop_val
,
step_val
,
const_param
,
soaking_time
,
n_stable_reads
,
sweep_type
):
current_val
=
start_val
sweep_values
=
[]
while
current_val
<
stop_val
:
sweep_values
.
append
(
current_val
)
current_val
=
round
(
current_val
+
step_val
,
1
)
sweep_values
.
append
(
stop_val
)
for
val
in
sweep_values
:
if
sweep_type
==
'
temperature
'
:
target_temp
=
val
target_hum
=
const_param
elif
sweep_type
==
'
humidity
'
:
target_temp
=
const_param
target_hum
=
val
else
:
raise
Exception
(
'
Unknown sweep type:
'
+
sweep_type
)
output_name
=
self
.
output_basename
+
'
_
'
+
str
(
target_temp
)
+
'
deg_
'
+
str
(
target_hum
)
+
'
rh.csv
'
self
.
measurement_plot
.
fig
.
suptitle
(
sweep_type
+
"
sweep measurement
"
+
str
(
sweep_values
.
index
(
val
)
+
1
)
+
'
/
'
+
str
(
len
(
sweep_values
))
+
'
:
'
+
str
(
target_temp
)
+
'
degC,
'
+
str
(
target_hum
)
+
'
rel. hum.
'
,
color
=
"
red
"
)
self
.
perform_single_measurement
(
output_name
,
temp
,
target_hum
,
soaking_time
,
n_stable_reads
)
self
.
perform_single_measurement
(
output_name
,
target_
temp
,
target_hum
,
soaking_time
,
n_stable_reads
)
plt
.
close
()
return
temperatur
es
return
sweep_valu
es
def
perform_single_measurement
(
self
,
output
,
target_temp
,
target_hum
,
soaking_time
,
n_stable_reads
):
with
open
(
output
,
mode
=
'
w
'
,
newline
=
''
)
as
csv_file
:
...
...
@@ -351,8 +361,8 @@ def run_temperature_sweep_from_file(temperature_sweep_file, meas):
soaking_time
=
int
(
list_of_values
[
4
])
n_stable_reads
=
int
(
list_of_values
[
5
])
return
meas
.
perform_
temperature_
sweep
(
start_temp
,
stop_temp
,
temperature_step
,
target_hum
,
soaking_time
,
n_stable_reads
),
target_hum
return
meas
.
perform_sweep
(
start_temp
,
stop_temp
,
temperature_step
,
target_hum
,
soaking_time
,
n_stable_reads
,
'
temperature
'
),
target_hum
except
KeyboardInterrupt
:
pass
...
...
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