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
d5d6fffb
Commit
d5d6fffb
authored
1 year ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
fix: cannot pickle real devices
Solution: use plotting as inner process
parent
365c13ae
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Python_script/MeasurementPlot.py
+5
-3
5 additions, 3 deletions
Python_script/MeasurementPlot.py
Python_script/prototype.py
+8
-12
8 additions, 12 deletions
Python_script/prototype.py
with
13 additions
and
15 deletions
Python_script/MeasurementPlot.py
+
5
−
3
View file @
d5d6fffb
...
...
@@ -161,17 +161,19 @@ class MeasurementPlot:
except
queue
.
Full
:
pass
def
drawing_loop
(
self
):
def
drawing_loop
(
self
,
stop_measurement_event
):
# turn interactive plotting (back) on (is deactivated by starting the process)
plt
.
ion
()
while
True
:
data_frame
,
pdf_name
,
stop_drawing
=
self
.
data_queue
.
get
()
if
stop_drawing
:
return
try
:
if
not
process_sync
.
stop_measurement
.
is_set
():
if
not
stop_measurement
_event
.
is_set
():
self
.
draw_in_this_thread
(
data_frame
,
pdf_name
=
''
)
except
Exception
as
e
:
# Don't exit here. Always drain the data queue so the program can terminate correctly
process_sync
.
stop_measurement
.
set
()
stop_measurement
_event
.
set
()
def
draw_in_this_thread
(
self
,
data_frame
,
pdf_name
=
''
):
timestamps
=
data_frame
.
TIMESTAMP
...
...
This diff is collapsed.
Click to expand it.
Python_script/prototype.py
+
8
−
12
View file @
d5d6fffb
...
...
@@ -177,17 +177,13 @@ class Measurements:
"""
process_sync
.
stop_measurement
.
clear
()
ctx
=
mp
.
get_context
(
'
spawn
'
)
measurement_process
=
ctx
.
Process
(
target
=
self
.
perform_single_measurement_impl
,
args
=
(
output
,
target_temp
,
target_hum
,
soaking_time
,
n_stable_reads
,
process_sync
.
stop_measurement
))
measurement_process
.
start
()
# turn interactive plotting (back) on (is deactivated by starting the process)
plt
.
ion
()
self
.
measurement_plot
.
drawing_loop
()
measurement_process
.
join
()
plot_process
=
ctx
.
Process
(
target
=
self
.
measurement_plot
.
drawing_loop
,
args
=
(
process_sync
.
stop_measurement
,))
plot_process
.
start
()
self
.
perform_single_measurement_impl
(
output
,
target_temp
,
target_hum
,
soaking_time
,
n_stable_reads
)
plot_process
.
join
()
def
perform_single_measurement_impl
(
self
,
output
,
target_temp
,
target_hum
,
soaking_time
,
n_stable_reads
,
stop_measurement
):
def
perform_single_measurement_impl
(
self
,
output
,
target_temp
,
target_hum
,
soaking_time
,
n_stable_reads
):
with
open
(
output
,
mode
=
'
w
'
,
newline
=
''
)
as
csv_file
:
...
...
@@ -219,7 +215,7 @@ class Measurements:
dut_signal_queues
=
[[],
[]]
while
True
:
if
stop_measurement
.
is_set
():
if
process_sync
.
stop_measurement
.
is_set
():
do_another_measurement
=
False
break
...
...
@@ -282,7 +278,7 @@ class Measurements:
all_measurements_stable
=
True
for
i
in
range
(
0
,
n_stable_reads
):
if
stop_measurement
.
is_set
():
if
process_sync
.
stop_measurement
.
is_set
():
all_measurements_stable
=
False
#not enough stable reads yet
do_another_measurement
=
False
break
...
...
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