Conversation
upul-li
commented
Dec 20, 2024
- Wrote Python script for configuring and streaming IQ samples from Lock-in Amplifier.
- Created GNU Radio files for a simple FM receiver.
- Basic usage instructions added.
| from PyQt5 import Qt | ||
| from gnuradio import qtgui | ||
| from PyQt5 import QtCore | ||
| from gnuradio import analog | ||
| from gnuradio import audio | ||
| from gnuradio import blocks | ||
| from gnuradio import blocks, gr | ||
| from gnuradio import filter | ||
| from gnuradio.filter import firdes | ||
| from gnuradio import gr | ||
| from gnuradio.fft import window | ||
| import sys | ||
| import signal | ||
| from PyQt5 import Qt | ||
| from argparse import ArgumentParser | ||
| from gnuradio.eng_arg import eng_float, intx | ||
| from gnuradio import eng_notation | ||
| import difi | ||
| import sip |
There was a problem hiding this comment.
Please clean up these imports. You import Qt twice, you import gnuradio.blocks and gnuradio.gr twice etc. Prefer list imports so long as the list doesn't get too long, e.g. from gnuradio import analog, audio, blocks, .... Once you've consolidated, they should also be sorted
There was a problem hiding this comment.
Actually one good thing to do here is probably to run black over this code. It's a Python linter with some fairly sensible defaults.
There was a problem hiding this comment.
This is the top block code auto generated from GNU Radio. Changes made manually are overwritten by the scheduler when running the flow graph from gnu radio companion. I believe changes are viable if the application is intended for a field deployment.
| self._volume_range = qtgui.Range(0, 4, 0.1, 1, 200) | ||
| self._volume_win = qtgui.RangeWidget(self._volume_range, self.set_volume, "Volume", "counter_slider", float, QtCore.Qt.Horizontal) | ||
| self.top_layout.addWidget(self._volume_win) | ||
| self.rational_resampler_xxx_0 = filter.rational_resampler_ccc( |
There was a problem hiding this comment.
Where do these magic numbers come from? Given that this is an example it'd be worth a few concise comments
There was a problem hiding this comment.
Auto generated code from GNU Radio. Changes made manually are overwritten when running the flow graph from gnu radio companion.
|
|
||
| self.qtgui_waterfall_sink_x_0.set_plot_pos_half(not False) | ||
|
|
||
| labels = ['', '', '', '', '', |
There was a problem hiding this comment.
labels = [''] * 10, and similar below. But why 10?
There was a problem hiding this comment.
Auto generated code from GNU Radio. Changes made manually are overwritten when running the flow graph from gnu radio companion.
| alphas = [1.0, 1.0, 1.0, 1.0, 1.0, | ||
| 1.0, 1.0, 1.0, 1.0, 1.0] | ||
|
|
||
| for i in range(1): |
There was a problem hiding this comment.
.. and why 1 here? What are we looking at, is this something like channel count and for now we only support a single channel?
There was a problem hiding this comment.
Auto generated code from GNU Radio. Changes made manually are overwritten when running the flow graph from gnu radio companion.
| self.qtgui_time_sink_x_0.enable_stem_plot(False) | ||
|
|
||
|
|
||
| labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', |
There was a problem hiding this comment.
As above why 10, and consider using some shorthands like widths = [1] * 10 and labels = [f"Signal {i+1}" for i in range(10)]
There was a problem hiding this comment.
Auto generated code from GNU Radio. Changes made manually are overwritten when running the flow graph from gnu radio companion.