Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
edcde25b
Commit
edcde25b
authored
9 months ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Add verbosity.
parent
22053a35
No related branches found
No related tags found
1 merge request
!413
Resolve RTSD-271 "C"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/lofar2/model/rtdsp/multirate.py
+29
-23
29 additions, 23 deletions
applications/lofar2/model/rtdsp/multirate.py
with
29 additions
and
23 deletions
applications/lofar2/model/rtdsp/multirate.py
+
29
−
23
View file @
edcde25b
...
@@ -134,7 +134,7 @@ class PolyPhaseFirFilterStructure:
...
@@ -134,7 +134,7 @@ class PolyPhaseFirFilterStructure:
return
outData
return
outData
def
upsample
(
x
,
Nup
,
coefs
,
verify
=
False
):
# interpolate
def
upsample
(
x
,
Nup
,
coefs
,
verify
=
False
,
verbosity
=
1
):
# interpolate
"""
Upsample x by factor I = Nup
"""
Upsample x by factor I = Nup
Input:
Input:
...
@@ -143,6 +143,7 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
...
@@ -143,6 +143,7 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
. coefs: FIR filter coefficients for antialiasing LPF
. coefs: FIR filter coefficients for antialiasing LPF
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
polyphase implementation.
polyphase implementation.
- verbosity: when > 0 print() status, else no print()
Return:
Return:
. y: Upsampled output signal y[m]
. y: Upsampled output signal y[m]
...
@@ -242,15 +243,16 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
...
@@ -242,15 +243,16 @@ def upsample(x, Nup, coefs, verify=False): # interpolate
else
:
else
:
print
(
'
ERROR: wrong upsample result
'
)
print
(
'
ERROR: wrong upsample result
'
)
print
(
'
> upsample():
'
)
if
verbosity
:
print
(
'
. Nup =
'
+
str
(
Nup
))
print
(
'
> upsample():
'
)
print
(
'
. Nx =
'
+
str
(
Nx
))
print
(
'
. Nup =
'
+
str
(
Nup
))
print
(
'
. len(y) =
'
+
str
(
len
(
y
)))
print
(
'
. Nx =
'
+
str
(
Nx
))
print
(
''
)
print
(
'
. len(y) =
'
+
str
(
len
(
y
)))
print
(
''
)
return
y
return
y
def
downsample
(
x
,
Ndown
,
coefs
,
verify
=
False
):
# decimate
def
downsample
(
x
,
Ndown
,
coefs
,
verify
=
False
,
verbosity
=
1
):
# decimate
"""
Downsample x by factor D = Ndown up
"""
Downsample x by factor D = Ndown up
Input:
Input:
...
@@ -259,6 +261,7 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
...
@@ -259,6 +261,7 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
. coefs: FIR filter coefficients for antialiasing LPF
. coefs: FIR filter coefficients for antialiasing LPF
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
polyphase implementation.
polyphase implementation.
- verbosity: when > 0 print() status, else no print()
Return:
Return:
. y: Downsampled output signal y[m]
. y: Downsampled output signal y[m]
...
@@ -368,17 +371,18 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
...
@@ -368,17 +371,18 @@ def downsample(x, Ndown, coefs, verify=False): # decimate
else
:
else
:
print
(
'
ERROR: wrong downsample result
'
)
print
(
'
ERROR: wrong downsample result
'
)
print
(
'
> downsample():
'
)
if
verbosity
:
print
(
'
. len(x) =
'
+
str
(
len
(
x
)))
print
(
'
> downsample():
'
)
print
(
'
. Ndown =
'
+
str
(
Ndown
))
print
(
'
. len(x) =
'
+
str
(
len
(
x
)))
print
(
'
. Nx =
'
+
str
(
Nx
))
print
(
'
. Ndown =
'
+
str
(
Ndown
))
print
(
'
. Nxp =
'
+
str
(
Nxp
))
print
(
'
. Nx =
'
+
str
(
Nx
))
print
(
'
. len(y) =
'
+
str
(
len
(
y
)))
# = Nxp
print
(
'
. Nxp =
'
+
str
(
Nxp
))
print
(
''
)
print
(
'
. len(y) =
'
+
str
(
len
(
y
)))
# = Nxp
print
(
''
)
return
y
return
y
def
resample
(
x
,
Nup
,
Ndown
,
coefs
,
verify
=
False
):
# interpolate and decimate by Nup / Ndown
def
resample
(
x
,
Nup
,
Ndown
,
coefs
,
verify
=
False
,
verbosity
=
1
):
# interpolate and decimate by Nup / Ndown
"""
Resample x by factor I / D = Nup / Ndown
"""
Resample x by factor I / D = Nup / Ndown
x[n] --> Nup --> v[m] --> LPF --> w[m] --> Ndown --> y[k]
x[n] --> Nup --> v[m] --> LPF --> w[m] --> Ndown --> y[k]
...
@@ -408,6 +412,7 @@ def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by
...
@@ -408,6 +412,7 @@ def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by
. coefs: FIR filter coefficients for antialiasing LPF
. coefs: FIR filter coefficients for antialiasing LPF
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
. verify: when True then verify that output y is the same when calculated directly or when calculated using the
polyphase implementation.
polyphase implementation.
- verbosity: when > 0 print() status, else no print()
Return:
Return:
. y: Resampled output signal y[m]
. y: Resampled output signal y[m]
...
@@ -458,12 +463,13 @@ def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by
...
@@ -458,12 +463,13 @@ def resample(x, Nup, Ndown, coefs, verify=False): # interpolate and decimate by
else
:
else
:
print
(
'
ERROR: wrong resample result
'
)
print
(
'
ERROR: wrong resample result
'
)
print
(
'
> resample():
'
)
if
verbosity
:
print
(
'
. len(x) =
'
+
str
(
len
(
x
)))
print
(
'
> resample():
'
)
print
(
'
. Nx =
'
+
str
(
Nx
))
print
(
'
. len(x) =
'
+
str
(
len
(
x
)))
print
(
'
. len(v) =
'
+
str
(
len
(
v
)))
print
(
'
. Nx =
'
+
str
(
Nx
))
print
(
'
. Ny =
'
+
str
(
Ny
))
print
(
'
. len(v) =
'
+
str
(
len
(
v
)))
print
(
'
. Nyp =
'
+
str
(
Nyp
))
print
(
'
. Ny =
'
+
str
(
Ny
))
print
(
'
. len(y) =
'
+
str
(
len
(
y
)))
print
(
'
. Nyp =
'
+
str
(
Nyp
))
print
(
''
)
print
(
'
. len(y) =
'
+
str
(
len
(
y
)))
print
(
''
)
return
y
return
y
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