Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-spectrometer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
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
QuTech
python-spectrometer
Commits
38d6a968
Verified
Commit
38d6a968
authored
3 months ago
by
Tobias Hangleiter
Browse files
Options
Downloads
Patches
Plain Diff
Fix automatic delay detection
parent
5a3d0240
No related branches found
No related tags found
1 merge request
!66
Extend simulator module
Pipeline
#1639842
waiting for manual action
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python_spectrometer/daq/simulator.py
+4
-5
4 additions, 5 deletions
src/python_spectrometer/daq/simulator.py
with
4 additions
and
5 deletions
src/python_spectrometer/daq/simulator.py
+
4
−
5
View file @
38d6a968
...
@@ -59,12 +59,12 @@ def with_delay(meth):
...
@@ -59,12 +59,12 @@ def with_delay(meth):
@wraps
(
meth
)
@wraps
(
meth
)
def
wrapped
(
self
,
*
,
delay
=
True
,
**
settings
):
def
wrapped
(
self
,
*
,
delay
=
True
,
**
settings
):
skip_
wait
=
g
et
attr
(
wrapped
,
'
__with
_delay
'
,
False
)
skip_
delay
=
s
et
tings
.
pop
(
'
_skip
_delay
'
,
False
)
if
delay
is
True
:
if
delay
is
True
:
delay
=
settings
[
'
n_pts
'
]
/
settings
[
'
fs
'
]
delay
=
settings
[
'
n_pts
'
]
/
settings
[
'
fs
'
]
it
=
meth
(
self
,
**
settings
)
it
=
meth
(
self
,
_skip_delay
=
True
,
**
settings
)
while
True
:
while
True
:
tic
=
time
.
perf_counter
()
tic
=
time
.
perf_counter
()
try
:
try
:
...
@@ -72,8 +72,8 @@ def with_delay(meth):
...
@@ -72,8 +72,8 @@ def with_delay(meth):
except
StopIteration
as
stop
:
except
StopIteration
as
stop
:
return
stop
.
value
return
stop
.
value
else
:
else
:
if
delay
and
not
skip_
wait
:
if
delay
and
not
skip_
delay
:
time
.
sleep
(
delay
-
(
time
.
perf_counter
()
-
tic
))
time
.
sleep
(
max
(
0
,
delay
-
(
time
.
perf_counter
()
-
tic
))
)
yield
data
yield
data
...
@@ -91,7 +91,6 @@ def with_delay(meth):
...
@@ -91,7 +91,6 @@ def with_delay(meth):
parameters
=
parameters
+
[
delay_param
]
parameters
=
parameters
+
[
delay_param
]
wrapped
.
__signature__
=
wrapped_sig
.
replace
(
parameters
=
parameters
)
wrapped
.
__signature__
=
wrapped_sig
.
replace
(
parameters
=
parameters
)
wrapped
.
__with_delay
=
True
return
wrapped
return
wrapped
...
...
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