Skip to content
GitLab
Explore
Sign in
Register
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
7a1fd24d
Commit
7a1fd24d
authored
8 months ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Correct inData order in non_maximal_downsample_bpf()
parent
62d44525
No related branches found
No related tags found
1 merge request
!419
Resolve RTSD-265
Pipeline
#91855
passed
8 months ago
Stage: linting
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/lofar2/model/rtdsp/multirate.py
+12
-7
12 additions, 7 deletions
applications/lofar2/model/rtdsp/multirate.py
with
12 additions
and
7 deletions
applications/lofar2/model/rtdsp/multirate.py
+
12
−
7
View file @
7a1fd24d
...
...
@@ -190,7 +190,7 @@ class PolyPhaseFirFilterStructure:
def
map_to_poly_delays
(
self
,
delayLine
):
self
.
polyDelays
=
delayLine
.
reshape
((
self
.
Ntaps
,
self
.
Nphases
)).
T
def
shift_in_data
(
self
,
inData
):
def
shift_in_data
(
self
,
inData
,
flipped
=
False
):
"""
Shift block of data into the polyDelays structure.
View polyDelays as delay line if L < Nphases. Shift in from the left
...
...
@@ -202,22 +202,25 @@ class PolyPhaseFirFilterStructure:
. inData: Block of one or more input samples with index as time index
n in inData[n], so oldest sample at index 0 and newest sample at
index -1.
. flipped: False then inData order is inData[n] and still needs to be
flipped. If True then the inData is already flipped.
"""
L
=
len
(
inData
)
xData
=
inData
if
flipped
else
np
.
flip
(
inData
)
if
L
<
self
.
Nphases
:
delayLine
=
self
.
map_to_delay_line
()
# Equivalent code:
# delayLine = np.concatenate((inData, delayLine[L:]))
delayLine
=
np
.
roll
(
delayLine
,
L
)
delayLine
[:
L
]
=
np
.
flip
(
in
Data
)
delayLine
[:
L
]
=
x
Data
self
.
map_to_poly_delays
(
delayLine
)
else
:
# Equivalent code for L == Nphases: Shift in inData block directly
# at column 0
self
.
polyDelays
=
np
.
roll
(
self
.
polyDelays
,
1
,
axis
=
1
)
self
.
polyDelays
[:,
0
]
=
np
.
flip
(
in
Data
)
self
.
polyDelays
[:,
0
]
=
x
Data
def
filter_block
(
self
,
inData
):
def
filter_block
(
self
,
inData
,
flipped
=
False
):
"""
Filter block of inData per polyphase.
Input:
...
...
@@ -228,9 +231,11 @@ class PolyPhaseFirFilterStructure:
Return:
. pfsData: block of polyphase FIR filtered output data for Nphase, with
pfsData[p] and p = 0:Nphases-1 from top to bottom.
. flipped: False then inData order is inData[n] and still needs to be
flipped. If True then the inData is already flipped.
"""
# Shift in one block of input data (1 <= len(inData) <= Nphases)
self
.
shift_in_data
(
inData
)
self
.
shift_in_data
(
inData
,
flipped
)
# Apply FIR coefs per delay element
zData
=
self
.
polyDelays
*
self
.
polyCoefs
# Sum FIR taps per polyphase
...
...
@@ -353,7 +358,7 @@ def polyphase_frontend(x, Nphases, coefs, sampling):
Ndown
=
Nphases
Nzeros
=
Ndown
-
1
polyX
,
Nx
,
Nxp
=
polyphase_data_for_downsampling_whole_x
(
x
,
Ndown
,
Nzeros
)
print
(
polyX
[:,
0
])
#
print(polyX[:, 0])
# Filter Ndown parts of x per polyphase, because the FIR filter output
# y will sum. The commutator index order for downsampling is p =
# Ndown - 1,..., 1, 0, so from bottom to top in the PFS. However, the
...
...
@@ -709,7 +714,7 @@ def non_maximal_downsample_bpf(x, Ndown, k, Ndft, coefs, verbosity=1):
for
b
in
range
(
Nblocks
):
# Filter block
inData
=
xBlocks
[:,
b
]
pfsData
=
pfs
.
filter_block
(
inData
)
pfsData
=
pfs
.
filter_block
(
inData
,
flipped
=
True
)
# Phase rotate polyphases for bin k [HARRIS Eq 6.8]
pfsBinData
=
pfsData
*
phasors
# Sum the polyphases to get single downsampled and downconverted output value
...
...
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