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
dab9d1e8
Verified
Commit
dab9d1e8
authored
3 months ago
by
Tobias Hangleiter
Browse files
Options
Downloads
Patches
Plain Diff
Add MonochromaticNoise
Useful for comparing window functions
parent
5c895236
No related branches found
No related tags found
1 merge request
!66
Extend simulator module
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python_spectrometer/daq/simulator.py
+18
-0
18 additions, 0 deletions
src/python_spectrometer/daq/simulator.py
with
18 additions
and
0 deletions
src/python_spectrometer/daq/simulator.py
+
18
−
0
View file @
dab9d1e8
...
@@ -47,6 +47,24 @@ except ImportError as e:
...
@@ -47,6 +47,24 @@ except ImportError as e:
"'
pip install qopt.
'"
)
from
e
"'
pip install qopt.
'"
)
from
e
class
MonochromaticNoise
(
DAQ
):
def
acquire
(
self
,
*
,
n_avg
:
int
,
fs
:
float
,
n_pts
:
int
,
delay
:
bool
|
float
=
False
,
A
:
float
=
1
,
f_0
:
float
=
50
,
**
settings
)
->
AcquisitionGenerator
[
DAQ
.
DTYPE
]:
if
delay
is
True
:
delay
=
1
/
settings
[
'
df
'
]
t
=
np
.
arange
(
0
,
n_pts
/
fs
,
1
/
fs
)
rng
=
np
.
random
.
default_rng
()
for
_
in
range
(
n_avg
):
tic
=
time
.
perf_counter
()
data
=
np
.
sin
(
2
*
np
.
pi
*
(
t
*
f_0
+
rng
.
random
()))
if
delay
:
time
.
sleep
(
delay
-
(
time
.
perf_counter
()
-
tic
))
yield
data
@dataclasses.dataclass
@dataclasses.dataclass
class
QoptColoredNoise
(
DAQ
):
class
QoptColoredNoise
(
DAQ
):
"""
Simulates noise using :mod:`qopt:qopt`.
"""
Simulates noise using :mod:`qopt:qopt`.
...
...
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