Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
475a3d59
Commit
475a3d59
authored
9 months ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Add slots for all signal generators + typing
parent
0ebd8cb8
No related branches found
Branches containing commit
No related tags found
1 merge request
!445
Add slots for all signal generators + typing
Pipeline
#131490
failed
9 months ago
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
b_asic/signal_generator.py
+70
-1
70 additions, 1 deletion
b_asic/signal_generator.py
with
70 additions
and
1 deletion
b_asic/signal_generator.py
+
70
−
1
View file @
475a3d59
...
...
@@ -92,6 +92,8 @@ class Impulse(SignalGenerator):
__slots__
=
(
"
_delay
"
,)
_delay
:
int
def
__init__
(
self
,
delay
:
int
=
0
)
->
None
:
self
.
_delay
=
delay
...
...
@@ -114,6 +116,8 @@ class Step(SignalGenerator):
__slots__
=
(
"
_delay
"
,)
_delay
:
int
def
__init__
(
self
,
delay
:
int
=
0
)
->
None
:
self
.
_delay
=
delay
...
...
@@ -136,6 +140,8 @@ class Constant(SignalGenerator):
__slots__
=
(
"
_constant
"
,)
_constant
:
complex
def
__init__
(
self
,
constant
:
complex
=
1.0
)
->
None
:
self
.
_constant
=
constant
...
...
@@ -158,6 +164,9 @@ class ZeroPad(SignalGenerator):
__slots__
=
(
"
_data
"
,
"
_len
"
)
_data
:
Sequence
[
complex
]
_len
:
int
def
__init__
(
self
,
data
:
Sequence
[
complex
])
->
None
:
self
.
_data
=
data
self
.
_len
=
len
(
data
)
...
...
@@ -183,7 +192,13 @@ class FromFile(SignalGenerator):
Path to input file.
"""
def
__init__
(
self
,
path
)
->
None
:
__slots__
=
(
"
_data
"
,
"
_len
"
,
"
_path
"
)
_path
:
str
_data
:
List
[
Num
]
_len
:
int
def
__init__
(
self
,
path
:
str
)
->
None
:
self
.
_path
=
path
data
:
List
[
Num
]
=
np
.
loadtxt
(
path
,
dtype
=
complex
).
tolist
()
self
.
_data
=
data
...
...
@@ -211,6 +226,11 @@ class Sinusoid(SignalGenerator):
The normalized phase offset.
"""
__slots__
=
(
"
_frequency
"
,
"
_phase
"
)
_frequency
:
float
_phase
:
float
def
__init__
(
self
,
frequency
:
float
,
phase
:
float
=
0.0
)
->
None
:
self
.
_frequency
=
frequency
self
.
_phase
=
phase
...
...
@@ -242,6 +262,12 @@ class Gaussian(SignalGenerator):
The standard deviation of the noise.
"""
__slots__
=
(
"
_rng
"
,
"
_seed
"
,
"
_loc
"
,
"
_scale
"
)
_seed
:
Optional
[
int
]
_loc
:
float
_scale
:
float
def
__init__
(
self
,
seed
:
Optional
[
int
]
=
None
,
loc
:
float
=
0.0
,
scale
:
float
=
1.0
)
->
None
:
...
...
@@ -281,6 +307,12 @@ class Uniform(SignalGenerator):
The upper value of the uniform range.
"""
__slots__
=
(
"
_rng
"
,
"
_seed
"
,
"
_low
"
,
"
_high
"
)
_seed
:
Optional
[
int
]
_low
:
float
_high
:
float
def
__init__
(
self
,
seed
:
Optional
[
int
]
=
None
,
low
:
float
=
-
1.0
,
high
:
float
=
1.0
)
->
None
:
...
...
@@ -321,6 +353,11 @@ class Delay(SignalGenerator):
The number of time units to delay the generated signal.
"""
__slots__
=
(
"
_delay
"
,
"
_generator
"
)
_generator
:
SignalGenerator
_delay
:
int
def
__init__
(
self
,
generator
:
SignalGenerator
,
delay
:
int
=
1
)
->
None
:
self
.
_generator
=
generator
self
.
_delay
=
delay
...
...
@@ -337,6 +374,11 @@ class _AddGenerator(SignalGenerator):
Signal generator that adds two signals.
"""
__slots__
=
(
"
_a
"
,
"
_b
"
)
_a
:
SignalGenerator
_b
:
SignalGenerator
def
__init__
(
self
,
a
:
SignalGenerator
,
b
:
SignalGenerator
)
->
None
:
self
.
_a
=
a
self
.
_b
=
b
...
...
@@ -353,6 +395,11 @@ class _SubGenerator(SignalGenerator):
Signal generator that subtracts two signals.
"""
__slots__
=
(
"
_a
"
,
"
_b
"
)
_a
:
SignalGenerator
_b
:
SignalGenerator
def
__init__
(
self
,
a
:
SignalGenerator
,
b
:
SignalGenerator
)
->
None
:
self
.
_a
=
a
self
.
_b
=
b
...
...
@@ -369,6 +416,11 @@ class _MulGenerator(SignalGenerator):
Signal generator that multiplies two signals.
"""
__slots__
=
(
"
_a
"
,
"
_b
"
)
_a
:
SignalGenerator
_b
:
SignalGenerator
def
__init__
(
self
,
a
:
SignalGenerator
,
b
:
SignalGenerator
)
->
None
:
self
.
_a
=
a
self
.
_b
=
b
...
...
@@ -395,6 +447,11 @@ class _DivGenerator(SignalGenerator):
Signal generator that divides two signals.
"""
__slots__
=
(
"
_a
"
,
"
_b
"
)
_a
:
SignalGenerator
_b
:
SignalGenerator
def
__init__
(
self
,
a
:
SignalGenerator
,
b
:
SignalGenerator
)
->
None
:
self
.
_a
=
a
self
.
_b
=
b
...
...
@@ -436,6 +493,12 @@ class Upsample(SignalGenerator):
The phase of the upsampling.
"""
__slots__
=
(
"
_generator
"
,
"
_factor
"
,
"
_phase
"
)
_generator
:
Union
[
SignalGenerator
,
Sequence
[
complex
]]
_factor
:
int
_phase
:
int
def
__init__
(
self
,
data
:
Union
[
SignalGenerator
,
Sequence
[
complex
]],
...
...
@@ -475,6 +538,12 @@ class Downsample(SignalGenerator):
The phase of the downsampling.
"""
__slots__
=
(
"
_generator
"
,
"
_factor
"
,
"
_phase
"
)
_generator
:
Union
[
SignalGenerator
,
Sequence
[
complex
]]
_factor
:
int
_phase
:
int
def
__init__
(
self
,
data
:
Union
[
SignalGenerator
,
Sequence
[
complex
]],
...
...
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