Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP-S 2020 - PyRaTk
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
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DELTA
DELTA Low-Cost 5.8GHz FMCW Radar PCB
AP-S 2020 Software
AP-S 2020 - PyRaTk
Commits
c5e74112
Commit
c5e74112
authored
4 years ago
by
Merlo, Jason
Browse files
Options
Downloads
Patches
Plain Diff
Fixed rescaling on spectrogram widget
parent
cc914e25
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyratk/widgets/spectrogram_widget.py
+23
-6
23 additions, 6 deletions
pyratk/widgets/spectrogram_widget.py
with
23 additions
and
6 deletions
pyratk/widgets/spectrogram_widget.py
+
23
−
6
View file @
c5e74112
...
...
@@ -20,7 +20,7 @@ class SpectrogramWidget(pg.PlotWidget):
super
(
SpectrogramWidget
,
self
).
__init__
()
# Copy arguments to member variables
self
.
data_mgr
=
radar
.
da
ta_mgr
self
.
data_mgr
=
radar
.
da
q
self
.
source
=
self
.
data_mgr
.
source
self
.
radar
=
radar
self
.
spectrogram_length
=
spectrogram_length
...
...
@@ -28,6 +28,8 @@ class SpectrogramWidget(pg.PlotWidget):
self
.
source
.
sample_chunk_size
/
self
.
source
.
sample_rate
self
.
show_max_plot
=
show_max_plot
self
.
fft_xrange
=
fft_xrange
# TODO temp
self
.
speed
=
10
self
.
downsample
=
10
...
...
@@ -97,7 +99,7 @@ class SpectrogramWidget(pg.PlotWidget):
self
.
addItem
(
self
.
img
)
# Allocate image array to store spectrogram
self
.
img_array
=
np
.
zeros
((
int
(
self
.
radar
.
c
fft_data
.
size
/
self
.
downsample
),
spectrogram_length
))
self
.
img_array
=
np
.
zeros
((
round
(
self
.
radar
.
fast_
fft_data
.
size
/
self
.
downsample
),
spectrogram_length
))
# Get the colormap
colormap
=
cm
.
get_cmap
(
"
jet
"
)
# cm.get_cmap("CMRmap")
...
...
@@ -114,13 +116,13 @@ class SpectrogramWidget(pg.PlotWidget):
# yscale = (log_freq_range[-1] / self.img_array.shape[0])
# self.img.scale((1. / self.source.sample_rate) * self.source.chunk_size / self.speed, yscale)
# self.setLogMode(y=True)
self
.
img
.
scale
(
1
,
self
.
radar
.
bin_size
*
self
.
downsample
)
self
.
img
.
scale
(
1
,
self
.
radar
.
fast_
bin_size
*
self
.
downsample
)
self
.
setRange
(
disableAutoRange
=
True
,
yRange
=
np
.
array
(
fft_xrange
))
self
.
setLimits
(
yMin
=-
self
.
source
.
sample_rate
/
2
,
yMax
=
self
.
source
.
sample_rate
/
2
)
self
.
img
.
translate
(
0
,
-
self
.
radar
.
c
fft_data
.
size
/
(
2
*
self
.
downsample
))
self
.
img
.
translate
(
0
,
-
self
.
radar
.
fast_
fft_data
.
size
/
(
2
*
self
.
downsample
))
self
.
setLabel
(
'
left
'
,
'
Frequency
'
,
units
=
'
Hz
'
)
self
.
showGrid
(
x
=
False
,
y
=
True
)
...
...
@@ -139,9 +141,9 @@ class SpectrogramWidget(pg.PlotWidget):
ALPHA
=
0.75
AVG_SAMPLES
=
2
*
self
.
speed
if
self
.
radar
.
c
fft_data
is
not
None
:
if
self
.
radar
.
fast_
fft_data
is
not
None
:
downsampled
=
self
.
radar
.
c
fft_data
[::
self
.
downsample
]
downsampled
=
self
.
radar
.
fast_
fft_data
[::
self
.
downsample
]
log_fft
=
10
*
np
.
log
(
downsampled
)
...
...
@@ -175,3 +177,18 @@ class SpectrogramWidget(pg.PlotWidget):
# When paused, redraw after reset
if
self
.
data_mgr
.
paused
:
self
.
update
()
self
.
rescale
()
def
rescale
(
self
):
self
.
img
.
resetTransform
()
self
.
update_period
=
\
self
.
source
.
sample_chunk_size
/
self
.
source
.
sample_rate
self
.
img
.
scale
(
1
,
self
.
radar
.
fast_bin_size
*
self
.
downsample
)
self
.
setRange
(
disableAutoRange
=
True
,
yRange
=
np
.
array
(
self
.
fft_xrange
))
self
.
setLimits
(
yMin
=-
self
.
source
.
sample_rate
/
2
,
yMax
=
self
.
source
.
sample_rate
/
2
)
self
.
img
.
translate
(
0
,
-
self
.
radar
.
fast_fft_data
.
size
/
(
2
*
self
.
downsample
))
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