Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
a2c34142
Commit
a2c34142
authored
May 07, 2021
by
Valentin Valls
Browse files
Add coefficient
parent
fa74d0ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
bliss/controllers/simulation_counter.py
View file @
a2c34142
...
...
@@ -407,6 +407,7 @@ class _Signal:
Arguments:
name: Name of the shape of the signal. See `SIGNALS`.
npoints: Number of points generated for this signal
coef: Coefficient applied to the generator
poissonian: If true the signal is randomized with poissonian filter
"""
...
...
@@ -483,16 +484,24 @@ class _Signal:
}
def
__init__
(
self
,
name
:
str
=
"sawtooth"
,
npoints
:
int
=
50
,
poissonian
:
bool
=
False
self
,
name
:
str
=
"sawtooth"
,
npoints
:
int
=
50
,
poissonian
:
bool
=
False
,
coef
:
float
=
1.0
,
):
if
name
not
in
self
.
SIGNALS
:
raise
RuntimeError
(
f
"Signal name '
{
name
}
' undefined"
)
self
.
name
=
name
self
.
npoints
=
npoints
self
.
poissonian
=
poissonian
self
.
coef
=
coef
def
compute
(
self
)
->
numpy
.
ndarray
:
signal
=
self
.
SIGNALS
[
self
.
name
](
self
.
npoints
)
generator
=
self
.
SIGNALS
[
self
.
name
]
signal
=
generator
(
self
.
npoints
)
if
self
.
coef
!=
1
:
signal
=
signal
*
self
.
coef
if
self
.
poissonian
:
signal
=
numpy
.
random
.
poisson
(
signal
)
return
signal
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment