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
eb183d35
Commit
eb183d35
authored
1 year ago
by
Martin Killenberg
Browse files
Options
Downloads
Patches
Plain Diff
feat: make sleeps interruptible and process plot window events while waiting for data
parent
ccff7384
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/MeasurementPlot.py
+7
-0
7 additions, 0 deletions
Python_script/MeasurementPlot.py
Python_script/prototype.py
+9
-3
9 additions, 3 deletions
Python_script/prototype.py
with
16 additions
and
3 deletions
Python_script/MeasurementPlot.py
+
7
−
0
View file @
eb183d35
...
...
@@ -174,6 +174,13 @@ class MeasurementPlot:
window_close_callback
=
self
.
fig
.
canvas
.
mpl_connect
(
'
close_event
'
,
MeasurementPlot
.
window_closed
)
while
True
:
if
self
.
data_queue
.
empty
():
time
.
sleep
(
0.1
)
if
not
stop_measurement_event
.
is_set
():
#the canvas might have gone and set stop_measurement_event when closing
self
.
fig
.
canvas
.
flush_events
()
continue
data_frame
,
pdf_name
,
stop_drawing
=
self
.
data_queue
.
get
()
if
stop_drawing
:
self
.
fig
.
canvas
.
mpl_disconnect
(
window_close_callback
)
...
...
This diff is collapsed.
Click to expand it.
Python_script/prototype.py
+
9
−
3
View file @
eb183d35
...
...
@@ -280,7 +280,7 @@ class Measurements:
for
i
in
range
(
0
,
n_stable_reads
):
if
process_sync
.
stop_measurement
.
is_set
():
all_measurements_stable
=
False
#not enough stable reads yet
do_another_measurement
=
False
do_another_measurement
=
False
break
# create the main data set for the first measurement set
...
...
@@ -328,8 +328,14 @@ class Measurements:
def
sleep_until
(
self
,
wakeup_time
):
remaining_sleep_time
=
wakeup_time
-
self
.
clock
.
time
()
if
remaining_sleep_time
>
0
:
self
.
clock
.
sleep
(
remaining_sleep_time
)
while
remaining_sleep_time
>
0
:
if
remaining_sleep_time
>
1
:
self
.
clock
.
sleep
(
1
)
if
process_sync
.
stop_measurement
.
is_set
():
return
else
:
self
.
clock
.
sleep
(
remaining_sleep_time
)
remaining_sleep_time
-=
1
def
read_data
(
self
,
measurement_set_name
):
[
temp
,
hum
,
mode
,
alarms
]
=
self
.
chamber
.
read_monitor
().
split
(
'
,
'
)
...
...
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